| Index: LayoutTests/media/video-controls-hidden-audio.html
|
| diff --git a/LayoutTests/media/video-controls-hidden-audio.html b/LayoutTests/media/video-controls-hidden-audio.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1eb707f83de764733fd6f70fb1ebeb1c34af475c
|
| --- /dev/null
|
| +++ b/LayoutTests/media/video-controls-hidden-audio.html
|
| @@ -0,0 +1,48 @@
|
| +<video controls></video>
|
| +<p>Test that hiding volume / mute buttons works as expected.</p>
|
| +<script src=media-file.js></script>
|
| +<script src=video-test.js></script>
|
| +<script src=media-controls.js></script>
|
| +<script>
|
| + video.src = findMediaFile("video", "content/test");
|
| + run("video.load()");
|
| + waitForEvent("canplaythrough", function () {
|
| + // Enable hidden audio preferences to take effect.
|
| + run("window.internals.setAllowHiddenVolumeControls(video, true)");
|
| + // Request non-hidden audio.
|
| + run("window.internals.settings.setPreferHiddenVolumeControls(false)");
|
| + run("video.muted = false");
|
| + muteButton = mediaControlsButton(video, "mute-button");
|
| + volumeSlider = mediaControlsButton(video, "volume-slider");
|
| +
|
| + // Make sure that both are visible.
|
| + testExpected("getComputedStyle(muteButton).display", "none", '!=');
|
| + testExpected("getComputedStyle(volumeSlider).display", "none", '!=');
|
| +
|
| + // Switch to muted video. Both should still be visible. We then
|
| + // remind it that we'd like to allow hidden audio preferences, since
|
| + // that also resets some state.
|
| + run("video.muted = true");
|
| + run("window.internals.setAllowHiddenVolumeControls(video, true)");
|
| + testExpected("getComputedStyle(muteButton).display", "none", '!=');
|
| + testExpected("getComputedStyle(volumeSlider).display", "none", '!=');
|
| +
|
| + run("window.internals.settings.setPreferHiddenVolumeControls(true)");
|
| +
|
| + // Switch back to unmuted video.
|
| + run("video.muted = false");
|
| + run("window.internals.setAllowHiddenVolumeControls(video, true)");
|
| +
|
| + testExpected("getComputedStyle(muteButton).display", "none", '==');
|
| + testExpected("getComputedStyle(volumeSlider).display", "none", '==');
|
| +
|
| + // For muted video, the volume slider will hide but the mute
|
| + // button should come back, to let the user unmute.
|
| + run("video.muted = true");
|
| + run("window.internals.setAllowHiddenVolumeControls(video, true)");
|
| + testExpected("getComputedStyle(muteButton).display", "none", '!=');
|
| + testExpected("getComputedStyle(volumeSlider).display", "none", '==');
|
| +
|
| + endTest();
|
| + });
|
| +</script>
|
|
|