Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/regions-webvtt/text-track-cue-region-attribute.html

Issue 1854553003: Convert webvtt regions tests from video-test.js to testharness.js based (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.0, 1.0, "sample");
philipj_slow 2016/04/06 12:40:04 While you're here, you could just use 0 and 1.
Srirama 2016/04/07 10:40:06 Done.
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');
philipj_slow 2016/04/06 12:40:04 And perhaps make use of " and ' consistent in each
Srirama 2016/04/07 10:40:06 Done.
14 { 14 var track = document.createElement('track');
15 if (!window.VTTRegion) { 15 track.onload = t.step_func_done(function(t) {
philipj_slow 2016/04/06 12:40:04 You ought not need the t argument here, even if it
Srirama 2016/04/07 10:40:06 Done.
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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698