OLD | NEW |
(Empty) | |
| 1 <video controls></video> |
| 2 <p>Test that hiding volume / mute buttons works as expected.</p> |
| 3 <script src=media-file.js></script> |
| 4 <script src=video-test.js></script> |
| 5 <script src=media-controls.js></script> |
| 6 <script> |
| 7 // Enable hidden audio mode. |
| 8 run("window.internals.settings.setForceAllowHiddenAudioElements(true)"); |
| 9 |
| 10 // Request non-hidden audio |
| 11 run("window.internals.settings.setPreferHiddenVolumeSlider(false)"); |
| 12 run("window.internals.settings.setPreferHiddenMuteButton(false)"); |
| 13 |
| 14 // Starting with unmuted video, |
| 15 video.src = findMediaFile("video", "content/test"); |
| 16 run("video.load()"); |
| 17 waitForEvent("canplaythrough", function () { |
| 18 muteButton = mediaControlsButton(video, "mute-button"); |
| 19 volumeSlider = mediaControlsButton(video, "volume-slider"); |
| 20 |
| 21 // Make sure that both are visible. |
| 22 testExpected("getComputedStyle(muteButton).display", "none", '!='); |
| 23 testExpected("getComputedStyle(volumeSlider).display", "none", '!='); |
| 24 |
| 25 // Switch to muted video. Both should still be visible. |
| 26 run("video.muted = true"); |
| 27 testExpected("getComputedStyle(muteButton).display", "none", '!='); |
| 28 testExpected("getComputedStyle(volumeSlider).display", "none", '!='); |
| 29 |
| 30 // Prefer hidden audio. |
| 31 run("window.internals.settings.setPreferHiddenVolumeSlider(true)"); |
| 32 run("window.internals.settings.setPreferHiddenMuteButton(true)"); |
| 33 |
| 34 // Switch back to unmuted video. Both should now hide. |
| 35 run("video.muted = false"); // So that it notices new settings! |
| 36 testExpected("getComputedStyle(muteButton).display", "none", '=='); |
| 37 testExpected("getComputedStyle(volumeSlider).display", "none", '=='); |
| 38 |
| 39 // For muted video, the volume slider will hide but the mute |
| 40 // button should come back, to let the user unmute. |
| 41 run("video.muted = true"); |
| 42 testExpected("getComputedStyle(muteButton).display", "none", '!='); |
| 43 testExpected("getComputedStyle(volumeSlider).display", "none", '=='); |
| 44 |
| 45 endTest(); |
| 46 }); |
| 47 </script> |
OLD | NEW |