 Chromium Code Reviews
 Chromium Code Reviews 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
    
  
    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| Index: third_party/WebKit/LayoutTests/media/track/regions-webvtt/text-track-cue-region-attribute.html | 
| diff --git a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/text-track-cue-region-attribute.html b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/text-track-cue-region-attribute.html | 
| index 9e5edaea7e2f84f8e23a90ff524c3fbb521e4d90..32b5766d3a5243d5e6cb80d9f8c32b9378caf56e 100644 | 
| --- a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/text-track-cue-region-attribute.html | 
| +++ b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/text-track-cue-region-attribute.html | 
| @@ -1,50 +1,29 @@ | 
| <!DOCTYPE html> | 
| -<html> | 
| - <head> | 
| - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 
| - | 
| - <script src=../../media-file.js></script> | 
| - <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 
| - (Please avoid writing new tests using video-test.js) --> | 
| - <script src=../../video-test.js></script> | 
| - <script> | 
| - var cue; | 
| - | 
| - function startTest() | 
| - { | 
| - if (!window.VTTRegion) { | 
| - failTest(); | 
| - return; | 
| - } | 
| - | 
| - consoleWrite("<br>** Test the setter and getter through the JS API **"); | 
| - cue = new VTTCue(0.0, 1.0, "sample"); | 
| - | 
| - testExpected("cue.regionId", ""); | 
| - cue.regionId = "someId"; | 
| - testExpected("cue.regionId", "someId"); | 
| - | 
| - consoleWrite("<br>** Test parsing a region attribute of a cue **"); | 
| - findMediaElement(); | 
| - | 
| - cue = video.textTracks[0].cues[0]; | 
| - testExpected("cue.regionId", "someregionattributeid"); | 
| - | 
| - consoleWrite("<br>** Test that region attribute is ignored if either line position or cue size are specified or writing direction is not horizontal **"); | 
| - for (i = 1; i < 4; ++i) { | 
| - cue = video.textTracks[0].cues[i]; | 
| - testExpected("cue.regionId", ""); | 
| - } | 
| - | 
| - consoleWrite(""); | 
| - endTest(); | 
| - } | 
| - </script> | 
| - </head> | 
| - <body> | 
| - <p>Tests the regionId attribute of a cue.</p> | 
| - <video controls> | 
| - <track src="../captions-webvtt/header-regions.vtt" kind="captions" default onload="startTest()"> | 
| - </video> | 
| - </body> | 
| -</html> | 
| +<title>Tests the regionId attribute of a cue.</title> | 
| +<script src="../../../resources/testharness.js"></script> | 
| +<script src="../../../resources/testharnessreport.js"></script> | 
| +<script> | 
| +async_test(function(t) { | 
| + 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.
 | 
| + | 
| + assert_equals(cue.regionId, ""); | 
| + cue.regionId = "someId"; | 
| + assert_equals(cue.regionId, "someId"); | 
| + | 
| + 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.
 | 
| + var track = document.createElement('track'); | 
| + 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.
 | 
| + cue = track.track.cues[0]; | 
| + assert_equals(cue.regionId, "someregionattributeid"); | 
| + | 
| + for (i = 1; i < 4; ++i) { | 
| + cue = track.track.cues[i]; | 
| + assert_equals(cue.regionId, ""); | 
| + } | 
| + }); | 
| + track.src = '../captions-webvtt/header-regions.vtt'; | 
| + track.kind = 'captions'; | 
| + track.default = true; | 
| + video.appendChild(track); | 
| +}); | 
| +</script> |