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..48785f20b29d6b8ecd109e472ecf21d2681e3256 |
--- /dev/null |
+++ b/LayoutTests/media/controls-cast-button.html |
@@ -0,0 +1,56 @@ |
+<!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> |
+ async_test(function(t) |
+ { |
+ findMediaElement(); |
+ video.src = findMediaFile("video", "content/test"); |
+ mediaElement.addEventListener("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"); |
+ t.done(); |
+ }); |
+ }); |
+ </script> |
+ </body> |
+</html> |
+ |