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

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-controls-toggling.html

Issue 2116013002: Convert video-controls* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comment 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 unified diff | Download patch
OLDNEW
1 <html> 1 <!DOCTYPE html>
2 <head> 2 <title>Test rendering of volume slider of video tag.</title>
3 <title>Test rendering of volume slider of video tag</title> 3 <script src="../resources/testharness.js"></script>
4 <script src=media-file.js></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src=media-controls.js></script> 5 <script src="media-file.js"></script>
6 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 6 <script src="media-controls.js"></script>
7 (Please avoid writing new tests using video-test.js) --> 7 <video controls></video>
8 <script src=video-test.js></script> 8 <script>
9 <script> 9 async_test(function(t) {
10 var video; 10 var panel;
11 var panel; 11 var muteButtonCoordinates;
12 var muteButtonCoordinates; 12 var video = document.querySelector("video");
13 13
14 function init() 14 video.onplay = t.step_func(function() {
15 { 15 panel = mediaControlsButton(video, "panel");
16 video = document.getElementsByTagName("video")[0]; 16 muteButtonCoordinates = mediaControlsButtonCoordinates(video, "mute-butt on");
17 video.src = findMediaFile("video", "content/test"); 17
18 // Move mouse somewhere over the panel.
19 eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[ 1]);
18 20
19 consoleWrite(""); 21 // Test that controls are shown when controls attribute is present.
20 consoleWrite("** Playing the video **"); 22 assert_not_equals(panel.style["display"], "none");
21 run("video.play()"); 23
24 // Move mouse outside the video.
25 eventSender.mouseMoveTo(video.offsetLeft, video.offsetTop + 2 * video.of fsetHeight);
26 setTimeout(continueTest, controlsFadeOutDurationMs);
27 });
28
29 function continueTest() {
30 if (panel.style["display"] != "none") {
31 setTimeout(continueTest, controlsFadeOutDurationMs);
32 return;
22 } 33 }
23 34
24 function test() 35 // Remove controls attribute.
25 { 36 video.removeAttribute("controls");
26 panel = mediaControlsButton(video, "panel");
27 37
28 if (window.eventSender) { 38 // Move mouse back over the panel.
29 try { 39 eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[ 1]);
30 muteButtonCoordinates = mediaControlsButtonCoordinates(video , "mute-button");
31 } catch (exception) {
32 testRunner.notifyDone();
33 return;
34 }
35 40
36 consoleWrite(""); 41 // Video controls should not be shown.
37 consoleWrite("** Move mouse somewhere over the panel **"); 42 assert_equals(panel.style["display"], "none");
38 run("eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButto nCoordinates[1])"); 43 t.done();
39 } 44 }
40 45
41 consoleWrite(""); 46 video.src = findMediaFile("video", "content/test");
42 consoleWrite("** Test that controls are shown when controls attribut e is present **"); 47 video.play();
43 testExpected("panel.style['display']", 'none', "!="); 48 });
44 49 </script>
45 if (window.eventSender) {
46 consoleWrite("");
47 consoleWrite("** Move mouse outside the video **");
48 run("eventSender.mouseMoveTo(video.offsetLeft, video.offsetTop + 2 * video.offsetHeight)");
49 }
50
51 setTimeout(continueTest, controlsFadeOutDurationMs);
52 }
53
54 function continueTest()
55 {
56 if (panel.style['display'] != 'none') {
57 setTimeout(continueTest, controlsFadeOutDurationMs);
58 return;
59 }
60
61 consoleWrite("");
62 consoleWrite("** The controls should have the display property set t o none");
63 testExpected("panel.style['display']", 'none', "==");
64
65 consoleWrite("");
66 consoleWrite("** Remove controls attribute**");
67 run("video.removeAttribute('controls')");
68
69 consoleWrite("");
70 consoleWrite("** Move mouse back over the panel **");
71 run("eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoo rdinates[1])");
72
73 consoleWrite("");
74 consoleWrite("** Video controls should not be shown **");
75 testExpected("panel.style['display']", 'none', "==");
76
77 consoleWrite("");
78
79 endTest();
80 }
81
82 </script>
83 </head>
84 <body onload="init()">
85 Tests that showing / hiding video controls uses the sets the display:none pr operty<br>
86 <video onplay="test()" controls></video>
87 </body>
88 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698