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

Unified Diff: third_party/WebKit/LayoutTests/media/video-controls-no-scripting.html

Issue 2114393002: Convert video-controls-[mouse, muted, no]* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/video-controls-no-scripting.html
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-no-scripting.html b/third_party/WebKit/LayoutTests/media/video-controls-no-scripting.html
index 68c45b569daa563a8ff646b03e08a64a4b3ad9f3..cc9a75a7452bc277b012150c10bf3bf5f27b5342 100644
--- a/third_party/WebKit/LayoutTests/media/video-controls-no-scripting.html
+++ b/third_party/WebKit/LayoutTests/media/video-controls-no-scripting.html
@@ -1,40 +1,18 @@
-<!doctype html>
-<html>
- <head>
- <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
- (Please avoid writing new tests using video-test.js) -->
- <script src="video-test.js" type="text/javascript"></script>
- <script>
- function setup()
- {
- if (!window.testRunner) {
- consoleWrite("This test only works in DRT.");
- return;
- }
+<!DOCTYPE html>
+<title>Tests that the built-in controls are always enabled when JavaScript is disabled.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<iframe sandbox="allow-same-origin" src="resources/video-controls-no-scripting-iframe.html" style="width: 400px; height: 320px;"></iframe>
+<script>
+async_test(function(t) {
+ var iframe = document.querySelector("iframe");
- video = document.getElementById("fr").contentDocument.querySelector("video");
- testExpected("internals.shadowRoot(video)", null, "!=");
- controls = internals.shadowRoot(video).firstChild.firstChild;
-
- // Don't use "testExpected()" for the control location because not all ports use the same size controls.
- reportExpected((controls.offsetTop + controls.offsetHeight) <= video.offsetHeight, "controls.offsetTop + controls.offsetHeight", "<=", "video.offsetHeight", controls.offsetTop + controls.offsetHeight);
-
- testExpected("getComputedStyle(controls).opacity", 1);
-
- consoleWrite("");
- endTest();
- }
- </script>
- </head>
-
- <body>
-
- <iframe sandbox="allow-same-origin" src="resources/video-controls-no-scripting-iframe.html" id="fr" style="width: 400px; height: 320px; border: 1px solid black;"></iframe>
-
- <p>Tests that the built-in controls are always enabled when JavaScript is disabled.</p>
- <pre id="console"></pre>
- <script>
- document.getElementById("fr").onload = setup;
- </script>
- </body>
-</html>
+ iframe.onload = t.step_func_done(function() {
+ var video = iframe.contentDocument.querySelector("video");
+ assert_not_equals(internals.shadowRoot(video), null);
+ var controls = internals.shadowRoot(video).firstChild.firstChild;
+ assert_less_than_equal((controls.offsetTop + controls.offsetHeight), video.offsetHeight);
+ assert_equals(getComputedStyle(controls).opacity, "1");
+ });
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698