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

Unified Diff: third_party/WebKit/LayoutTests/media/display-overflow-menu.html

Issue 2243473002: Adding overflow menu to media player (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added tests Created 4 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: third_party/WebKit/LayoutTests/media/display-overflow-menu.html
diff --git a/third_party/WebKit/LayoutTests/media/display-overflow-menu.html b/third_party/WebKit/LayoutTests/media/display-overflow-menu.html
new file mode 100644
index 0000000000000000000000000000000000000000..c80f05ba1bb1275d384c57df73a7af8ccaca5198
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/media/display-overflow-menu.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<title>Overflow menu behavior</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>
+<video controls></video>
+<script>
+async_test(function(t) {
+ // We expect the items in the overflow to appear in the following ordering.
+ var overflowButtonsCSS = ["-webkit-media-controls-mute-button",
+ "-internal-media-controls-cast-button",
+ "-webkit-media-controls-toggle-closed-captions-button",
+ "-webkit-media-controls-fullscreen-button"];
+
+ // TODO: Add tests for audio as well.
+ var video = document.querySelector("video");
+ video.src = findMediaFile("video", "content/test");
+ video.setAttribute("width", "60");
+ // Add captions
+ video.addTextTrack("captions");
+ // Pretend we have a cast device
+ internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true);
+
+ video.onloadeddata = t.step_func_done(function() {
+ var menuID = "-internal-overflow-menu-button";
+ var listID = "-internal-media-controls-overflow-menu-list";
+ var overflowMenu = mediaControlsElement(internals.shadowRoot(video).firstChild, menuID);
+ var overflowList = mediaControlsElement(internals.shadowRoot(video).firstChild, listID);
+
+ var children = overflowList.children;
+
+ // The overflow menu should always have the same number of elements.
+ // Their visibility will change over time based on the size of the video.
+ assert_equals(children.length, 4);
+
+ // Ensure that all of the buttons are visible in the right order
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ var innerButton = child.children[0];
+ assert_equals(internals.shadowPseudoId(child), "-internal-media-controls-overflow-menu-list-item");
+ assert_equals(internals.shadowPseudoId(innerButton), overflowButtonsCSS[i]);
+ // Items should be visible
+ assert_true(getComputedStyle(child).display != "none");
+ }
+
+ // Overflow menu button should be visible
+ assert_true(getComputedStyle(overflowMenu).display != "none");
+
+ // Overflow list shouldn't be visible until it's clicked on
+ assert_false(getComputedStyle(overflowList).display != "none");
+
+ // Click on the overflow menu button
+ var coords = elementCoordinates(overflowMenu);
+ eventSender.mouseMoveTo(coords[0], coords[1]);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+
+ // Overflow list should now be visible
+ assert_true(getComputedStyle(overflowList).display != "none");
+
+
+ // Clicking on the buttons should perform their action.
+ // Fullscreen button
+ var coords = elementCoordinates(overflowList.children[3]);
+ eventSender.mouseMoveTo(coords[0], coords[1]);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+
+ video.addEventListener("webkitfullscreenchange", t.step_func_done());
+
+ // Click on the overflow menu button
+ var coords = elementCoordinates(overflowMenu);
+ eventSender.mouseMoveTo(coords[0], coords[1]);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ });
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698