Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Unified Diff: LayoutTests/media/video-controls-hidden-audio.html

Issue 1156993013: New media playback UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: minor decrufting. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698