Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: LayoutTests/media/controls-overlay-cast-button.html

Issue 291163004: Implement media cast buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reenable previously crashing tests - now fixed Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 function overlayCastButton(element)
15 {
16 var controlID = "-internal-media-controls-overlay-cast-button";
17 var button = mediaControlsElement(window.internals.shadowRoot(elemen t).firstChild, controlID);
18 if (!button)
19 throw "Failed to find cast button";
20 return button;
21 }
22 function overlayCastButtonDimensions(element)
23 {
24 var button = overlayCastButton(element);
25 var buttonBoundingRect = button.getBoundingClientRect();
26 return new Array(buttonBoundingRect.width, buttonBoundingRect.height );
27 }
28 async_test(function(t)
29 {
30 findMediaElement();
31 video.src = findMediaFile("video", "content/test");
32 mediaElement.addEventListener("loadedmetadata", function()
33 {
34 // Should not have a cast button by default
35 button = overlayCastButton(video);
36 assert_equals(button.style.display, "none", "button should not b e visible with no cast devices");
37
38 // Pretend we have a cast device
39 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true) ;
40 // Now should have cast button
41 assert_false(("display" in button.style) && (button.style.displa y == "none"), "button should exist");
42 dimensions = overlayCastButtonDimensions(video);
43 assert_not_equals(dimensions[0], 0, "button should exist");
44 assert_not_equals(dimensions[1], 0, "button should exist");
45
46 // Check position, should be in the top left corner of the video
47 rect = button.getBoundingClientRect();
48 videoRect = video.getBoundingClientRect();
49 assert_greater_than_equal(rect.top, videoRect.top, "button shoul d be at top left of video");
50 assert_greater_than_equal(rect.left, videoRect.left, "button sho uld be at top left of video");
51 assert_less_than_equal(rect.bottom, videoRect.top + videoRect.he ight / 2, "button should be at top left of video");
52 assert_less_than_equal(rect.right, videoRect.left + videoRect.wi dth / 2, "button should be at top left of video");
53
54 // Remove cast device - cast button should go away
55 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false );
56 assert_equals(button.style.display, "none", "button should not b e visible after cast device goes away");
57 t.done();
58 })
59 });
60 </script>
61 </body>
62 </html>
OLDNEW
« no previous file with comments | « LayoutTests/media/controls-cast-button.html ('k') | LayoutTests/media/media-captions-no-controls.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698