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 var fetchLoaded = false; |
17 </script> | 18 </script> |
18 <link rel=preload href="resources/dummy.js" as=script onload="scriptLoaded = tru
e;"> | 19 <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
;"> | 20 <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;"> | 21 <link rel=preload href="resources/square.png" as=image onload="imageLoaded = tru
e;"> |
21 <link rel=preload href="/fonts/CanvasTest.ttf" as=font crossorigin onload="fontL
oaded = true;"> | 22 <link rel=preload href="/fonts/CanvasTest.ttf" as=font crossorigin onload="fontL
oaded = true;"> |
22 <link rel=preload href="/media/white.mp4" as=video onload="videoLoaded = true;"> | 23 <link rel=preload href="/media/white.mp4" as=video onload="videoLoaded = true;"> |
23 <link rel=preload href="/media/sound_5.oga" as=audio onload="audioLoaded = true;
"> | 24 <link rel=preload href="/media/sound_5.oga" as=audio onload="audioLoaded = true;
"> |
24 <link rel=preload href="/media/foo.vtt" as=track onload="trackLoaded = true;"> | 25 <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;"> | 26 <link rel=preload href="resources/dummy.xml?foo=bar" as=foobarxmlthing onload="g
ibberishLoaded = true;" onerror="gibberishErrored = true;"> |
| 27 <link rel=preload href="resources/dummy.xml?fetch" as=fetch onload="fetchLoaded
= true;"> |
26 <link rel=preload href="resources/dummy.xml" onload="noTypeLoaded = true;"> | 28 <link rel=preload href="resources/dummy.xml" onload="noTypeLoaded = true;"> |
27 <body> | 29 <body> |
28 <script src="resources/dummy.js?pipe=trickle(d5)"></script> | 30 <script src="resources/dummy.js?pipe=trickle(d5)"></script> |
29 <script> | 31 <script> |
30 window.onload = t.step_func(function() { | 32 window.onload = t.step_func(function() { |
31 verifyPreloadAndRTSupport(); | 33 verifyPreloadAndRTSupport(); |
32 assert_true(styleLoaded, "style triggered load event"); | 34 assert_true(styleLoaded, "style triggered load event"); |
33 assert_true(scriptLoaded, "script triggered load event"); | 35 assert_true(scriptLoaded, "script triggered load event"); |
34 assert_true(imageLoaded, "image triggered load event"); | 36 assert_true(imageLoaded, "image triggered load event"); |
35 assert_true(fontLoaded, "font triggered load event"); | 37 assert_true(fontLoaded, "font triggered load event"); |
36 assert_true(videoLoaded, "video triggered load event"); | 38 assert_true(videoLoaded, "video triggered load event"); |
37 assert_true(audioLoaded, "audio triggered load event"); | 39 assert_true(audioLoaded, "audio triggered load event"); |
38 assert_true(trackLoaded, "track triggered load event"); | 40 assert_true(trackLoaded, "track triggered load event"); |
39 assert_false(gibberishLoaded, "gibberish as value triggered load event")
; | 41 assert_false(gibberishLoaded, "gibberish as value triggered load event")
; |
40 assert_true(gibberishErrored, "gibberish as value triggered error event"
); | 42 assert_false(gibberishErrored, "gibberish as value triggered error event
"); |
41 assert_true(noTypeLoaded, "empty as triggered load event"); | 43 assert_true(fetchLoaded, "fetch as value triggered load event"); |
| 44 assert_false(noTypeLoaded, "empty as triggered load event"); |
42 t.done(); | 45 t.done(); |
43 }); | 46 }); |
44 </script> | 47 </script> |
45 </body> | 48 </body> |
OLD | NEW |