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

Unified 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: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
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..2371466b9103bc60f61d70da294cb914eaa8a526 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,32 @@
<!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) {
philipj_slow 2016/04/01 11:07:49 Consistency in style for functions would be nice.
Srirama 2016/04/01 12:14:23 Done.
+ assert_not_equals(window.VTTRegion, null);
philipj_slow 2016/04/01 11:07:49 Not sure why this was here, I guess to bail out ea
Srirama 2016/04/01 12:14:23 Done.
+
+ var cue = new VTTCue(0.0, 1.0, "sample");
+
+ assert_equals(cue.regionId, "");
+ cue.regionId = "someId";
+ assert_equals(cue.regionId, "someId");
+
+ var video = document.createElement('video');
+ var track = document.createElement('track');
+ track.onload = t.step_func(function(){
+ 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, "");
+ }
+ t.done();
philipj_slow 2016/04/01 11:07:49 You can drop this by using step_func_done above.
Srirama 2016/04/01 12:14:23 Done.
+ });
+ track.src= '../captions-webvtt/header-regions.vtt';
philipj_slow 2016/04/01 11:07:49 Missing space before =
Srirama 2016/04/01 12:14:22 Done.
+ track.kind = 'captions';
+ track.default = true;
+ video.appendChild(track);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698