OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>media controls cast button</title> | 2 <title>media controls cast button</title> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script src="media-file.js"></script> | 5 <script src="media-file.js"></script> |
6 <script src="media-controls.js"></script> | 6 <script src="media-controls.js"></script> |
7 <video controls width="500"></video> | 7 <video controls width="500"></video> |
8 <script> | 8 <script> |
9 async_test(function(t) { | 9 async_test(function(t) { |
10 var video = document.querySelector("video"); | 10 var video = document.querySelector("video"); |
(...skipping 17 matching lines...) Expand all Loading... |
28 // Check its position is to the right of the timeline | 28 // Check its position is to the right of the timeline |
29 // (can't test against volume control or closed caption button, since th
ese don't always exist) | 29 // (can't test against volume control or closed caption button, since th
ese don't always exist) |
30 var x = buttonBoundingRect.left + buttonBoundingRect.width / 2; | 30 var x = buttonBoundingRect.left + buttonBoundingRect.width / 2; |
31 var timelinePosition = mediaControlsButtonCoordinates(video, "timeline")
; | 31 var timelinePosition = mediaControlsButtonCoordinates(video, "timeline")
; |
32 assert_greater_than(x, timelinePosition[0], "button should be to right o
f timeline"); | 32 assert_greater_than(x, timelinePosition[0], "button should be to right o
f timeline"); |
33 | 33 |
34 // Check that we don't have an overlay cast button | 34 // Check that we don't have an overlay cast button |
35 var overlayButton = overlayCastButton(video); | 35 var overlayButton = overlayCastButton(video); |
36 assert_equals(overlayButton.style.display, "none", "Overlay button shoul
d not be visible with controls"); | 36 assert_equals(overlayButton.style.display, "none", "Overlay button shoul
d not be visible with controls"); |
37 | 37 |
38 // And to the left of the fullscreen button | 38 // And to the right of the fullscreen button |
39 var fullscreenPosition = mediaControlsButtonCoordinates(video, "fullscre
en-button"); | 39 var fullscreenPosition = mediaControlsButtonCoordinates(video, "fullscre
en-button"); |
40 assert_less_than(x, fullscreenPosition[0], "button should be to left of
fullscreen button"); | 40 assert_greater_than(x, fullscreenPosition[0], "button should be to right
of fullscreen button"); |
41 | 41 |
42 // Remove cast device - cast button should go away | 42 // Remove cast device - cast button should go away |
43 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false); | 43 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false); |
44 assert_equals(button.style.display, "none", "button should not be visibl
e after cast device goes away"); | 44 assert_equals(button.style.display, "none", "button should not be visibl
e after cast device goes away"); |
45 }); | 45 }); |
46 | 46 |
47 function castButton(element) { | 47 function castButton(element) { |
48 var controlID = "-internal-media-controls-cast-button"; | 48 var controlID = "-internal-media-controls-cast-button"; |
49 var button = mediaControlsElement(internals.shadowRoot(element).firstChi
ld, controlID); | 49 var button = mediaControlsElement(internals.shadowRoot(element).firstChi
ld, controlID); |
50 if (!button) | 50 if (!button) |
51 throw "Failed to find cast button"; | 51 throw "Failed to find cast button"; |
52 return button; | 52 return button; |
53 } | 53 } |
54 | 54 |
55 function overlayCastButton(element) { | 55 function overlayCastButton(element) { |
56 var controlID = "-internal-media-controls-overlay-cast-button"; | 56 var controlID = "-internal-media-controls-overlay-cast-button"; |
57 var button = mediaControlsElement(internals.shadowRoot(element).firstChi
ld, controlID); | 57 var button = mediaControlsElement(internals.shadowRoot(element).firstChi
ld, controlID); |
58 if (!button) | 58 if (!button) |
59 throw "Failed to find cast button"; | 59 throw "Failed to find cast button"; |
60 return button; | 60 return button; |
61 } | 61 } |
62 }); | 62 }); |
63 </script> | 63 </script> |
OLD | NEW |