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