| Index: third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-parser.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-parser.html b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-parser.html
|
| index 86c62e5dfa9a81dbba9b6cec7ab258887bb8ecfc..9047e8a1379b16abc1b9c3842ad561f04e8f645b 100644
|
| --- a/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-parser.html
|
| +++ b/third_party/WebKit/LayoutTests/media/track/regions-webvtt/vtt-region-parser.html
|
| @@ -1,68 +1,51 @@
|
| <!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 region;
|
| -
|
| - function startTest()
|
| - {
|
| - if (!window.VTTRegion) {
|
| - failTest();
|
| - return;
|
| - }
|
| -
|
| - findMediaElement();
|
| - testExpected("video.textTracks[0].regions.length", 5);
|
| -
|
| - consoleWrite("");
|
| - region = video.textTracks[0].regions[0];
|
| - testExpected("region.id", "region_without_settings");
|
| -
|
| - consoleWrite("");
|
| - region = video.textTracks[0].regions[1];
|
| - testExpected("region.id", "region_with_all_settings");
|
| - testExpected("region.width", 32);
|
| - testExpected("region.height", 5);
|
| - testExpected("region.regionAnchorX", 41);
|
| - testExpected("region.regionAnchorY", 20);
|
| - testExpected("region.viewportAnchorX", 31);
|
| - testExpected("region.viewportAnchorY", 84);
|
| - testExpected("region.scroll", "up");
|
| -
|
| - consoleWrite("");
|
| - region = video.textTracks[0].regions[2];
|
| - testExpected("region.id", "region_floating_point_anchor");
|
| - testExpected("Math.round(region.regionAnchorX * 1000)", 41133);
|
| - testExpected("Math.round(region.regionAnchorY * 1000)", 20420);
|
| - testExpected("Math.round(region.viewportAnchorX * 1000)", 32330);
|
| - testExpected("Math.round(region.viewportAnchorY * 1000)", 32440);
|
| -
|
| - consoleWrite("");
|
| - region = video.textTracks[0].regions[3];
|
| - testExpected("region.id", "not_unique_id");
|
| - testExpected("region.width", 67);
|
| -
|
| - consoleWrite("");
|
| - region = video.textTracks[0].regions[4];
|
| - testExpected("region.id", "");
|
| -
|
| - consoleWrite("");
|
| - endTest();
|
| - }
|
| -
|
| - </script>
|
| - </head>
|
| - <body>
|
| - <p>Tests proper parsing of various regions present in WebVTT header area.</p>
|
| - <video controls>
|
| - <track src="../captions-webvtt/header-regions.vtt" kind="captions" default onload="startTest()">
|
| - </video>
|
| -
|
| - </body>
|
| -</html>
|
| +<title>Tests proper parsing of various regions present in WebVTT header area.</title>
|
| +<script src="../../../resources/testharness.js"></script>
|
| +<script src="../../../resources/testharnessreport.js"></script>
|
| +<script src="../../media-file.js"></script>
|
| +<script>
|
| +async_test(function(t) {
|
| + assert_not_equals(window.VTTRegion, null);
|
| +
|
| + var video = document.createElement('video');
|
| + video.src = findMediaFile('video', '../../content/test');
|
| + var testTrack = document.createElement('track');
|
| + testTrack.onload = this.step_func(function() {
|
| + var track = testTrack.track;
|
| + assert_equals(track.regions.length, 5);
|
| +
|
| + var region = track.regions[0];
|
| + assert_equals(region.id, 'region_without_settings');
|
| +
|
| + region = track.regions[1];
|
| + assert_equals(region.id, 'region_with_all_settings');
|
| + assert_equals(region.width, 32);
|
| + assert_equals(region.height, 5);
|
| + assert_equals(region.regionAnchorX, 41);
|
| + assert_equals(region.regionAnchorY, 20);
|
| + assert_equals(region.viewportAnchorX, 31);
|
| + assert_equals(region.viewportAnchorY, 84);
|
| + assert_equals(region.scroll, 'up');
|
| +
|
| + region = track.regions[2];
|
| + assert_equals(region.id, 'region_floating_point_anchor');
|
| + assert_equals(Math.round(region.regionAnchorX * 1000), 41133);
|
| + assert_equals(Math.round(region.regionAnchorY * 1000), 20420);
|
| + assert_equals(Math.round(region.viewportAnchorX * 1000), 32330);
|
| + assert_equals(Math.round(region.viewportAnchorY * 1000), 32440);
|
| +
|
| + region = track.regions[3];
|
| + assert_equals(region.id, 'not_unique_id');
|
| + assert_equals(region.width, 67);
|
| +
|
| + region = track.regions[4];
|
| + assert_equals(region.id, "");
|
| +
|
| + this.done();
|
| + });
|
| + testTrack.src= '../captions-webvtt/header-regions.vtt';
|
| + testTrack.kind = 'captions';
|
| + testTrack.default = true;
|
| + video.appendChild(testTrack);
|
| +});
|
| +</script>
|
|
|