| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <title>media controls cast button</title> | |
| 3 <script src="../resources/testharness.js"></script> | |
| 4 <script src="../resources/testharnessreport.js"></script> | |
| 5 <script src="media-file.js"></script> | |
| 6 <script src="media-controls.js"></script> | |
| 7 <video width="100" height="200" controls></video> | |
| 8 <script> | |
| 9 async_test(function(t) { | |
| 10 var video = document.querySelector("video"); | |
| 11 video.src = findMediaFile("video", "content/test"); | |
| 12 | |
| 13 video.onloadedmetadata = t.step_func(function() { | |
| 14 // Pretend we have a cast device | |
| 15 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); | |
| 16 | |
| 17 // Video should not have a cast button since the video is too narrow | |
| 18 assert_false(isVisible(castButton(video)), "button should not be visible
"); | |
| 19 | |
| 20 // It should not have an overlay cast button too. Instead, the button | |
| 21 // should appear in the overflow menu. Tested somewhere else. | |
| 22 assert_false(isVisible(overlayCastButton(video)), "button should not be
visible"); | |
| 23 | |
| 24 // Increasing video width should show the cast button. | |
| 25 video.width = 500; | |
| 26 testRunner.layoutAndPaintAsyncThen(t.step_func(function() { | |
| 27 assert_true(isVisible(castButton(video)), "button should be visible"
); | |
| 28 | |
| 29 // Decreasing video width should hide the cast button again. | |
| 30 video.width = 100; | |
| 31 testRunner.layoutAndPaintAsyncThen(t.step_func(function() { | |
| 32 assert_false(isVisible(castButton(video)), "button should not be
visible"); | |
| 33 | |
| 34 // If the cast device is lost, we still don't show the cast | |
| 35 // button when the video width increases. | |
| 36 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false
); | |
| 37 video.width = 500; | |
| 38 testRunner.layoutAndPaintAsyncThen(t.step_func_done(function() { | |
| 39 assert_false(isVisible(castButton(video)), "button should no
t be visible"); | |
| 40 })); | |
| 41 })); | |
| 42 })); | |
| 43 }); | |
| 44 }); | |
| 45 </script> | |
| OLD | NEW |