OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Tests that a track with the "default" attribute loads automatically.</tit
le> |
3 <head> | 3 <video> |
4 <script src=../media-file.js></script> | 4 <track kind="captions" src="captions-webvtt/tc005-default-styles.vtt"> |
5 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 5 <track kind="captions" src="captions-webvtt/tc005-metadata-area.vtt"> |
6 (Please avoid writing new tests using video-test.js) --> | 6 <track default kind="captions" src="captions-webvtt/tc004-webvtt-file.vtt" i
d="default"> |
7 <script src=../video-test.js></script> | 7 </video> |
8 <script> | 8 <script src="../../resources/testharness.js"></script> |
9 | 9 <script src="../../resources/testharnessreport.js"></script> |
10 var timer = null; | 10 <script> |
11 | 11 async_test(function(t) { |
12 function trackLoaded() | 12 var timer = null; |
13 { | 13 var tracks = document.querySelectorAll("track"); |
14 consoleWrite("EVENT(load)"); | 14 for (var track of tracks) { |
15 testExpected("event.target.readyState", HTMLTrackElement.LOADED)
; | 15 track.onload = t.step_func(function() { |
16 testExpected("event.target.id", "default"); | 16 assert_equals(event.target.readyState, HTMLTrackElement.LOADED); |
17 testExpected("event.target.default", true); | 17 assert_equals(event.target.id, "default"); |
18 consoleWrite(""); | 18 assert_true(event.target.default); |
19 | 19 // End the test after a brief pause so we allow other tracks to load
if they will. |
20 // End the test after a brief pause so we allow other tracks to
load if they will. | 20 if (timer) |
21 if (timer) | 21 clearTimeout(timer); |
22 clearTimeout(timer); | 22 timer = setTimeout(function() { t.done(); }, 200); |
23 timer = setTimeout(function() { endTest() }, 200); | 23 }); |
24 } | 24 } |
25 | 25 }); |
26 </script> | 26 </script> |
27 </head> | |
28 <body> | |
29 <p>Tests that a track with the 'default' attribute loads automatically.<
/p> | |
30 <video> | |
31 <track kind="captions" src="captions-webvtt/tc005-default-styles.vtt
" onload="trackLoaded()"> | |
32 <track kind="captions" src="captions-webvtt/tc005-metadata-area.vtt"
onload="trackLoaded()"> | |
33 <track default kind="captions" src="captions-webvtt/tc004-webvtt-fil
e.vtt" onload="trackLoaded()" id="default" > | |
34 </video> | |
35 </body> | |
36 </html> | |
OLD | NEW |