| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <title>media controls cast button</title> | |
| 3 <script src="../resources/testharness.js"></script> | |
| 4 <script src="../resources/testharnessreport.js"></script> | |
| 5 <script src="media-file.js"></script> | |
| 6 <script src="media-controls.js"></script> | |
| 7 <video></video> | |
| 8 <script> | |
| 9 async_test(function(t) { | |
| 10 var video = document.querySelector("video"); | |
| 11 video.src = findMediaFile("video", "content/test"); | |
| 12 | |
| 13 video.onloadedmetadata = t.step_func_done(function() { | |
| 14 // Should not have a cast button by default | |
| 15 var button = overlayCastButton(video); | |
| 16 assert_equals(button.style.display, "none", "button should not be visibl
e with no cast devices"); | |
| 17 | |
| 18 // Pretend we have a cast device | |
| 19 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); | |
| 20 // Now should have cast button | |
| 21 assert_false(("display" in button.style) && (button.style.display == "no
ne"), "button should exist"); | |
| 22 var rect = button.getBoundingClientRect(); | |
| 23 assert_not_equals(rect.width, 0, "button should exist"); | |
| 24 assert_not_equals(rect.height, 0, "button should exist"); | |
| 25 | |
| 26 // Check position, should be in the top left corner of the video | |
| 27 var videoRect = video.getBoundingClientRect(); | |
| 28 assert_greater_than_equal(rect.top, videoRect.top, "button should be at
top left of video"); | |
| 29 assert_greater_than_equal(rect.left, videoRect.left, "button should be a
t top left of video"); | |
| 30 assert_less_than_equal(rect.bottom, videoRect.top + videoRect.height / 2
, "button should be at top left of video"); | |
| 31 assert_less_than_equal(rect.right, videoRect.left + videoRect.width / 2,
"button should be at top left of video"); | |
| 32 | |
| 33 // Remove cast device - cast button should go away | |
| 34 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false); | |
| 35 assert_equals(button.style.display, "none", "button should not be visibl
e after cast device goes away"); | |
| 36 }); | |
| 37 }); | |
| 38 </script> | |
| OLD | NEW |