OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Tests the regionId attribute of a cue.</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 <script> | |
6 async_test(function (t) { | |
philipj_slow
2016/04/01 11:07:49
Consistency in style for functions would be nice.
Srirama
2016/04/01 12:14:23
Done.
| |
7 assert_not_equals(window.VTTRegion, null); | |
philipj_slow
2016/04/01 11:07:49
Not sure why this was here, I guess to bail out ea
Srirama
2016/04/01 12:14:23
Done.
| |
5 | 8 |
6 <script src=../../media-file.js></script> | 9 var cue = new VTTCue(0.0, 1.0, "sample"); |
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 var cue; | |
12 | 10 |
13 function startTest() | 11 assert_equals(cue.regionId, ""); |
14 { | 12 cue.regionId = "someId"; |
15 if (!window.VTTRegion) { | 13 assert_equals(cue.regionId, "someId"); |
16 failTest(); | |
17 return; | |
18 } | |
19 | 14 |
20 consoleWrite("<br>** Test the setter and getter through the JS A PI **"); | 15 var video = document.createElement('video'); |
21 cue = new VTTCue(0.0, 1.0, "sample"); | 16 var track = document.createElement('track'); |
17 track.onload = t.step_func(function(){ | |
18 cue = track.track.cues[0]; | |
19 assert_equals(cue.regionId, "someregionattributeid"); | |
22 | 20 |
23 testExpected("cue.regionId", ""); | 21 for (i = 1; i < 4; ++i) { |
24 cue.regionId = "someId"; | 22 cue = track.track.cues[i]; |
25 testExpected("cue.regionId", "someId"); | 23 assert_equals(cue.regionId, ""); |
26 | 24 } |
27 consoleWrite("<br>** Test parsing a region attribute of a cue ** "); | 25 t.done(); |
philipj_slow
2016/04/01 11:07:49
You can drop this by using step_func_done above.
Srirama
2016/04/01 12:14:23
Done.
| |
28 findMediaElement(); | 26 }); |
29 | 27 track.src= '../captions-webvtt/header-regions.vtt'; |
philipj_slow
2016/04/01 11:07:49
Missing space before =
Srirama
2016/04/01 12:14:22
Done.
| |
30 cue = video.textTracks[0].cues[0]; | 28 track.kind = 'captions'; |
31 testExpected("cue.regionId", "someregionattributeid"); | 29 track.default = true; |
32 | 30 video.appendChild(track); |
33 consoleWrite("<br>** Test that region attribute is ignored if ei ther line position or cue size are specified or writing direction is not horizon tal **"); | 31 }); |
34 for (i = 1; i < 4; ++i) { | 32 </script> |
35 cue = video.textTracks[0].cues[i]; | |
36 testExpected("cue.regionId", ""); | |
37 } | |
38 | |
39 consoleWrite(""); | |
40 endTest(); | |
41 } | |
42 </script> | |
43 </head> | |
44 <body> | |
45 <p>Tests the regionId attribute of a cue.</p> | |
46 <video controls> | |
47 <track src="../captions-webvtt/header-regions.vtt" kind="captions" d efault onload="startTest()"> | |
48 </video> | |
49 </body> | |
50 </html> | |
OLD | NEW |