Chromium Code Reviews| 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..ef8783c3bd64c0b07d619ff19e472acc5ef1ddbc 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"); |
| + |
| + setPreload("none", "none"); |
| + setPreload("auto", "auto"); |
| + |
| + // set to bogus value, should revert to default value. |
| + video.removeAttribute("preload"); |
| + // Set via DOM |
|
fs
2016/06/19 17:53:01
s/DOM/IDL attribute/
Srirama
2016/06/20 05:31:42
Done.
|
| + video.preload = "bogus"; |
| + assert_equals(video.getAttribute("preload"), "bogus"); |
| + assert_equals(video.preload, "auto"); |
| + // - and via attribute. |
|
fs
2016/06/19 17:53:00
s/attribute/content attribute/
Srirama
2016/06/20 05:31:43
Done.
|
| + video.setAttribute("preload", "bogus"); |
| + assert_equals(video.preload, "auto"); |
| + assert_equals(video.getAttribute("preload"), "bogus"); |
| + |
| + setPreload("metadata", "metadata"); |
| + |
| + function setPreload(value, expected) { |
|
fs
2016/06/19 17:53:00
Maybe call this "checkPreloadValue" or so instead?
Srirama
2016/06/20 05:31:42
Done.
|
| + // Set via DOM |
|
fs
2016/06/19 17:53:01
As above
Srirama
2016/06/20 05:31:42
Done.
|
| + video.removeAttribute("preload"); |
| + video.preload = value; |
| + assert_equals(video.getAttribute("preload"), expected); |
| + assert_equals(video.preload, expected); |
| + // - and via attribute. |
|
fs
2016/06/19 17:53:01
Ditto
Srirama
2016/06/20 05:31:43
Done.
|
| + video.removeAttribute("preload"); |
| + video.setAttribute("preload", value); |
| + assert_equals(video.preload, expected); |
| + assert_equals(video.getAttribute("preload"), expected); |
| + } |
| +}); |
| +</script> |