Chromium Code Reviews| Index: LayoutTests/media/controls-cast-button.html |
| diff --git a/LayoutTests/media/controls-cast-button.html b/LayoutTests/media/controls-cast-button.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9833624d4dea35d1589ade9d16b5ac88dc5342c7 |
| --- /dev/null |
| +++ b/LayoutTests/media/controls-cast-button.html |
| @@ -0,0 +1,52 @@ |
| +<!doctype html> |
| +<html> |
| + <head> |
| + <title>media controls cast button</title> |
| + <script src="../resources/testharness.js"></script> |
| + <script src="../resources/testharnessreport.js"></script> |
| + <script src="media-file.js"></script> |
| + <script src="media-controls.js"></script> |
| + <script src="video-test.js"></script> |
| + </head> |
| + <body> |
| + <video controls></video> |
| + <script> |
| + findMediaElement(); |
|
acolwell GONE FROM CHROMIUM
2014/08/05 19:36:34
I'm pretty sure you need to put this code inside a
aberent
2014/08/22 14:08:33
Done.
|
| + video.src = findMediaFile("video", "content/test"); |
| + waitForEventAndEnd("loadedmetadata", function() |
| + { |
| + // Should not have a cast button by default |
| + button = mediaControlsButton(video, "cast-button"); |
| + assert_equals(button.style.display, "none", "button should not be visible with no cast devices"); |
| + |
| + // Pretend we have a cast device |
| + internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); |
| + |
| + // Now should have cast button |
| + assert_false(("display" in button.style) && (button.style.display == "none"), "button should exist"); |
| + dimensions = mediaControlsButtonDimensions(video, "cast-button"); |
| + assert_not_equals(dimensions[0], 0, "button should exist"); |
| + assert_not_equals(dimensions[1], 0, "button should exist"); |
| + |
| + // Check its position is to the right of the timeline |
| + // (can't test against volume control or closed caption button, since these don't always exist) |
| + position = mediaControlsButtonCoordinates(video, "cast-button"); |
| + timelinePosition = mediaControlsButtonCoordinates(video, "timeline"); |
| + assert_greater_than(position[0], timelinePosition[0], "button should be to right of timeline"); |
| + |
| + // Check that we don't have an overlay cast button |
| + overlayButton = mediaControlsButton(video, "overlay-cast-button"); |
| + assert_equals(overlayButton.style.display, "none", "Overlay button should not be visible with controls"); |
| + |
| + // And to the left of the fullscreen button |
| + fullscreenPosition = mediaControlsButtonCoordinates(video, "fullscreen-button"); |
| + assert_less_than(position[0], fullscreenPosition[0], "button should be to left of fullscreen button"); |
| + |
| + // Remove cast device - cast button should go away |
| + internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false); |
| + assert_equals(button.style.display, "none", "button should not be visible after cast device goes away"); |
| + }); |
| + </script> |
| + </body> |
| +</html> |
| + |