OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Tests cue alignment from settings.</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 <script> |
| 7 check_cues_from_track("captions-webvtt/tc014-alignment.vtt", testTrack); |
| 8 check_cues_from_track("captions-webvtt/tc014-alignment-ltr.vtt", testTrack); |
5 | 9 |
6 <script src=../media-file.js></script> | 10 check_cues_from_track("captions-webvtt/tc014-alignment-bad.vtt", function(track)
{ |
7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 11 var expected = [ |
8 (Please avoid writing new tests using video-test.js) --> | 12 { align: "middle" }, |
9 <script src=../video-test.js></script> | 13 { align: "middle" }, |
10 <script> | 14 { align: "middle" }, |
| 15 { align: "middle" } |
| 16 ]; |
11 | 17 |
12 numberOfTrackTests = 3; | 18 assert_cues_match(track.cues, expected); |
| 19 }); |
13 | 20 |
14 function trackLoaded() | 21 function testTrack(track) { |
15 { | 22 var expected = [ |
16 numberOfTracksLoaded++; | 23 { align: "start" }, |
17 if (numberOfTracksLoaded == numberOfTrackTests) { | 24 { align: "middle" }, |
18 testTrack(0); | 25 { align: "end" }, |
19 testTrack(1); | 26 { align: "middle" } |
20 testTrackError(2); | 27 ]; |
21 } | |
22 } | |
23 | 28 |
24 function testTrack(i) | 29 assert_cues_match(track.cues, expected); |
25 { | 30 } |
26 findMediaElement(); | 31 </script> |
27 var expected = | |
28 { | |
29 length : 4, | |
30 tests: | |
31 [ | |
32 { | |
33 property : "align", | |
34 values : ["start", "middle", "end", "middle"], | |
35 }, | |
36 ], | |
37 }; | |
38 testCues(i, expected); | |
39 | |
40 allTestsEnded(); | |
41 } | |
42 | |
43 function testTrackError(i) | |
44 { | |
45 findMediaElement(); | |
46 var expected = | |
47 { | |
48 length : 4, | |
49 tests: | |
50 [ | |
51 { | |
52 property : "align", | |
53 values : ["middle", "middle", "middle", "middle"], | |
54 }, | |
55 ], | |
56 }; | |
57 testCues(i, expected); | |
58 | |
59 allTestsEnded(); | |
60 } | |
61 </script> | |
62 </head> | |
63 <body onload="enableAllTextTracks()"> | |
64 <p>Tests cue alignment from settings.</p> | |
65 <video> | |
66 <track src="captions-webvtt/tc014-alignment.vtt" onload="trackLoaded
()"> | |
67 <track src="captions-webvtt/tc014-alignment-ltr.vtt" onload="trackLo
aded()"> | |
68 <track src="captions-webvtt/tc014-alignment-bad.vtt" onload="trackLo
aded()"> | |
69 </video> | |
70 </body> | |
71 </html> | |
OLD | NEW |