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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!doctype html>
2 <title>activation behavior with shadow children</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script>
6 internals.settings.setMediaControlsOverlayPlayButtonEnabled(true);
7 </script>
8 <video controls></video>
9 <script>
10 function shouldTogglePlayState(shadowChild)
11 {
12 var id = internals.shadowPseudoId(shadowChild);
13 if (id == "-webkit-media-controls")
14 return true;
15 if (id == "-webkit-media-controls-play-button")
16 return true;
17 if (id == "-webkit-media-controls-overlay-play-button")
18 return true;
19 if (id == "-webkit-media-controls-panel")
20 return false;
21 return shouldTogglePlayState(shadowChild.parentNode);
22 }
23
24 function shouldClick(shadowChild)
25 {
26 var id = internals.shadowPseudoId(shadowChild);
27 // The cast buttons are only visible if there are remote routes. Clicking
28 // when not visible violates sound assumptions made in HTMLMediaElement.
29 if (id == "-internal-media-controls-cast-button")
30 return false;
31 if (id == "-internal-media-controls-overlay-cast-button")
32 return false;
33 return true;
34 }
35
36 test(function()
37 {
38 var v = document.querySelector("video");
39 var shadowChildren = internals.shadowRoot(v).querySelectorAll("*");
40 shadowChildren = Array.prototype.filter.call(shadowChildren, shouldClick);
41 shadowChildren.forEach(function(shadowChild)
42 {
43 v.pause();
44 shadowChild.click();
45 assert_equals(v.paused, !shouldTogglePlayState(shadowChild),
46 "paused state after click element with pseudo id '"
47 + internals.shadowPseudoId(shadowChild) + "'");
48 });
49 });
50 </script>
OLDNEW
« 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