Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / video-controls-toggling.html
blob644570bc5411c8f3afe1ccced121656fb9a47712
1 <html>
2 <head>
3 <title>Test rendering of volume slider of video tag</title>
4 <script src=media-file.js></script>
5 <script src=media-controls.js></script>
6 <script src=video-test.js></script>
7 <script>
8 var video;
9 var panel;
10 var muteButtonCoordinates;
12 function init()
14 video = document.getElementsByTagName("video")[0];
15 video.src = findMediaFile("video", "content/test");
17 consoleWrite("");
18 consoleWrite("** Playing the video **");
19 run("video.play()");
22 function test()
24 panel = mediaControlsButton(video, "panel");
26 if (window.eventSender) {
27 try {
28 muteButtonCoordinates = mediaControlsButtonCoordinates(video, "mute-button");
29 } catch (exception) {
30 testRunner.notifyDone();
31 return;
34 consoleWrite("");
35 consoleWrite("** Move mouse somewhere over the panel **");
36 run("eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[1])");
39 consoleWrite("");
40 consoleWrite("** Test that controls are shown when controls attribute is present **");
41 testExpected("panel.style['display']", 'none', "!=");
43 if (window.eventSender) {
44 consoleWrite("");
45 consoleWrite("** Move mouse outside the video **");
46 run("eventSender.mouseMoveTo(video.offsetLeft, video.offsetTop + 2 * video.offsetHeight)");
49 setTimeout(continueTest, controlsFadeOutDurationMs);
52 function continueTest()
54 if (panel.style['display'] != 'none') {
55 setTimeout(continueTest, controlsFadeOutDurationMs);
56 return;
59 consoleWrite("");
60 consoleWrite("** The controls should have the display property set to none");
61 testExpected("panel.style['display']", 'none', "==");
63 consoleWrite("");
64 consoleWrite("** Remove controls attribute**");
65 run("video.removeAttribute('controls')");
67 consoleWrite("");
68 consoleWrite("** Move mouse back over the panel **");
69 run("eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[1])");
71 consoleWrite("");
72 consoleWrite("** Video controls should not be shown **");
73 testExpected("panel.style['display']", 'none', "==");
75 consoleWrite("");
77 endTest();
80 </script>
81 </head>
82 <body onload="init()">
83 Tests that showing / hiding video controls uses the sets the display:none property<br>
84 <video onplay="test()" controls></video>
85 </body>
86 </html>