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

Side by Side 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 unified diff | Download patch
OLDNEW
1 <html> 1 <!DOCTYPE html>
2 <head> 2 <title>Test media "autoplay" attribute set via DOM.</title>
3 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 3 <script src="../resources/testharness.js"></script>
4 (Please avoid writing new tests using video-test.js) --> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src=video-test.js></script> 5 <video></video>
6 <script> 6 <script>
7 function setPreload(value, expected) 7 test(function() {
8 { 8 var video = document.querySelector("video");
9 consoleWrite("- set via DOM");
10 run("video.removeAttribute('preload')");
11 run("video.preload = '" + value + "'");
12 testExpected("video.getAttribute('preload')", expected);
13 testExpected("video.preload", expected);
14 consoleWrite("- and via attribute");
15 run("video.removeAttribute('preload')");
16 run("video.setAttribute('preload', '" + value + "')");
17 testExpected("video.preload", expected);
18 testExpected("video.getAttribute('preload')", expected);
19 consoleWrite("");
20 9
21 } 10 // Test default attribute value.
11 assert_equals(video.preload, "auto");
12 assert_equals(video.getAttribute("preload"), null);
22 13
23 function test() 14 // Remove attribute, should revert to default.
24 { 15 video.removeAttribute("preload");
25 findMediaElement(); 16 assert_equals(video.preload, "auto");
26 consoleWrite("");
27 17
28 consoleWrite("++ Test default attribute value"); 18 checkPreloadValue("none", "none");
29 testExpected("video.preload", "auto"); 19 checkPreloadValue("auto", "auto");
30 testExpected("video.getAttribute('preload')", null);
31 consoleWrite("");
32 20
33 consoleWrite("++ Remove attribute, should revert to default"); 21 // set to bogus value, should revert to default value.
34 run("video.removeAttribute('preload')"); 22 video.removeAttribute("preload");
35 testExpected("video.preload", "auto"); 23 // Set via IDL attribute
36 consoleWrite(""); 24 video.preload = "bogus";
25 assert_equals(video.getAttribute("preload"), "bogus");
26 assert_equals(video.preload, "auto");
27 // - and via content attribute.
28 video.setAttribute("preload", "bogus");
29 assert_equals(video.preload, "auto");
30 assert_equals(video.getAttribute("preload"), "bogus");
37 31
38 consoleWrite("++ Set to 'none'"); 32 checkPreloadValue("metadata", "metadata");
39 setPreload("none", "none");
40 33
41 consoleWrite("++ Set to 'auto'"); 34 function checkPreloadValue(value, expected) {
42 setPreload("auto", "auto"); 35 // Set via IDL attribute
43 36 video.removeAttribute("preload");
44 consoleWrite("++ set to bogus value, should revert to default va lue"); 37 video.preload = value;
45 run("video.removeAttribute('preload')"); 38 assert_equals(video.getAttribute("preload"), expected);
46 consoleWrite("- set via DOM"); 39 assert_equals(video.preload, expected);
47 run("video.preload = 'bogus'"); 40 // - and via content attribute.
48 testExpected("video.getAttribute('preload')", "bogus"); 41 video.removeAttribute("preload");
49 testExpected("video.preload", "auto"); 42 video.setAttribute("preload", value);
50 consoleWrite("- and via attribute"); 43 assert_equals(video.preload, expected);
51 run("video.setAttribute('preload', 'bogus')"); 44 assert_equals(video.getAttribute("preload"), expected);
52 testExpected("video.preload", "auto"); 45 }
53 testExpected("video.getAttribute('preload')", "bogus"); 46 });
54 consoleWrite(""); 47 </script>
55
56 consoleWrite("++ Set to 'metadata'");
57 setPreload("metadata", "metadata");
58
59 endTest();
60 }
61 </script>
62
63 </head>
64
65 <body onload="test()">
66 <video controls></video>
67 </body>
68 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698