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

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

Issue 2120783002: Convert video-controls* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html>
2 <title>Test that hiding volume / mute button works as expected.</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="media-controls.js"></script>
6 <script src="media-file.js"></script>
1 <video controls></video> 7 <video controls></video>
2 <p>Test that hiding volume / mute buttons works as expected.</p>
3 <script src=media-file.js></script>
4 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
5 (Please avoid writing new tests using video-test.js) -->
6 <script src=video-test.js></script>
7 <script src=media-controls.js></script>
8 <script> 8 <script>
9 video.src = findMediaFile("video", "content/test"); 9 async_test(function(t) {
10 run("video.load()"); 10 var video = document.querySelector("video");
11 waitForEvent("canplaythrough", function () { 11
12 video.oncanplaythrough = t.step_func_done(function() {
12 // Enable hidden audio preferences to take effect. 13 // Enable hidden audio preferences to take effect.
13 run("window.internals.setAllowHiddenVolumeControls(video, true)"); 14 internals.setAllowHiddenVolumeControls(video, true);
14 // Request non-hidden audio controls. 15 // Request non-hidden audio controls.
15 run("window.internals.settings.setPreferHiddenVolumeControls(false)"); 16 internals.settings.setPreferHiddenVolumeControls(false);
16 run("video.muted = false"); 17 video.muted = false;
17 muteButton = mediaControlsButton(video, "mute-button"); 18 muteButton = mediaControlsButton(video, "mute-button");
18 volumeSlider = mediaControlsButton(video, "volume-slider"); 19 volumeSlider = mediaControlsButton(video, "volume-slider");
19 20
20 // Make sure that both are visible. 21 // Make sure that both are visible.
21 testExpected("getComputedStyle(muteButton).display", "none", '!='); 22 assert_not_equals(getComputedStyle(muteButton).display, "none");
22 testExpected("getComputedStyle(volumeSlider).display", "none", '!='); 23 assert_not_equals(getComputedStyle(volumeSlider).display, "none");
23 24
24 // Switch to muted video. Both should still be visible. 25 // Switch to muted video. Both should still be visible.
25 run("video.muted = true"); 26 video.muted = true;
26 testExpected("getComputedStyle(muteButton).display", "none", '!='); 27 assert_not_equals(getComputedStyle(muteButton).display, "none");
27 testExpected("getComputedStyle(volumeSlider).display", "none", '!='); 28 assert_not_equals(getComputedStyle(volumeSlider).display, "none");
28 29
29 run("window.internals.settings.setPreferHiddenVolumeControls(true)"); 30 internals.settings.setPreferHiddenVolumeControls(true);
30 31
31 // Switch back to unmuted video. 32 // Switch back to unmuted video.
32 run("video.muted = false"); 33 video.muted = false;
34 assert_not_equals(getComputedStyle(muteButton).display, "none");
35 assert_equals(getComputedStyle(volumeSlider).display, "none");
33 36
34 testExpected("getComputedStyle(muteButton).display", "none", '!='); 37 // For muted video, the volume slider will hide but the mute button
35 testExpected("getComputedStyle(volumeSlider).display", "none", '=='); 38 // should stay, since we always have it present for media which have aud io.
39 video.muted = true;
40 assert_not_equals(getComputedStyle(muteButton).display, "none");
41 assert_equals(getComputedStyle(volumeSlider).display, "none");
42 });
36 43
37 // For muted video, the volume slider will hide but the mute 44 video.src = findMediaFile("video", "content/test");
38 // button should stay, since we always have it present for media 45 })
39 // which have audio. 46 </script>
40 run("video.muted = true");
41 testExpected("getComputedStyle(muteButton).display", "none", '!=');
42 testExpected("getComputedStyle(volumeSlider).display", "none", '==');
43
44 endTest();
45 });
46 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698