OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Tests cue text position 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/tc015-positioning.vtt", testTrack); |
| 8 check_cues_from_track("captions-webvtt/tc015-positioning-ltr.vtt", testTrack); |
5 | 9 |
6 <script src=../media-file.js></script> | 10 check_cues_from_track("captions-webvtt/tc015-positioning-bad.vtt", function(trac
k) { |
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 { position: "auto" }, |
9 <script src=../video-test.js></script> | 13 { position: "auto" }, |
10 <script> | 14 { position: "auto" }, |
| 15 { position: "auto" }, |
| 16 { position: "auto" }, |
| 17 { position: "auto" }, |
| 18 { position: "auto" }, |
| 19 { position: "auto" } |
| 20 ]; |
11 | 21 |
12 var numberOfTrackTests = 3; | 22 assert_cues_match(track.cues, expected); |
| 23 }); |
13 | 24 |
14 function trackLoaded() | 25 function testTrack(track) { |
15 { | 26 var expected = [ |
16 numberOfTracksLoaded++; | 27 { position: 0 }, |
17 if (numberOfTracksLoaded == numberOfTrackTests) { | 28 { position: 50 }, |
18 testTrack(0); | 29 { position: "auto" }, |
19 testTrack(1); | 30 { position: 100 } |
20 testTrackError(2); | 31 ]; |
21 } | |
22 } | |
23 | 32 |
24 function testTrack(i) | 33 assert_cues_match(track.cues, expected); |
25 { | 34 } |
26 findMediaElement(); | 35 </script> |
27 var expected = | |
28 { | |
29 length : 4, | |
30 tests: | |
31 [ | |
32 { | |
33 property : "position", | |
34 values : [0, 50, "auto", 100], | |
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 : 8, | |
49 tests: | |
50 [ | |
51 { | |
52 property : "position", | |
53 values : ["auto", "auto", "auto", "auto", "auto", "a
uto", "auto", "auto"], | |
54 }, | |
55 ], | |
56 }; | |
57 testCues(i, expected); | |
58 | |
59 allTestsEnded(); | |
60 } | |
61 </script> | |
62 </head> | |
63 <body onload="enableAllTextTracks()"> | |
64 <p>Tests cue text position from settings.</p> | |
65 <video> | |
66 <track src="captions-webvtt/tc015-positioning.vtt" onload="trackLoad
ed()"> | |
67 <track src="captions-webvtt/tc015-positioning-ltr.vtt" onload="track
Loaded()"> | |
68 <track src="captions-webvtt/tc015-positioning-bad.vtt" onload="track
Loaded()"> | |
69 </video> | |
70 </body> | |
71 </html> | |
OLD | NEW |