blob: c23ba9dcc1f5813f8f67eed2f8368b8e874a043c [file] [log] [blame]
<!DOCTYPE html>
<script src="/js-test-resources/testharness.js"></script>
<script src="/js-test-resources/testharnessreport.js"></script>
<script>
var t = async_test('Makes sure that preloaded resources are downloaded');
</script>
<link rel=preload href="../resources/dummy.js" as=script>
<link rel=preload href="../resources/dummy.css" as=style>
<link rel=preload href="../resources/square100.png" as=image>
<link rel=preload href="../resources/Ahem.woff" as=font crossorigin>
<link rel=preload href="../resources/test.mp4" as=video>
<link rel=preload href="../security/resources/captions.vtt" as=track>
<link rel=preload href="../resources/dummy.xml?badvalue" as=foobarxmlthing>
<link rel=preload href="../resources/dummy.xml?empty">
<link rel=preload href="../resources/dummy.xml" as=fetch>
<script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=400"></script>
<script>
assert_true(internals.isPreloaded("../resources/dummy.js"));
assert_true(internals.isPreloaded("../resources/dummy.css"));
assert_true(internals.isPreloaded("../resources/square100.png"));
// FIXME: RT doesn't show downloads for the resources below. Need to investigate why.
assert_true(internals.isPreloaded("../resources/Ahem.woff"));
assert_true(internals.isPreloaded("../resources/test.mp4"));
assert_true(internals.isPreloaded("../security/resources/captions.vtt"));
assert_false(internals.isPreloaded("../resources/dummy.xml?badvalue"));
assert_false(internals.isPreloaded("../resources/dummy.xml?empty"));
assert_true(internals.isPreloaded("../resources/dummy.xml"));
document.write('<script src="../resources/dummy.js"></scr' + 'ipt>' +
'<link rel=stylesheet href="../resources/dummy.css">' +
'<img src="../resources/square100.png">' +
'<video><source src="../resources/test.mp4">' +
'<track kind=subtitles src="../security/resources/captions.vtt" srclang=en>' +
'</video>' +
'<style>' +
' @font-face { font-family:ahem; src: url(../resources/Ahem.woff); }' +
' span { font-family: ahem, Arial; }' +
'</style>' +
'<span>This test makes sure that link preload preloads resources</span>');
var xhr = new XMLHttpRequest();
xhr.open("GET", "../resources/dummy.xml");
xhr.send();
t.done();
</script>