OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="/resources/testharness.js"></script> | 2 <script src="/resources/testharness.js"></script> |
3 <script src="/resources/testharnessreport.js"></script> | 3 <script src="/resources/testharnessreport.js"></script> |
4 <script src="/preload/resources/preload_helper.js"></script> | 4 <script src="/preload/resources/preload_helper.js"></script> |
5 <script> | 5 <script> |
6 var t = async_test('Makes sure that preloaded resources trigger the onload e
vent'); | 6 var t = async_test('Makes sure that preloaded resources trigger the onload e
vent'); |
7 var scriptLoaded = false; | 7 var scriptLoaded = false; |
8 var styleLoaded = false; | 8 var styleLoaded = false; |
9 var imageLoaded = false; | 9 var imageLoaded = false; |
10 var fontLoaded = false; | 10 var fontLoaded = false; |
11 var videoLoaded = false; | 11 var videoLoaded = false; |
12 var audioLoaded = false; | 12 var audioLoaded = false; |
13 var trackLoaded = false; | 13 var trackLoaded = false; |
14 var gibberishLoaded = false; | 14 var gibberishLoaded = false; |
15 var gibberishErrored = false; | 15 var gibberishErrored = false; |
16 var noTypeLoaded = false; | 16 var noTypeLoaded = false; |
17 </script> | 17 </script> |
18 <link rel=preload href="resources/dummy.js" as=script onload="scriptLoaded = tru
e;"> | 18 <link rel=preload href="resources/dummy.js" as=script onload="scriptLoaded = tru
e;"> |
19 <link rel=preload href="resources/dummy.css" as=style onload="styleLoaded = true
;"> | 19 <link rel=preload href="resources/dummy.css" as=style onload="styleLoaded = true
;"> |
20 <link rel=preload href="resources/square.png" as=image onload="imageLoaded = tru
e;"> | 20 <link rel=preload href="resources/square.png" as=image onload="imageLoaded = tru
e;"> |
21 <link rel=preload href="/media/CanvasTest.ttf" as=font crossorigin onload="fontL
oaded = true;"> | 21 <link rel=preload href="/media/CanvasTest.ttf" as=font crossorigin onload="fontL
oaded = true;"> |
22 <link rel=preload href="/media/white.mp4" as=media onload="videoLoaded = true;"> | 22 <link rel=preload href="/media/white.mp4" as=video onload="videoLoaded = true;"> |
23 <link rel=preload href="/media/sound_5.oga" as=media onload="audioLoaded = true;
"> | 23 <link rel=preload href="/media/sound_5.oga" as=audio onload="audioLoaded = true;
"> |
24 <link rel=preload href="/media/foo.vtt" as=media onload="trackLoaded = true;"> | 24 <link rel=preload href="/media/foo.vtt" as=track onload="trackLoaded = true;"> |
25 <link rel=preload href="resources/dummy.xml?foo=bar" as=foobarxmlthing onload="g
ibberishLoaded = true;" onerror="gibberishErrored = true;"> | 25 <link rel=preload href="resources/dummy.xml?foo=bar" as=foobarxmlthing onload="g
ibberishLoaded = true;" onerror="gibberishErrored = true;"> |
26 <link rel=preload href="resources/dummy.xml" onload="noTypeLoaded = true;"> | 26 <link rel=preload href="resources/dummy.xml" onload="noTypeLoaded = true;"> |
27 <body> | 27 <body> |
28 <script src="resources/dummy.js?pipe=trickle(d5)"></script> | 28 <script src="resources/dummy.js?pipe=trickle(d5)"></script> |
29 <script> | 29 <script> |
30 window.onload = t.step_func(function() { | 30 window.onload = t.step_func(function() { |
31 verifyPreloadAndRTSupport(); | 31 verifyPreloadAndRTSupport(); |
32 assert_true(styleLoaded, "style triggered load event"); | 32 assert_true(styleLoaded, "style triggered load event"); |
33 assert_true(scriptLoaded, "script triggered load event"); | 33 assert_true(scriptLoaded, "script triggered load event"); |
34 assert_true(imageLoaded, "image triggered load event"); | 34 assert_true(imageLoaded, "image triggered load event"); |
35 assert_true(fontLoaded, "font triggered load event"); | 35 assert_true(fontLoaded, "font triggered load event"); |
36 assert_true(videoLoaded, "video triggered load event"); | 36 assert_true(videoLoaded, "video triggered load event"); |
37 assert_true(audioLoaded, "audio triggered load event"); | 37 assert_true(audioLoaded, "audio triggered load event"); |
38 assert_true(trackLoaded, "track triggered load event"); | 38 assert_true(trackLoaded, "track triggered load event"); |
39 assert_false(gibberishLoaded, "gibberish as value triggered load event")
; | 39 assert_false(gibberishLoaded, "gibberish as value triggered load event")
; |
40 assert_true(gibberishErrored, "gibberish as value triggered error event"
); | 40 assert_true(gibberishErrored, "gibberish as value triggered error event"
); |
41 assert_true(noTypeLoaded, "empty as triggered load event"); | 41 assert_true(noTypeLoaded, "empty as triggered load event"); |
42 t.done(); | 42 t.done(); |
43 }); | 43 }); |
44 </script> | 44 </script> |
45 </body> | 45 </body> |
OLD | NEW |