 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/vtt-region-dom-layout.html | 
| diff --git a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-dom-layout.html b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-dom-layout.html | 
| index 91a3070d2c4336b660f0e3fdad735579632a8134..fd263cf35be2f48522f08aa69b77af98592614f4 100644 | 
| --- a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-dom-layout.html | 
| +++ b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-dom-layout.html | 
| @@ -1,66 +1,36 @@ | 
| <!DOCTYPE html> | 
| -<html> | 
| - <head> | 
| - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 
| - | 
| - <script src=../../media-controls.js></script> | 
| - <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 testTrack; | 
| - var region; | 
| - var container; | 
| - | 
| - function testRegionsDisplay() | 
| - { | 
| - testTrack = video.textTracks[0]; | 
| - | 
| - consoleWrite("** The text track has only one region **"); | 
| - testExpected("testTrack.regions.length", 1); | 
| - | 
| - try { | 
| - region = textTrackDisplayElement(video, 'region'); | 
| - container = textTrackDisplayElement(video, 'region-container'); | 
| - } catch(e) { | 
| - consoleWrite(e); | 
| - } | 
| - | 
| - consoleWrite("<br>** Inspecting the default DOM layout used for regions display **"); | 
| - | 
| - consoleWrite("<br>** Only one region should be displayed **"); | 
| - testExpected("region.children.length", 1); | 
| - | 
| - consoleWrite("<br>** The child of the region should be the container **"); | 
| - testExpected("region.children[0] == container", true); | 
| - | 
| - consoleWrite("<br>** Default pseudo IDs should be set properly"); | 
| - testExpected("internals.shadowPseudoId(region)", "-webkit-media-text-track-region"); | 
| - testExpected("internals.shadowPseudoId(container)", "-webkit-media-text-track-region-container"); | 
| - | 
| - endTest(); | 
| - } | 
| - | 
| - function startTest() | 
| - { | 
| - if (!window.VTTRegion) { | 
| - failTest(); | 
| - return; | 
| - } | 
| - | 
| - findMediaElement(); | 
| - | 
| - video.src = findMediaFile('video', '../../content/test'); | 
| - waitForEvent('canplaythrough', testRegionsDisplay); | 
| - } | 
| - | 
| - </script> | 
| - </head> | 
| - <body> | 
| - <p>Tests default DOM layout structure for a VTTRegion.</p> | 
| - <video controls> | 
| - <track src="../captions-webvtt/captions-regions.vtt" kind="captions" default onload="startTest()"> | 
| - </video> | 
| - </body> | 
| -</html> | 
| +<title>Tests default DOM layout structure for a VTTRegion.</title> | 
| +<script src="../../media-controls.js"></script> | 
| +<script src="../../media-file.js"></script> | 
| +<script src="../../../resources/testharness.js"></script> | 
| +<script src="../../../resources/testharnessreport.js"></script> | 
| +<script> | 
| +var testTrack; | 
| 
philipj_slow
2016/04/06 12:40:04
Looks like you can move these into the async_test
 
Srirama
2016/04/07 10:40:07
Done.
 | 
| +var region; | 
| +var container; | 
| +var video; | 
| + | 
| +async_test(function() { | 
| + video = document.createElement('video'); | 
| + video.src = findMediaFile('video', '../../content/test'); | 
| + testTrack = document.createElement('track'); | 
| + testTrack.onload = this.step_func(function() { | 
| + video.oncanplaythrough = this.step_func(function() { | 
| + assert_equals(testTrack.track.regions.length, 1); | 
| + | 
| + region = textTrackDisplayElement(video, 'region'); | 
| + container = textTrackDisplayElement(video, 'region-container'); | 
| + | 
| + assert_equals(region.children.length, 1); | 
| + assert_equals(region.children[0], container); | 
| + assert_equals(internals.shadowPseudoId(region), '-webkit-media-text-track-region'); | 
| + assert_equals(internals.shadowPseudoId(container), '-webkit-media-text-track-region-container'); | 
| + this.done(); | 
| + }); | 
| + }); | 
| + testTrack.src = '../captions-webvtt/captions-regions.vtt'; | 
| + testTrack.kind = 'captions'; | 
| + testTrack.default = true; | 
| + video.appendChild(testTrack); | 
| +}); | 
| +</script> |