OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Tests cue timings that do not contain hours (they are optional), and test
s various syntax errors in timings without hours.</title> |
3 <head> | 3 <script src="track-helpers.js"></script> |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <video> |
| 7 <track src="captions-webvtt/tc008-timings-no-hour.vtt"> |
| 8 <track src="captions-webvtt/tc008-timings-no-hour-errors.vtt"> |
| 9 </video> |
| 10 <script> |
| 11 async_test(function(t) { |
| 12 var video = document.querySelector("video"); |
5 | 13 |
6 <script src=../media-file.js></script> | 14 var trackElements = document.querySelectorAll("track"); |
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 15 for (var i = 0; i < video.textTracks.length; i++) |
8 (Please avoid writing new tests using video-test.js) --> | 16 trackElements[i].onload = t.step_func(trackLoaded); |
9 <script src=../video-test.js></script> | |
10 <script> | |
11 | 17 |
12 numberOfTrackTests = 2; | 18 enableAllTextTracks(video.textTracks); |
13 | 19 |
14 function trackLoaded() | 20 var numberOfTracksLoaded = 0; |
| 21 function trackLoaded() { |
| 22 numberOfTracksLoaded++; |
| 23 if (numberOfTracksLoaded != 2) |
| 24 return; |
| 25 |
| 26 testTrack0(); |
| 27 testTrack1(); |
| 28 t.done(); |
| 29 } |
| 30 |
| 31 function testTrack0() { |
| 32 var expected = [ |
15 { | 33 { |
16 numberOfTracksLoaded++; | 34 id : "1", |
17 if (numberOfTracksLoaded == numberOfTrackTests) { | 35 startTime : 0, |
18 testTrack0(); | 36 endTime : 30.5, |
19 testTrack1(); | 37 text : "Bear is Coming!!!!!" |
20 } | 38 }, |
| 39 { |
| 40 id : "2", |
| 41 startTime : 31, |
| 42 endTime : 60.5, |
| 43 text : "I said Bear is coming!!!!" |
| 44 }, |
| 45 { |
| 46 id : "3", |
| 47 startTime : 61, |
| 48 endTime : 120.5, |
| 49 text : "I said Bear is coming now!!!!" |
| 50 }, |
| 51 { |
| 52 id : "4", |
| 53 startTime : 121, |
| 54 endTime : 180.5, |
| 55 text : "tab separators" |
21 } | 56 } |
| 57 ]; |
22 | 58 |
23 function testTrack0() | 59 assert_cues_equal(video.textTracks[0].cues, expected); |
24 { | 60 } |
25 findMediaElement(); | |
26 var expected = | |
27 { | |
28 length : 4, | |
29 tests: | |
30 [ | |
31 { | |
32 property : "id", | |
33 values : ["1", "2", "3", "4"], | |
34 }, | |
35 { | |
36 property : "startTime", | |
37 values : [0.0, 31.0, 61.0, 121.0], | |
38 }, | |
39 { | |
40 property : "endTime", | |
41 values : [30.5, 60.5, 120.5, 180.5], | |
42 }, | |
43 { | |
44 property : "text", | |
45 values : ["Bear is Coming!!!!!", "I said Bear is com
ing!!!!", "I said Bear is coming now!!!!", "tab separators"], | |
46 }, | |
47 ], | |
48 }; | |
49 testCues(0, expected); | |
50 | 61 |
51 allTestsEnded(); | 62 function testTrack1() { |
52 } | 63 // Test that all the cues are ignored. |
53 | 64 assert_cues_equal(video.textTracks[1].cues, []); |
54 function testTrack1() | 65 } |
55 { | 66 }); |
56 findMediaElement(); | 67 </script> |
57 var expected = | |
58 { | |
59 length : 0, | |
60 tests: | |
61 [], | |
62 }; | |
63 testCues(1, expected); | |
64 | |
65 allTestsEnded(); | |
66 } | |
67 </script> | |
68 </head> | |
69 <body onload="enableAllTextTracks()"> | |
70 <p>Tests cue timings that do not contain hours (they are optional), and
tests various syntax errors in timings without hours.</p> | |
71 <video> | |
72 <track src="captions-webvtt/tc008-timings-no-hour.vtt" onload="track
Loaded()"> | |
73 <track src="captions-webvtt/tc008-timings-no-hour-errors.vtt" onload
="trackLoaded()"> | |
74 </video> | |
75 </body> | |
76 </html> | |
OLD | NEW |