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

Side by Side Diff: LayoutTests/media/activation-behavior-shadow.html

Issue 830183005: Re-enable the activation behavior of media elements (click to play/pause) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: simplify 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 <video controls></video>
6 <script>
7 function shouldTogglePlayState(shadowChild)
8 {
9 var id = internals.shadowPseudoId(shadowChild);
10 if (id == "-webkit-media-controls")
11 return true;
12 if (id == "-webkit-media-controls-play-button")
13 return true;
14 if (id == "-webkit-media-controls-panel")
15 return false;
16 return shouldTogglePlayState(shadowChild.parentNode);
17 }
18
19 function shouldClick(shadowChild)
20 {
21 var id = internals.shadowPseudoId(shadowChild);
22 // The cast buttons are only visible if there are remote routes. Clicking
23 // when not visible violates sound assumptions made in HTMLMediaElement.
aberent 2015/01/08 16:22:36 Should you apply similar logic to the closed capti
philipj_slow 2015/01/08 22:59:56 HTMLMediaElement::setClosedCaptionsVisible has an
24 if (id == "-internal-media-controls-cast-button")
25 return false;
26 if (id == "-internal-media-controls-overlay-cast-button")
27 return false;
28 return true;
29 }
30
31 test(function()
32 {
33 var v = document.querySelector("video");
34 var shadowChildren = internals.shadowRoot(v).querySelectorAll("*");
35 shadowChildren = Array.prototype.filter.call(shadowChildren, shouldClick);
36 shadowChildren.forEach(function(shadowChild)
37 {
38 v.pause();
39 shadowChild.click();
40 assert_equals(v.paused, !shouldTogglePlayState(shadowChild),
41 "paused state after click element with pseudo id '"
42 + internals.shadowPseudoId(shadowChild) + "'");
43 });
44 });
45 </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