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