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 preferences to take effect. |
| 8 run("window.internals.setAllowHiddenAudioElements(video, true)"); |
| 9 |
| 10 // Request non-hidden audio. |
| 11 run("window.internals.settings.setPreferHiddenAudioElements(false)"); |
| 12 |
| 13 // Starting with unmuted video, |
| 14 video.src = findMediaFile("video", "content/test"); |
| 15 run("video.load()"); |
| 16 waitForEvent("canplaythrough", function () { |
| 17 muteButton = mediaControlsButton(video, "mute-button"); |
| 18 volumeSlider = mediaControlsButton(video, "volume-slider"); |
| 19 |
| 20 // Make sure that both are visible. |
| 21 testExpected("getComputedStyle(muteButton).display", "none", '!='); |
| 22 testExpected("getComputedStyle(volumeSlider).display", "none", '!='); |
| 23 |
| 24 // Switch to muted video. Both should still be visible. We then |
| 25 // remind it that we'd like to allow hidden audio preferences, since |
| 26 // that also resets some state. |
| 27 run("video.muted = true"); |
| 28 run("window.internals.setAllowHiddenAudioElements(video, true)"); |
| 29 testExpected("getComputedStyle(muteButton).display", "none", '!='); |
| 30 testExpected("getComputedStyle(volumeSlider).display", "none", '!='); |
| 31 |
| 32 run("window.internals.settings.setPreferHiddenAudioElements(true)"); |
| 33 |
| 34 // Switch back to unmuted video. |
| 35 run("video.muted = false"); |
| 36 run("window.internals.setAllowHiddenAudioElements(video, true)"); |
| 37 |
| 38 testExpected("getComputedStyle(muteButton).display", "none", '=='); |
| 39 testExpected("getComputedStyle(volumeSlider).display", "none", '=='); |
| 40 |
| 41 // For muted video, the volume slider will hide but the mute |
| 42 // button should come back, to let the user unmute. |
| 43 run("video.muted = true"); |
| 44 run("window.internals.setAllowHiddenAudioElements(video, true)"); |
| 45 testExpected("getComputedStyle(muteButton).display", "none", '!='); |
| 46 testExpected("getComputedStyle(volumeSlider).display", "none", '=='); |
| 47 |
| 48 endTest(); |
| 49 }); |
| 50 </script> |
OLD | NEW |