OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Tests that the optional comment area under the "WEBVTT" file header is pr
operly ignored. Also, default settings and styling are currently ignored (treat
ed as faulty cues).</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/tc005-default-styles.vtt"> |
| 8 <track src="captions-webvtt/tc005-metadata-area.vtt"> |
| 9 </video> |
| 10 <script> |
| 11 async_test(function(t) { |
| 12 var video = document.querySelector("video"); |
| 13 |
| 14 var trackElements = document.querySelectorAll("track"); |
| 15 for (var i = 0; i < video.textTracks.length; i++) |
| 16 trackElements[i].onload = t.step_func(trackLoaded); |
5 | 17 |
6 <script src=../media-file.js></script> | 18 enableAllTextTracks(video.textTracks); |
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | |
8 (Please avoid writing new tests using video-test.js) --> | |
9 <script src=../video-test.js></script> | |
10 <script> | |
11 | 19 |
12 numberOfTrackTests = 2; | 20 var numberOfTracksLoaded = 0; |
| 21 function trackLoaded() { |
| 22 numberOfTracksLoaded++; |
| 23 if (numberOfTracksLoaded != 2) |
| 24 return; |
13 | 25 |
14 function trackLoaded() | 26 testTrack(0); |
| 27 testTrack(1); |
| 28 t.done(); |
| 29 } |
| 30 |
| 31 function testTrack(index) { |
| 32 var expected = [ |
15 { | 33 { |
16 numberOfTracksLoaded++; | 34 id : "1", |
17 if (numberOfTracksLoaded == numberOfTrackTests) { | 35 startTime : 0, |
18 testTrack(0); | 36 endTime : 30.5, |
19 testTrack(1); | 37 text : "Bear is Coming!!!!!" |
20 } | 38 }, |
| 39 { |
| 40 id : "2", |
| 41 startTime : 31, |
| 42 endTime : 1200.5, |
| 43 text : "I said Bear is coming!!!!" |
21 } | 44 } |
| 45 ]; |
22 | 46 |
23 function testTrack(i) | 47 assert_cues_equal(video.textTracks[index].cues, expected); |
24 { | 48 } |
25 var expected = | 49 }); |
26 { | 50 </script> |
27 length : 2, | |
28 tests: | |
29 [ | |
30 { | |
31 property : "id", | |
32 values : [1, 2], | |
33 }, | |
34 { | |
35 property : "startTime", | |
36 values : [0.0, 31.0], | |
37 }, | |
38 { | |
39 property : "endTime", | |
40 values : [30.5, 1200.5], | |
41 }, | |
42 { | |
43 property : "text", | |
44 values : ["Bear is Coming!!!!!", "I said Bear is com
ing!!!!"], | |
45 }, | |
46 ], | |
47 }; | |
48 testCues(i, expected); | |
49 | |
50 allTestsEnded(); | |
51 } | |
52 </script> | |
53 </head> | |
54 <body onload="enableAllTextTracks()"> | |
55 <p>Tests that the optional comment area under the "WEBVTT" file header i
s properly ignored. Also, default settings and styling are currently ignored (t
reated as faulty cues).</p> | |
56 <video> | |
57 <track src="captions-webvtt/tc005-default-styles.vtt" onload="trackL
oaded()"> | |
58 <track src="captions-webvtt/tc005-metadata-area.vtt" onload="trackLo
aded()"> | |
59 </video> | |
60 </body> | |
61 </html> | |
OLD | NEW |