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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-css-property-whitelist.html

Issue 1882583002: Convert track 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/track-css-property-whitelist-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/track/track-css-property-whitelist.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-css-property-whitelist.html b/third_party/WebKit/LayoutTests/media/track/track-css-property-whitelist.html
index db11560e6d46a9c4b3d1798c17319f848c525375..75d711e76e4d3c25b58b747c35cedd32d0785ca6 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-css-property-whitelist.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-css-property-whitelist.html
@@ -1,69 +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 src=../media-controls.js></script>
-
- <style>
- ::cue {word-spacing: 100px;}
- ::cue(c) {padding-left: 10px; color: red;}
- .cue {
- display: inline;
- background-color: green;
- }
- </style>
-
- <script>
-
- var cueNode;
-
- function seeked()
- {
- if (testEnded)
- return;
-
- consoleWrite("<br>");
- consoleWrite("Test that only allowed for the ::cue pseudo-element properties are applied to WebVTT node objects.");
-
- cueNode = textTrackDisplayElement(video, 'cue').firstElementChild;
- testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)");
- testExpected("getComputedStyle(cueNode).padding", "0px");
- testExpected("getComputedStyle(cueNode).wordSpacing", "0px");
- cueNode = cueNode.nextElementSibling;
- testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)");
- testExpected("getComputedStyle(cueNode).padding", "0px");
- testExpected("getComputedStyle(cueNode).wordSpacing", "0px");
- cueNode = cueNode.nextElementSibling;
- testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)");
- testExpected("getComputedStyle(cueNode).padding", "0px");
- testExpected("getComputedStyle(cueNode).wordSpacing", "0px");
-
- consoleWrite("<br>Test that filtering doesn't apply to elements which class equals 'cue' outside WebVTT scope.");
- cueNode = document.getElementsByClassName("cue")[0];
- testExpected("getComputedStyle(cueNode).display", "inline");
- endTest();
- }
-
- function loaded()
- {
- findMediaElement();
- video.src = findMediaFile('video', '../content/test');
- video.id = "testvideo";
- waitForEvent('seeked', seeked);
- waitForEvent('canplaythrough', function() { video.currentTime = 0.1; });
- }
-
- </script>
- </head>
- <body onload="loaded()">
- <video controls >
- <track src="captions-webvtt/whitelist.vtt" kind="captions" default>
- </video>
- <div><div class="cue">This should display inline</div></div>
- </body>
-</html>
+<title>Test that ::cue pseudo-element properties are applied to WebVTT node objects only.</title>
+<script src="../media-file.js"></script>
+<script src="../media-controls.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style>
+::cue { word-spacing: 100px; }
+::cue(c) { padding-left: 10px; color: red; }
+.cue {
+ display: inline;
+ background-color: green;
+}
+</style>
+<video>
+ <track src="captions-webvtt/whitelist.vtt" kind="captions" default>
+</video>
+<div class="cue"></div>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
+ video.src = findMediaFile("video", "../content/test");
+
+ video.onseeked = t.step_func_done(function() {
+ var cueNode = textTrackDisplayElement(video, "cue").firstElementChild;
+ var cueStyle = getComputedStyle(cueNode);
+ assert_equals(cueStyle.color, "rgb(255, 0, 0)");
+ assert_equals(cueStyle.padding, "0px");
+ assert_equals(cueStyle.wordSpacing, "0px");
+
+ cueNode = cueNode.nextElementSibling;
+ cueStyle = getComputedStyle(cueNode);
+ assert_equals(cueStyle.color, "rgb(255, 0, 0)");
+ assert_equals(cueStyle.padding, "0px");
+ assert_equals(cueStyle.wordSpacing, "0px");
+
+ cueNode = cueNode.nextElementSibling;
+ cueStyle = getComputedStyle(cueNode);
+ assert_equals(cueStyle.color, "rgb(255, 0, 0)");
+ assert_equals(cueStyle.padding, "0px");
+ assert_equals(cueStyle.wordSpacing, "0px");
+
+ // Test that filtering doesn't apply to elements with class "cue" outside WebVTT scope.
+ cueNode = document.getElementsByClassName("cue")[0];
+ assert_equals(getComputedStyle(cueNode).display, "inline");
+ });
+
+ video.currentTime = 0.1;
+});
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/track-css-property-whitelist-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698