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) { |
| 7 var cue = new VTTCue(0, 1, 'sample'); |
5 | 8 |
6 <script src=../../media-file.js></script> | 9 assert_equals(cue.regionId, ''); |
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 10 cue.regionId = 'someId'; |
8 (Please avoid writing new tests using video-test.js) --> | 11 assert_equals(cue.regionId, 'someId'); |
9 <script src=../../video-test.js></script> | |
10 <script> | |
11 var cue; | |
12 | 12 |
13 function startTest() | 13 var video = document.createElement('video'); |
14 { | 14 var track = document.createElement('track'); |
15 if (!window.VTTRegion) { | 15 track.onload = t.step_func_done(function() { |
16 failTest(); | 16 cue = track.track.cues[0]; |
17 return; | 17 assert_equals(cue.regionId, 'someregionattributeid'); |
18 } | |
19 | 18 |
20 consoleWrite("<br>** Test the setter and getter through the JS A
PI **"); | 19 for (i = 1; i < 4; ++i) { |
21 cue = new VTTCue(0.0, 1.0, "sample"); | 20 cue = track.track.cues[i]; |
22 | 21 assert_equals(cue.regionId, ''); |
23 testExpected("cue.regionId", ""); | 22 } |
24 cue.regionId = "someId"; | 23 }); |
25 testExpected("cue.regionId", "someId"); | 24 track.src = '../captions-webvtt/header-regions.vtt'; |
26 | 25 track.kind = 'captions'; |
27 consoleWrite("<br>** Test parsing a region attribute of a cue **
"); | 26 track.default = true; |
28 findMediaElement(); | 27 video.appendChild(track); |
29 | 28 }); |
30 cue = video.textTracks[0].cues[0]; | 29 </script> |
31 testExpected("cue.regionId", "someregionattributeid"); | |
32 | |
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 **"); | |
34 for (i = 1; i < 4; ++i) { | |
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 |