Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Unified Diff: LayoutTests/media/controls-overlay-cast-button.html

Issue 291163004: Implement media cast buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tidy up button name Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/media/controls-overlay-cast-button.html
diff --git a/LayoutTests/media/controls-overlay-cast-button.html b/LayoutTests/media/controls-overlay-cast-button.html
new file mode 100644
index 0000000000000000000000000000000000000000..e343c4f76bb2d0869c3f63d9c4ef2b0b9bb4723e
--- /dev/null
+++ b/LayoutTests/media/controls-overlay-cast-button.html
@@ -0,0 +1,44 @@
+<!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></video>
+ <script>
+ findMediaElement();
acolwell GONE FROM CHROMIUM 2014/08/05 19:36:34 ditto. This code needs to be inside a test() call.
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, "overlay-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, "overlay-cast-button");
+ assert_not_equals(dimensions[0], 0, "button should exist");
+ assert_not_equals(dimensions[1], 0, "button should exist");
+
+ // Check position, should be in the top left corner of the video
+ rect = button.getBoundingClientRect();
+ videoRect = video.getBoundingClientRect();
+ assert_greater_than_equal(rect.top, videoRect.top, "button should be at top left of video");
+ assert_greater_than_equal(rect.left, videoRect.left, "button should be at top left of video");
+ assert_less_than_equal(rect.bottom, videoRect.top + videoRect.height / 2, "button should be at top left of video");
+ assert_less_than_equal(rect.right, videoRect.left + videoRect.width / 2, "button should be at top left of video");
+
+ // 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>

Powered by Google App Engine
This is Rietveld 408576698