| Index: third_party/WebKit/LayoutTests/media/controls-cast-button-narrow.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/controls-cast-button-narrow.html b/third_party/WebKit/LayoutTests/media/controls-cast-button-narrow.html
|
| index 61054e29ec5053069a7ad53004f729152b791116..5196286f4f0dd5fc27dce30cfc451f8809fead48 100644
|
| --- a/third_party/WebKit/LayoutTests/media/controls-cast-button-narrow.html
|
| +++ b/third_party/WebKit/LayoutTests/media/controls-cast-button-narrow.html
|
| @@ -10,35 +10,43 @@ async_test(function(t) {
|
| var video = document.querySelector("video");
|
| video.src = findMediaFile("video", "content/test");
|
|
|
| - video.onloadedmetadata = t.step_func_done(function() {
|
| + video.onloadedmetadata = t.step_func(function() {
|
| // Pretend we have a cast device
|
| internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true);
|
|
|
| // Video should not have a cast button since the video is too narrow
|
| - var button = castButton(video);
|
| - assert_equals(button.style.display, "none", "button should not be visible");
|
| + assert_false(isVisible(castButton(video)), "button should not be visible");
|
|
|
| // It should not have an overlay cast button too. Instead, the button
|
| // should appear in the overflow menu. Tested somewhere else.
|
| - button = overlayCastButton(video);
|
| - assert_equals(button.style.display, "none", "button should not be visible");
|
| - });
|
| + assert_false(isVisible(overlayCastButton(video)), "button should not be visible");
|
|
|
| - function castButton(element) {
|
| - var controlID = "-internal-media-controls-cast-button";
|
| - var button = mediaControlsElement(internals.shadowRoot(element).firstChild, controlID);
|
| - if (!button)
|
| - throw "Failed to find cast button";
|
| - return button;
|
| - }
|
| + // Increasing video width should show the cast button.
|
| + video.width = 500;
|
| + testRunner.layoutAndPaintAsyncThen(t.step_func(function() {
|
| + assert_true(isVisible(castButton(video)), "button should be visible");
|
| +
|
| + // Decreasing video width should hide the cast button again.
|
| + video.width = 100;
|
| + testRunner.layoutAndPaintAsyncThen(t.step_func(function() {
|
| + assert_false(isVisible(castButton(video)), "button should not be visible");
|
| +
|
| + // If the cast device is lost, we still don't show the cast
|
| + // button when the video width increases.
|
| + internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false);
|
| + video.width = 500;
|
| + testRunner.layoutAndPaintAsyncThen(t.step_func_done(function() {
|
| + assert_false(isVisible(castButton(video)), "button should not be visible");
|
| + }));
|
| + }));
|
| + }));
|
| + });
|
|
|
| - function overlayCastButton(element) {
|
| - var controlID = "-internal-media-controls-overlay-cast-button";
|
| - return mediaControlsElement(internals.shadowRoot(element).firstChild, controlID);
|
| - return button
|
| - if (!button)
|
| - throw "Failed to find cast button";
|
| - return button;
|
| + function isVisible(button) {
|
| + var computedStyle = getComputedStyle(button);
|
| + return computedStyle.display !== "none" &&
|
| + computedStyle.display !== "hidden" &&
|
| + computedStyle.visibility === "visible";
|
| }
|
| });
|
| </script>
|
|
|