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

Side by Side Diff: third_party/WebKit/LayoutTests/media/controls-cast-button-narrow.html

Issue 2378933005: Don't use cast overlay when using default controls. (Closed)
Patch Set: update tests Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/shadow/MediaControls.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 width="100" height="200" controls></video> 7 <video width="100" height="200" controls></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");
11 video.src = findMediaFile("video", "content/test"); 11 video.src = findMediaFile("video", "content/test");
12 12
13 video.onloadedmetadata = t.step_func_done(function() { 13 video.onloadedmetadata = t.step_func_done(function() {
14 // Pretend we have a cast device 14 // Pretend we have a cast device
15 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); 15 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true);
16 16
17 // Video should not have a cast button since the video is too narrow 17 // Video should not have a cast button since the video is too narrow
18 var button = castButton(video); 18 var button = castButton(video);
19 assert_equals(button.style.display, "none", "button should not be visibl e with no cast devices"); 19 assert_equals(button.style.display, "none", "button should not be visibl e");
20 20
21 // It should, however, have an overlay cast button instead 21 // It should not have an overlay cast button too. Instead, the button
22 // should appear in the overflow menu. Tested somewhere else.
22 button = overlayCastButton(video); 23 button = overlayCastButton(video);
23 var rect = button.getBoundingClientRect(); 24 assert_equals(button.style.display, "none", "button should not be visibl e");
24 var videoRect = video.getBoundingClientRect();
25 assert_greater_than_equal(rect.top, videoRect.top, "button should be at top left of video");
26 assert_greater_than_equal(rect.left, videoRect.left, "button should be a t top left of video");
27 assert_less_than_equal(rect.bottom, videoRect.top + videoRect.height / 2 , "button should be at top left of video");
28 assert_less_than_equal(rect.right, videoRect.left + videoRect.width / 2, "button should be at top left of video");
29 }); 25 });
30 26
31 function castButton(element) { 27 function castButton(element) {
32 var controlID = "-internal-media-controls-cast-button"; 28 var controlID = "-internal-media-controls-cast-button";
33 var button = mediaControlsElement(internals.shadowRoot(element).firstChi ld, controlID); 29 var button = mediaControlsElement(internals.shadowRoot(element).firstChi ld, controlID);
34 if (!button) 30 if (!button)
35 throw "Failed to find cast button"; 31 throw "Failed to find cast button";
36 return button; 32 return button;
37 } 33 }
38 34
39 function overlayCastButton(element) { 35 function overlayCastButton(element) {
40 var controlID = "-internal-media-controls-overlay-cast-button"; 36 var controlID = "-internal-media-controls-overlay-cast-button";
41 var button = mediaControlsElement(internals.shadowRoot(element).firstChi ld, controlID); 37 return mediaControlsElement(internals.shadowRoot(element).firstChild, co ntrolID);
38 return button
42 if (!button) 39 if (!button)
43 throw "Failed to find cast button"; 40 throw "Failed to find cast button";
44 return button; 41 return button;
45 } 42 }
46 }); 43 });
47 </script> 44 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/shadow/MediaControls.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698