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

Unified Diff: LayoutTests/media/activation-behavior-shadow.html

Issue 829393004: Re-re-enable the activation behavior of media elements (click to play/pause) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Drop the changes to MediaControlOverlayPlayButtonElement and add a test Created 5 years, 11 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
« no previous file with comments | « LayoutTests/media/activation-behavior-fullscreen.html ('k') | Source/core/html/HTMLMediaElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/media/activation-behavior-shadow.html
diff --git a/LayoutTests/media/activation-behavior-shadow.html b/LayoutTests/media/activation-behavior-shadow.html
new file mode 100644
index 0000000000000000000000000000000000000000..4e9941a788375acaad2fe963c7250c1e6710af24
--- /dev/null
+++ b/LayoutTests/media/activation-behavior-shadow.html
@@ -0,0 +1,50 @@
+<!doctype html>
+<title>activation behavior with shadow children</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script>
+internals.settings.setMediaControlsOverlayPlayButtonEnabled(true);
+</script>
+<video controls></video>
+<script>
+function shouldTogglePlayState(shadowChild)
+{
+ var id = internals.shadowPseudoId(shadowChild);
+ if (id == "-webkit-media-controls")
+ return true;
+ if (id == "-webkit-media-controls-play-button")
+ return true;
+ if (id == "-webkit-media-controls-overlay-play-button")
+ return true;
+ if (id == "-webkit-media-controls-panel")
+ return false;
+ return shouldTogglePlayState(shadowChild.parentNode);
+}
+
+function shouldClick(shadowChild)
+{
+ var id = internals.shadowPseudoId(shadowChild);
+ // The cast buttons are only visible if there are remote routes. Clicking
+ // when not visible violates sound assumptions made in HTMLMediaElement.
+ if (id == "-internal-media-controls-cast-button")
+ return false;
+ if (id == "-internal-media-controls-overlay-cast-button")
+ return false;
+ return true;
+}
+
+test(function()
+{
+ var v = document.querySelector("video");
+ var shadowChildren = internals.shadowRoot(v).querySelectorAll("*");
+ shadowChildren = Array.prototype.filter.call(shadowChildren, shouldClick);
+ shadowChildren.forEach(function(shadowChild)
+ {
+ v.pause();
+ shadowChild.click();
+ assert_equals(v.paused, !shouldTogglePlayState(shadowChild),
+ "paused state after click element with pseudo id '"
+ + internals.shadowPseudoId(shadowChild) + "'");
+ });
+});
+</script>
« no previous file with comments | « LayoutTests/media/activation-behavior-fullscreen.html ('k') | Source/core/html/HTMLMediaElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698