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

Unified Diff: third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow.html

Issue 1856383002: Convert css cue track 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, 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
Index: third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow.html
diff --git a/third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow.html b/third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow.html
index 5d82bd5d118fa0633f4ebb646e91956c6b244684..959d2f9fbd176707b4fb1a144ccef8eef3743a4a 100644
--- a/third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow.html
+++ b/third_party/WebKit/LayoutTests/media/track/css-cue-for-video-in-shadow.html
@@ -1,53 +1,33 @@
<!DOCTYPE html>
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
mlamouri (slow - plz ping) 2016/04/06 09:22:58 Why are you removing all that? Having <html>, <hea
Srirama 2016/04/06 10:21:23 Even this was suggested by philipj and as per codi
+<title>Test that the cue is not styled when video is in a shadow tree and style is in a document.</title>
<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>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<style>
video::cue(.red, .red2) { color:red }
video::cue(.green) { color:green }
</style>
+<div id='host'>
+</div>
<script>
-var cueNode;
-var seekedCount = 0;
-var step = 0.4;
-var initialTime = 0.6;
-var endTime = 3.0
-
-function seeked()
-{
- if (testEnded)
- return;
-
- cueNode = textTrackDisplayElement(video, 'cue').firstElementChild;
- testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)", "!=");
- cueNode = cueNode.nextElementSibling;
- testExpected("getComputedStyle(cueNode).color", "rgb(0, 128, 0)", "!=");
- cueNode = cueNode.nextElementSibling;
- testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)", "!=");
- endTest();
-}
-
-function loaded()
-{
- consoleWrite("Test that the cue is not styled when video is in a shadow tree and style is in a document.");
+async_test(function(t) {
var host = document.getElementById('host');
var shadowRoot = host.createShadowRoot();
shadowRoot.innerHTML = '<video controls ><track src="captions-webvtt/styling-lifetime.vtt" kind="captions" default></video>';
- video = shadowRoot.querySelector('video');
+ var video = shadowRoot.querySelector('video');
video.src = findMediaFile('video', '../content/test');
video.id = "testvideo";
- waitForEvent('seeked', seeked);
- waitForEventOnce('canplaythrough', function() { video.currentTime = initialTime; });
-}
+ video.onseeked = t.step_func_done(function(t) {
mlamouri (slow - plz ping) 2016/04/06 09:22:58 I would prefer step_func() and call t.done() insid
Srirama 2016/04/06 10:21:23 Hmm, philip suggested me to use step_func_done and
philipj_slow 2016/04/06 12:12:55 Yep, but I'm probably unusually devoted to minimal
mlamouri (slow - plz ping) 2016/04/07 13:37:17 Sure.
+ var cueNode = textTrackDisplayElement(video, 'cue').firstElementChild;
+ assert_not_equals(getComputedStyle(cueNode).color, "rgb(255, 0, 0)");
philipj_slow 2016/04/06 12:17:46 Hmm, the test was already like this, but this look
Srirama 2016/04/07 13:46:18 Done.
+ cueNode = cueNode.nextElementSibling;
+ assert_not_equals(getComputedStyle(cueNode).color, "rgb(0, 128, 0)");
+ cueNode = cueNode.nextElementSibling;
+ assert_not_equals(getComputedStyle(cueNode).color, "rgb(255, 0, 0)");
+ });
+ video.oncanplaythrough = t.step_func(function(t) {
philipj_slow 2016/04/06 12:17:46 I think you can not wait for canplaythrough and ju
Srirama 2016/04/07 13:46:18 Done.
+ video.currentTime = 0.6;
+ });
+});
mlamouri (slow - plz ping) 2016/04/06 09:22:58 The test name goes here, not in <title>. ie. "Test
Srirama 2016/04/06 10:21:24 Both are same, and having title instead of descrip
philipj_slow 2016/04/06 12:12:55 Right, when there's just a single test per file, I
mlamouri (slow - plz ping) 2016/04/07 13:37:17 What happens if the test fails? ie. what is printe
philipj_slow 2016/04/07 13:40:32 It's the same as if the title is given as an argum
Srirama 2016/04/07 13:46:18 yes, this is the sample output for your reference.
</script>
-</head>
-<body onload="loaded()">
-<div id='host'>
-</div>
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698