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..934c5e129e5d8c2b6dbfc39911bca4b743a1e5a0 |
--- /dev/null |
+++ b/LayoutTests/media/video-controls-hidden-audio.html |
@@ -0,0 +1,47 @@ |
+<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 mode. |
+ run("window.internals.settings.setForceAllowHiddenAudioElements(true)"); |
+ |
+ // Request non-hidden audio |
+ run("window.internals.settings.setPreferHiddenVolumeSlider(false)"); |
+ run("window.internals.settings.setPreferHiddenMuteButton(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. |
+ run("video.muted = true"); |
+ testExpected("getComputedStyle(muteButton).display", "none", '!='); |
+ testExpected("getComputedStyle(volumeSlider).display", "none", '!='); |
+ |
+ // Prefer hidden audio. |
+ run("window.internals.settings.setPreferHiddenVolumeSlider(true)"); |
+ run("window.internals.settings.setPreferHiddenMuteButton(true)"); |
+ |
+ // Switch back to unmuted video. Both should now hide. |
+ run("video.muted = false"); // So that it notices new settings! |
+ 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"); |
+ testExpected("getComputedStyle(muteButton).display", "none", '!='); |
+ testExpected("getComputedStyle(volumeSlider).display", "none", '=='); |
+ |
+ endTest(); |
+ }); |
+</script> |