OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <title>media controls cast button</title> |
| 5 <script src="../resources/testharness.js"></script> |
| 6 <script src="../resources/testharnessreport.js"></script> |
| 7 <script src="media-file.js"></script> |
| 8 <script src="media-controls.js"></script> |
| 9 <script src="video-test.js"></script> |
| 10 </head> |
| 11 <body> |
| 12 <video controls></video> |
| 13 <script> |
| 14 async_test(function(t) |
| 15 { |
| 16 findMediaElement(); |
| 17 video.src = findMediaFile("video", "content/test"); |
| 18 mediaElement.addEventListener("loadedmetadata", function() |
| 19 { |
| 20 // Should not have a cast button by default |
| 21 button = mediaControlsButton(video, "cast-button"); |
| 22 assert_equals(button.style.display, "none", "button should not b
e visible with no cast devices"); |
| 23 |
| 24 // Pretend we have a cast device |
| 25 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true)
; |
| 26 |
| 27 // Now should have cast button |
| 28 assert_false(("display" in button.style) && (button.style.displa
y == "none"), "button should exist"); |
| 29 dimensions = mediaControlsButtonDimensions(video, "cast-button")
; |
| 30 assert_not_equals(dimensions[0], 0, "button should exist"); |
| 31 assert_not_equals(dimensions[1], 0, "button should exist"); |
| 32 |
| 33 // Check its position is to the right of the timeline |
| 34 // (can't test against volume control or closed caption button,
since these don't always exist) |
| 35 position = mediaControlsButtonCoordinates(video, "cast-button"); |
| 36 timelinePosition = mediaControlsButtonCoordinates(video, "timeli
ne"); |
| 37 assert_greater_than(position[0], timelinePosition[0], "button sh
ould be to right of timeline"); |
| 38 |
| 39 // Check that we don't have an overlay cast button |
| 40 overlayButton = mediaControlsButton(video, "overlay-cast-button"
); |
| 41 assert_equals(overlayButton.style.display, "none", "Overlay butt
on should not be visible with controls"); |
| 42 |
| 43 // And to the left of the fullscreen button |
| 44 fullscreenPosition = mediaControlsButtonCoordinates(video, "full
screen-button"); |
| 45 assert_less_than(position[0], fullscreenPosition[0], "button sho
uld be to left of fullscreen button"); |
| 46 |
| 47 // Remove cast device - cast button should go away |
| 48 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false
); |
| 49 assert_equals(button.style.display, "none", "button should not b
e visible after cast device goes away"); |
| 50 t.done(); |
| 51 }); |
| 52 }); |
| 53 </script> |
| 54 </body> |
| 55 </html> |
| 56 |
OLD | NEW |