OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Tests TextTrackCueList functionality: length, operator[], and getCueById(
).</title> |
3 <head> | 3 <script src="../../resources/testharness.js"></script> |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <video> |
| 6 <track src="captions-webvtt/tc013-settings.vtt" kind="captions" default> |
| 7 </video> |
| 8 <script> |
| 9 async_test(function(t) { |
| 10 var testTrack = document.querySelector("track"); |
5 | 11 |
6 <script src=../media-file.js></script> | 12 testTrack.onload = t.step_func_done(function() { |
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 13 var cues = testTrack.track.cues; |
8 (Please avoid writing new tests using video-test.js) --> | |
9 <script src=../video-test.js></script> | |
10 <script> | |
11 | 14 |
12 function trackLoaded() | 15 // Testing TextTrackCueList length. |
13 { | 16 assert_equals(cues.length, 4); |
14 var testTrack = document.getElementById('testTrack'); | |
15 cues = testTrack.track.cues; | |
16 | 17 |
17 consoleWrite("<br>*** Testing TextTrackCueList length"); | 18 // Testing TextTrackCueList [] operator. |
| 19 assert_equals(cues[0].id, "1"); |
| 20 assert_equals(cues[3].id, "4"); |
| 21 assert_object_equals(cues[4], undefined); |
18 | 22 |
19 testExpected("cues.length", 4); | 23 // Testing TextTrackCueList getCueById(). |
20 | 24 assert_equals(cues.getCueById("1").startTime, 0); |
21 consoleWrite("<br>*** Testing TextTrackCueList [] operator"); | 25 assert_equals(cues.getCueById("4").startTime, 121); |
22 | 26 assert_object_equals(cues.getCueById("junk"), undefined); |
23 testExpected("cues[0].id", "1"); | 27 }); |
24 testExpected("cues[3].id", "4"); | 28 }); |
25 testExpected("cues[4]", undefined); | 29 </script> |
26 | |
27 consoleWrite("<br>*** Testing TextTrackCueList getCueById()"); | |
28 | |
29 testExpected("cues.getCueById('1').startTime", 0); | |
30 testExpected("cues.getCueById('4').startTime", 121); | |
31 testExpected("cues.getCueById('junk')", undefined); | |
32 | |
33 endTest(); | |
34 } | |
35 | |
36 </script> | |
37 </head> | |
38 <body> | |
39 <p>Tests TextTrackCueList functionality: length, operator[], and getCueB
yId()</p> | |
40 <video> | |
41 <track id="testTrack" src="captions-webvtt/tc013-settings.vtt" kind=
"captions" onload="trackLoaded()" default> | |
42 </video> | |
43 </body> | |
44 </html> | |
OLD | NEW |