Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Ensure overflow menu buttons are visible when expected.</title> | 2 <title>Ensure overflow menu buttons are hidden when resizing.</title> |
| 3 <style> | |
| 4 #content { | |
| 5 width: 1000px; | |
| 6 height: 1000px; | |
| 7 background-color: blue; | |
|
mlamouri (slow - plz ping)
2016/10/14 18:35:23
is changing the background-color required?
Zhiqiang Zhang (Slow)
2016/10/17 10:31:45
Done.
| |
| 8 } | |
| 9 </style> | |
| 3 <script src="../resources/testharness.js"></script> | 10 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> | 11 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="media-controls.js"></script> | 12 <script src="media-controls.js"></script> |
| 6 <script src="media-file.js"></script> | 13 <script src="media-file.js"></script> |
| 7 <script src="overflow-menu.js"></script> | 14 <script src="overflow-menu.js"></script> |
| 8 | 15 |
| 9 <!--Padding ensures the overflow menu is visible for the tests. --> | 16 <!--Padding ensures the overflow menu is visible for the tests. --> |
| 10 <body style="padding-top: 200px; padding-left: 100px"> | 17 <body style="padding-top: 200px; padding-left: 100px"> |
| 11 <video controls></video> | 18 <video controls></video> |
| 12 <script> | 19 <script> |
| 13 async_test(function(t) { | 20 async_test(function(t) { |
| 21 if (window.testRunner) | |
| 22 testRunner.useUnfortunateSynchronousResizeMode(); | |
| 23 | |
| 14 // Set up video | 24 // Set up video |
| 15 var video = document.querySelector("video"); | 25 var video = document.querySelector("video"); |
| 16 video.src = findMediaFile("video", "content/test"); | 26 video.src = findMediaFile("video", "content/test"); |
| 17 video.setAttribute("width", "60"); | 27 video.setAttribute("width", "60"); |
| 18 // Add captions | 28 // Add captions |
| 19 var track = video.addTextTrack("captions"); | 29 var track = video.addTextTrack("captions"); |
| 20 // Pretend we have a cast device | 30 // Pretend we have a cast device |
| 21 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); | 31 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); |
| 22 | 32 |
| 23 video.onloadeddata = t.step_func_done(function() { | 33 video.onloadeddata = t.step_func(function() { |
| 24 var overflowList = getOverflowList(video); | 34 var overflowList = getOverflowList(video); |
| 25 var overflowMenu = getOverflowMenuButton(video); | 35 var overflowMenu = getOverflowMenuButton(video); |
| 26 | 36 |
| 27 // Overflow menu button should be visible | |
| 28 assert_not_equals(getComputedStyle(overflowMenu).display, "none"); | |
| 29 | |
| 30 // Overflow list shouldn't be visible until it's clicked on | |
| 31 assert_equals(getComputedStyle(overflowList).display, "none"); | |
| 32 | |
| 33 // Clicking on the overflow menu button should make the overflow list visibl e | 37 // Clicking on the overflow menu button should make the overflow list visibl e |
| 34 var coords = elementCoordinates(overflowMenu); | 38 var coords = elementCoordinates(overflowMenu); |
| 35 clickAtCoordinates(coords[0], coords[1]); | 39 clickAtCoordinates(coords[0], coords[1]); |
| 36 assert_not_equals(getComputedStyle(overflowList).display, "none"); | 40 assert_not_equals(getComputedStyle(overflowList).display, "none"); |
| 37 | 41 |
| 38 // Click on the overflow menu button, again. Should close overflow list. | 42 // Resizing should make the overflow list invisible |
|
mlamouri (slow - plz ping)
2016/10/14 18:35:23
nit: s/make the overflow list invisible/hide the o
Zhiqiang Zhang (Slow)
2016/10/17 10:31:45
Done.
| |
| 39 var coords = elementCoordinates(overflowMenu); | 43 function pollForControlsHidden() { |
| 40 clickAtCoordinates(coords[0], coords[1]); | 44 if (getComputedStyle(overflowList).display === "none") { |
| 41 assert_equals(getComputedStyle(overflowList).display, "none"); | 45 t.done(); |
| 46 } else { | |
| 47 setTimeout(pollForControlsHidden, 100); | |
|
mlamouri (slow - plz ping)
2016/10/14 18:35:23
I'm a bit worried about the setTimeout. Does the f
Zhiqiang Zhang (Slow)
2016/10/14 18:39:22
I'm not sure whether MediaControlsWindowEventListe
Zhiqiang Zhang (Slow)
2016/10/17 10:31:45
Seems like it works if I just use
window.onresize
| |
| 48 } | |
| 49 } | |
| 50 window.onresize = function() { | |
| 51 pollForControlsHidden(); | |
| 52 }; | |
| 53 window.resizeTo(500, 500); | |
| 42 }); | 54 }); |
| 43 }); | 55 }); |
| 44 </script> | 56 </script> |
| 45 </body> | 57 </body> |
| OLD | NEW |