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

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

Issue 2477203002: Media Controls: delegate 'volumechange' and 'focusin' handling to an EventListener. (Closed)
Patch Set: add comment Created 4 years, 1 month 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: third_party/WebKit/LayoutTests/media/video-controls-hidden-audio.html
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-hidden-audio.html b/third_party/WebKit/LayoutTests/media/video-controls-hidden-audio.html
index dcccca0efbfcdaa180266a5819e63fe3334ffbf1..5d023ca201fd405d954f1d1f39fb0baa65a9f08b 100644
--- a/third_party/WebKit/LayoutTests/media/video-controls-hidden-audio.html
+++ b/third_party/WebKit/LayoutTests/media/video-controls-hidden-audio.html
@@ -7,38 +7,46 @@
<video controls></video>
<script>
async_test(function(t) {
- var video = document.querySelector("video");
+ var video = document.querySelector("video");
- video.oncanplaythrough = t.step_func_done(function() {
- // Request non-hidden audio controls.
- internals.settings.setPreferHiddenVolumeControls(false);
- video.muted = false;
- muteButton = mediaControlsButton(video, "mute-button");
- volumeSlider = mediaControlsButton(video, "volume-slider");
+ video.oncanplaythrough = t.step_func(function() {
+ // Request non-hidden audio controls.
+ internals.settings.setPreferHiddenVolumeControls(false);
+ video.muted = false;
+ muteButton = mediaControlsButton(video, "mute-button");
+ volumeSlider = mediaControlsButton(video, "volume-slider");
- // Make sure that both are visible.
- assert_not_equals(getComputedStyle(muteButton).display, "none");
- assert_not_equals(getComputedStyle(volumeSlider).display, "none");
+ // Make sure that both are visible.
+ assert_not_equals(getComputedStyle(muteButton).display, "none");
+ assert_not_equals(getComputedStyle(volumeSlider).display, "none");
- // Switch to muted video. Both should still be visible.
- video.muted = true;
- assert_not_equals(getComputedStyle(muteButton).display, "none");
- assert_not_equals(getComputedStyle(volumeSlider).display, "none");
+ video.onvolumechange = t.step_func(_ => {
+ assert_not_equals(getComputedStyle(muteButton).display, "none");
+ assert_not_equals(getComputedStyle(volumeSlider).display, "none");
- internals.settings.setPreferHiddenVolumeControls(true);
-
- // Switch back to unmuted video.
- video.muted = false;
+ video.onvolumechange = t.step_func(_ => {
assert_not_equals(getComputedStyle(muteButton).display, "none");
assert_equals(getComputedStyle(volumeSlider).display, "none");
+ video.onvolumechange = t.step_func_done(_ => {
+ assert_not_equals(getComputedStyle(muteButton).display, "none");
+ assert_equals(getComputedStyle(volumeSlider).display, "none");
+ });
+
// For muted video, the volume slider will hide but the mute button
// should stay, since we always have it present for media which have audio.
video.muted = true;
- assert_not_equals(getComputedStyle(muteButton).display, "none");
- assert_equals(getComputedStyle(volumeSlider).display, "none");
+ });
+
+ // Switch back to unmuted video and hide volume slider.
+ internals.settings.setPreferHiddenVolumeControls(true);
+ video.muted = false;
});
- video.src = findMediaFile("video", "content/test");
+ // Switch to muted video. Both should still be visible.
+ video.muted = true;
+ });
+
+ video.src = findMediaFile("video", "content/test");
})
</script>

Powered by Google App Engine
This is Rietveld 408576698