OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>media controls cast button</title> | 4 <title>media controls cast button</title> |
5 <script src="../resources/testharness.js"></script> | 5 <script src="../resources/testharness.js"></script> |
6 <script src="../resources/testharnessreport.js"></script> | 6 <script src="../resources/testharnessreport.js"></script> |
7 <script src="media-file.js"></script> | 7 <script src="media-file.js"></script> |
8 <script src="media-controls.js"></script> | 8 <script src="media-controls.js"></script> |
| 9 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 10 (Please avoid writing new tests using video-test.js) --> |
9 <script src="video-test.js"></script> | 11 <script src="video-test.js"></script> |
10 </head> | 12 </head> |
11 <body> | 13 <body> |
12 <video></video> | 14 <video></video> |
13 <script> | 15 <script> |
14 function overlayCastButton(element) | 16 function overlayCastButton(element) |
15 { | 17 { |
16 var controlID = "-internal-media-controls-overlay-cast-button"; | 18 var controlID = "-internal-media-controls-overlay-cast-button"; |
17 var button = mediaControlsElement(window.internals.shadowRoot(elemen
t).firstChild, controlID); | 19 var button = mediaControlsElement(window.internals.shadowRoot(elemen
t).firstChild, controlID); |
18 if (!button) | 20 if (!button) |
19 throw "Failed to find cast button"; | 21 throw "Failed to find cast button"; |
20 return button; | 22 return button; |
21 } | 23 } |
22 function overlayCastButtonDimensions(element) | 24 function overlayCastButtonDimensions(element) |
23 { | 25 { |
24 var button = overlayCastButton(element); | 26 var button = overlayCastButton(element); |
25 var buttonBoundingRect = button.getBoundingClientRect(); | 27 var buttonBoundingRect = button.getBoundingClientRect(); |
26 return new Array(buttonBoundingRect.width, buttonBoundingRect.height
); | 28 return new Array(buttonBoundingRect.width, buttonBoundingRect.height
); |
27 } | 29 } |
28 async_test(function(t) | 30 async_test(function(t) |
29 { | 31 { |
30 findMediaElement(); | 32 findMediaElement(); |
31 video.src = findMediaFile("video", "content/test"); | 33 video.src = findMediaFile("video", "content/test"); |
32 mediaElement.addEventListener("loadedmetadata", function() | 34 mediaElement.addEventListener("loadedmetadata", function() |
33 { | 35 { |
34 // Should not have a cast button by default | 36 // Should not have a cast button by default |
35 button = overlayCastButton(video); | 37 button = overlayCastButton(video); |
36 assert_equals(button.style.display, "none", "button should not b
e visible with no cast devices"); | 38 assert_equals(button.style.display, "none", "button should not b
e visible with no cast devices"); |
37 | 39 |
38 // Pretend we have a cast device | 40 // Pretend we have a cast device |
(...skipping 14 matching lines...) Expand all Loading... |
53 | 55 |
54 // Remove cast device - cast button should go away | 56 // Remove cast device - cast button should go away |
55 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false
); | 57 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false
); |
56 assert_equals(button.style.display, "none", "button should not b
e visible after cast device goes away"); | 58 assert_equals(button.style.display, "none", "button should not b
e visible after cast device goes away"); |
57 t.done(); | 59 t.done(); |
58 }) | 60 }) |
59 }); | 61 }); |
60 </script> | 62 </script> |
61 </body> | 63 </body> |
62 </html> | 64 </html> |
OLD | NEW |