OLD | NEW |
---|---|
(Empty) | |
1 <!doctype html> | |
2 <html> | |
3 <head> | |
4 <title>media controls cast button</title> | |
5 <script src="../resources/testharness.js"></script> | |
6 <script src="../resources/testharnessreport.js"></script> | |
7 <script src="media-file.js"></script> | |
8 <script src="media-controls.js"></script> | |
9 <script src="video-test.js"></script> | |
10 </head> | |
11 <body> | |
12 <video></video> | |
13 <script> | |
14 findMediaElement(); | |
acolwell GONE FROM CHROMIUM
2014/08/05 19:36:34
ditto. This code needs to be inside a test() call.
aberent
2014/08/22 14:08:33
Done.
| |
15 video.src = findMediaFile("video", "content/test"); | |
16 waitForEventAndEnd("loadedmetadata", function() | |
17 { | |
18 // Should not have a cast button by default | |
19 button = mediaControlsButton(video, "overlay-cast-button"); | |
20 assert_equals(button.style.display, "none", "button should not b e visible with no cast devices"); | |
21 | |
22 // Pretend we have a cast device | |
23 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true) ; | |
24 // Now should have cast button | |
25 assert_false(("display" in button.style) && (button.style.displa y == "none"), "button should exist"); | |
26 dimensions = mediaControlsButtonDimensions(video, "overlay-cast- button"); | |
27 assert_not_equals(dimensions[0], 0, "button should exist"); | |
28 assert_not_equals(dimensions[1], 0, "button should exist"); | |
29 | |
30 // Check position, should be in the top left corner of the video | |
31 rect = button.getBoundingClientRect(); | |
32 videoRect = video.getBoundingClientRect(); | |
33 assert_greater_than_equal(rect.top, videoRect.top, "button shoul d be at top left of video"); | |
34 assert_greater_than_equal(rect.left, videoRect.left, "button sho uld be at top left of video"); | |
35 assert_less_than_equal(rect.bottom, videoRect.top + videoRect.he ight / 2, "button should be at top left of video"); | |
36 assert_less_than_equal(rect.right, videoRect.left + videoRect.wi dth / 2, "button should be at top left of video"); | |
37 | |
38 // Remove cast device - cast button should go away | |
39 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false ); | |
40 assert_equals(button.style.display, "none", "button should not b e visible after cast device goes away"); | |
41 }); | |
42 </script> | |
43 </body> | |
44 </html> | |
OLD | NEW |