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

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: cleaned up volume / mute hiding logic. 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..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>

Powered by Google App Engine
This is Rietveld 408576698