Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / video-controls-hidden-audio.html
blobc694a61a97052a93a5e40f9639e088db1366b234
1 <video controls></video>
2 <p>Test that hiding volume / mute buttons works as expected.</p>
3 <script src=media-file.js></script>
4 <script src=video-test.js></script>
5 <script src=media-controls.js></script>
6 <script>
7 video.src = findMediaFile("video", "content/test");
8 run("video.load()");
9 waitForEvent("canplaythrough", function () {
10 // Enable hidden audio preferences to take effect.
11 run("window.internals.setAllowHiddenVolumeControls(video, true)");
12 // Request non-hidden audio controls.
13 run("window.internals.settings.setPreferHiddenVolumeControls(false)");
14 run("video.muted = false");
15 muteButton = mediaControlsButton(video, "mute-button");
16 volumeSlider = mediaControlsButton(video, "volume-slider");
18 // Make sure that both are visible.
19 testExpected("getComputedStyle(muteButton).display", "none", '!=');
20 testExpected("getComputedStyle(volumeSlider).display", "none", '!=');
22 // Switch to muted video. Both should still be visible.
23 run("video.muted = true");
24 testExpected("getComputedStyle(muteButton).display", "none", '!=');
25 testExpected("getComputedStyle(volumeSlider).display", "none", '!=');
27 run("window.internals.settings.setPreferHiddenVolumeControls(true)");
29 // Switch back to unmuted video.
30 run("video.muted = false");
32 testExpected("getComputedStyle(muteButton).display", "none", '!=');
33 testExpected("getComputedStyle(volumeSlider).display", "none", '==');
35 // For muted video, the volume slider will hide but the mute
36 // button should stay, since we always have it present for media
37 // which have audio.
38 run("video.muted = true");
39 testExpected("getComputedStyle(muteButton).display", "none", '!=');
40 testExpected("getComputedStyle(volumeSlider).display", "none", '==');
42 endTest();
43 });
44 </script>