| 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..ef2149157575c62a335ba8bd38cbb1f806475e03
|
| --- /dev/null
|
| +++ b/LayoutTests/media/video-controls-hidden-audio.html
|
| @@ -0,0 +1,50 @@
|
| +<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>
|
| + // Enable hidden audio preferences to take effect.
|
| + run("window.internals.setAllowHiddenAudioElements(video, true)");
|
| +
|
| + // Request non-hidden audio.
|
| + run("window.internals.settings.setPreferHiddenAudioElements(false)");
|
| +
|
| + // Starting with unmuted video,
|
| + video.src = findMediaFile("video", "content/test");
|
| + run("video.load()");
|
| + waitForEvent("canplaythrough", function () {
|
| + 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.setAllowHiddenAudioElements(video, true)");
|
| + testExpected("getComputedStyle(muteButton).display", "none", '!=');
|
| + testExpected("getComputedStyle(volumeSlider).display", "none", '!=');
|
| +
|
| + run("window.internals.settings.setPreferHiddenAudioElements(true)");
|
| +
|
| + // Switch back to unmuted video.
|
| + run("video.muted = false");
|
| + run("window.internals.setAllowHiddenAudioElements(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.setAllowHiddenAudioElements(video, true)");
|
| + testExpected("getComputedStyle(muteButton).display", "none", '!=');
|
| + testExpected("getComputedStyle(volumeSlider).display", "none", '==');
|
| +
|
| + endTest();
|
| + });
|
| +</script>
|
|
|