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>
7 video
.src
= findMediaFile("video", "content/test");
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
38 run("video.muted = true");
39 testExpected("getComputedStyle(muteButton).display", "none", '!=');
40 testExpected("getComputedStyle(volumeSlider).display", "none", '==');