Index: third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-updates-appropriately.html |
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-updates-appropriately.html b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-updates-appropriately.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..930ca1ea9835fcd27aae23de2d5433632d14ea79 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-updates-appropriately.html |
@@ -0,0 +1,54 @@ |
+<!DOCTYPE html> |
+<title>Overflow menu updates properly.</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="media-controls.js"></script> |
+<script src="media-file.js"></script> |
+<script src="overflow-menu.js"></script> |
+ |
+<!--Padding ensures the overflow menu is visible for the tests. --> |
+<body style="padding-top: 200px; padding-left: 100px"> |
+<video controls></video> |
+<script> |
+async_test(function(t) { |
+ // Set up video |
+ var video = document.querySelector("video"); |
+ video.src = findMediaFile("video", "content/test"); |
+ video.setAttribute("width", "60"); |
+ // Add captions |
+ var trackElement = document.createElement("track"); |
+ video.appendChild(trackElement); |
+ // Pretend we have a cast device |
+ internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); |
+ |
+ video.onloadeddata = t.step_func_done(function() { |
+ var overflowList = getOverflowList(video); |
+ |
+ // Remove cast device and ensure the overflow menu updates as expected |
+ // Cast option in overflow should no longer be visible, but the other |
+ // options should all be. |
+ var buttonsWithoutCast = overflowButtonsCSS; |
+ buttonsWithoutCast[1] = undefined; |
+ internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false); |
+ |
+ var children = overflowList.children; |
+ // Ensure that all of the buttons are visible in the right order |
+ for (var i = 0; i < children.length; i++) { |
+ var child = children[i]; |
+ if (buttonsWithoutCast[i]) { |
+ assert_not_equals(getComputedStyle(child).display, "none"); |
+ } else { |
+ assert_equals(getComputedStyle(child).display, "none"); |
+ } |
+ } |
+ internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); |
+ assert_not_equals(getComputedStyle(children[1]).display, "none"); |
+ |
+ // Removing closed captions hides button in overflow menu |
+ assert_not_equals(getComputedStyle(children[2]).display, "none"); |
+ video.removeChild(trackElement); |
+ assert_equals(getComputedStyle(children[2]).display, "none"); |
+ }); |
+}); |
+</script> |
+</body> |