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

Unified Diff: third_party/WebKit/LayoutTests/media/video-dom-preload.html

Issue 2079203002: Convert video-dom* tests to testharness.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nits Created 4 years, 6 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-dom-preload.html
diff --git a/third_party/WebKit/LayoutTests/media/video-dom-preload.html b/third_party/WebKit/LayoutTests/media/video-dom-preload.html
index 08385d457fc8f73832d293563cfd21ffa235908c..bc899787a0740c88bf4e4407d1c78a788ffe50c4 100644
--- a/third_party/WebKit/LayoutTests/media/video-dom-preload.html
+++ b/third_party/WebKit/LayoutTests/media/video-dom-preload.html
@@ -1,68 +1,47 @@
-<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></script>
- <script>
- function setPreload(value, expected)
- {
- consoleWrite("- set via DOM");
- run("video.removeAttribute('preload')");
- run("video.preload = '" + value + "'");
- testExpected("video.getAttribute('preload')", expected);
- testExpected("video.preload", expected);
- consoleWrite("- and via attribute");
- run("video.removeAttribute('preload')");
- run("video.setAttribute('preload', '" + value + "')");
- testExpected("video.preload", expected);
- testExpected("video.getAttribute('preload')", expected);
- consoleWrite("");
-
- }
-
- function test()
- {
- findMediaElement();
- consoleWrite("");
-
- consoleWrite("++ Test default attribute value");
- testExpected("video.preload", "auto");
- testExpected("video.getAttribute('preload')", null);
- consoleWrite("");
-
- consoleWrite("++ Remove attribute, should revert to default");
- run("video.removeAttribute('preload')");
- testExpected("video.preload", "auto");
- consoleWrite("");
-
- consoleWrite("++ Set to 'none'");
- setPreload("none", "none");
-
- consoleWrite("++ Set to 'auto'");
- setPreload("auto", "auto");
-
- consoleWrite("++ set to bogus value, should revert to default value");
- run("video.removeAttribute('preload')");
- consoleWrite("- set via DOM");
- run("video.preload = 'bogus'");
- testExpected("video.getAttribute('preload')", "bogus");
- testExpected("video.preload", "auto");
- consoleWrite("- and via attribute");
- run("video.setAttribute('preload', 'bogus')");
- testExpected("video.preload", "auto");
- testExpected("video.getAttribute('preload')", "bogus");
- consoleWrite("");
-
- consoleWrite("++ Set to 'metadata'");
- setPreload("metadata", "metadata");
-
- endTest();
- }
- </script>
-
- </head>
-
- <body onload="test()">
- <video controls></video>
- </body>
-</html>
+<!DOCTYPE html>
+<title>Test media "autoplay" attribute set via DOM.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<video></video>
+<script>
+test(function() {
+ var video = document.querySelector("video");
+
+ // Test default attribute value.
+ assert_equals(video.preload, "auto");
+ assert_equals(video.getAttribute("preload"), null);
+
+ // Remove attribute, should revert to default.
+ video.removeAttribute("preload");
+ assert_equals(video.preload, "auto");
+
+ checkPreloadValue("none", "none");
+ checkPreloadValue("auto", "auto");
+
+ // set to bogus value, should revert to default value.
+ video.removeAttribute("preload");
+ // Set via IDL attribute
+ video.preload = "bogus";
+ assert_equals(video.getAttribute("preload"), "bogus");
+ assert_equals(video.preload, "auto");
+ // - and via content attribute.
+ video.setAttribute("preload", "bogus");
+ assert_equals(video.preload, "auto");
+ assert_equals(video.getAttribute("preload"), "bogus");
+
+ checkPreloadValue("metadata", "metadata");
+
+ function checkPreloadValue(value, expected) {
+ // Set via IDL attribute
+ video.removeAttribute("preload");
+ video.preload = value;
+ assert_equals(video.getAttribute("preload"), expected);
+ assert_equals(video.preload, expected);
+ // - and via content attribute.
+ video.removeAttribute("preload");
+ video.setAttribute("preload", value);
+ assert_equals(video.preload, expected);
+ assert_equals(video.getAttribute("preload"), expected);
+ }
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698