Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / video-controls-visible-exiting-fullscreen.html
blobdc7f19b8791e8ad9e74019c993b258da9ccdc451
1 <html>
2 <head>
3 <title>Test rendering of video control after exiting fullscreen</title>
4 <script src=media-file.js></script>
5 <script src=media-controls.js></script>
6 <script src=video-test.js></script>
7 <script src=../fullscreen/full-screen-test.js></script>
8 <script>
9 var panel;
10 var playButtonCoordinates;
11 var count = 0;
13 function init()
15 findMediaElement();
16 waitForEvent(video, 'canplaythrough', oncanplaythrough);
17 video.src = findMediaFile('video', 'content/test');
20 function oncanplaythrough()
22 waitForEvent(video, 'webkitfullscreenchange', onfullscreenchange);
24 panel = mediaControlsButton(video, "panel");
25 if (window.eventSender) {
26 try {
27 playButtonCoordinates = mediaControlsButtonCoordinates(video, "play-button");
28 } catch (exception) {
29 testRunner.notifyDone();
30 return;
32 var x = playButtonCoordinates[0];
33 var y = playButtonCoordinates[1];
35 consoleWrite("** Move mouse to the play button and start playing the video **");
36 eventSender.mouseMoveTo(x, y);
37 eventSender.mouseDown();
38 eventSender.mouseUp();
39 consoleWrite("");
42 consoleWrite("** Test that controls are shown when controls attribute is present **");
43 var opacity = getComputedStyle(panel).opacity;
44 if (opacity < 1)
45 failTest("Media control is not opaque.");
46 else
47 runWithKeyDown(function(){ video.webkitRequestFullscreen(); });
50 function onfullscreenchange()
52 switch (count) {
53 case 0:
54 runAfterHideMediaControlsTimerFired(continueTest, video);
55 break;
56 case 1:
57 consoleWrite("");
58 consoleWrite("** The controls should be shown after exiting the fullscreen");
59 var opacity = getComputedStyle(panel).opacity;
60 if (opacity < 1)
61 failTest("Media control is not opaque.");
62 else
63 endTest();
65 count++;
68 function continueTest()
70 consoleWrite("");
71 run("document.webkitExitFullscreen()");
74 </script>
75 </head>
76 <body onload="init()">
77 Tests that video controls are shwon after exiting fullscreen<br>
78 <video controls></video>
79 </body>
80 </html>