Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / video-controls-overlay-play-button.html
blob0abfc7c5e82dbb9e6c6a871962a3f17ad6171e23
1 <!doctype html>
2 <html>
3 <head>
4 <title>Test that the overlay play button respects the controls attribute</title>
5 <script src="media-controls.js"></script>
6 <script src="media-file.js"></script>
7 <script src="video-test.js"></script>
8 <script>
9 function start()
11 window.internals.settings.setMediaControlsOverlayPlayButtonEnabled(true);
13 // Add element dynamically, since otherwise the controls are created, but
14 // hidden, before the setting is set, causing the setting to be ignored.
15 addVideoElement();
17 findMediaElement();
19 video.controls = true;
21 button = mediaControlsButton(video, 'overlay-play-button')
22 testExpected('getComputedStyle(button).display', 'flex');
24 waitForEventOnce('loadeddata', loadeddata);
25 video.src = findMediaFile('video', 'content/test');
28 function addVideoElement() {
29 element = document.createElement('video');
30 document.body.appendChild(element);
33 function loadeddata()
35 waitForEventOnce('play', play1);
36 run('video.play()');
39 function play1()
41 testExpected('getComputedStyle(button).display', 'none');
43 waitForEventOnce('pause', pause1);
44 run('video.pause()');
47 function pause1()
49 testExpected('getComputedStyle(button).display', 'flex');
51 video.controls = false;
52 testExpected('getComputedStyle(button).display', 'none');
54 waitForEventOnce('play', play2);
55 run('video.play()');
58 function play2()
60 testExpected('getComputedStyle(button).display', 'none');
62 waitForEventOnce('pause', pause2);
63 run('video.pause()');
66 function pause2()
68 testExpected('getComputedStyle(button).display', 'none');
70 video.controls = true;
71 testExpected('getComputedStyle(button).display', 'flex');
73 endTest();
75 </script>
76 </head>
77 <body onload="start()">
78 <p>Test that the overlay play button respects the controls attribute</p>
79 </body>
80 </html>