OLD | NEW |
---|---|
(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> | |
OLD | NEW |