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

Unified Diff: third_party/WebKit/LayoutTests/media/controls-overlay-cast-button.html

Issue 2020893002: Convert controls-css*, controls-drag* and controls-overlay* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/media/controls-drag-timebar-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/controls-overlay-cast-button.html
diff --git a/third_party/WebKit/LayoutTests/media/controls-overlay-cast-button.html b/third_party/WebKit/LayoutTests/media/controls-overlay-cast-button.html
index 99330aa41c874fae6d420e8eb421261122bfd523..d3a019e0f33c43fd4eb57223b9b8ad1c875b7bc9 100644
--- a/third_party/WebKit/LayoutTests/media/controls-overlay-cast-button.html
+++ b/third_party/WebKit/LayoutTests/media/controls-overlay-cast-button.html
@@ -1,64 +1,46 @@
-<!doctype html>
-<html>
- <head>
- <title>media controls cast button</title>
- <script src="../resources/testharness.js"></script>
- <script src="../resources/testharnessreport.js"></script>
- <script src="media-file.js"></script>
- <script src="media-controls.js"></script>
- <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
- (Please avoid writing new tests using video-test.js) -->
- <script src="video-test.js"></script>
- </head>
- <body>
- <video></video>
- <script>
- function overlayCastButton(element)
- {
- var controlID = "-internal-media-controls-overlay-cast-button";
- var button = mediaControlsElement(window.internals.shadowRoot(element).firstChild, controlID);
- if (!button)
- throw "Failed to find cast button";
- return button;
- }
- function overlayCastButtonDimensions(element)
- {
- var button = overlayCastButton(element);
- var buttonBoundingRect = button.getBoundingClientRect();
- return new Array(buttonBoundingRect.width, buttonBoundingRect.height);
- }
- async_test(function(t)
- {
- findMediaElement();
- video.src = findMediaFile("video", "content/test");
- mediaElement.addEventListener("loadedmetadata", function()
- {
- // Should not have a cast button by default
- button = overlayCastButton(video);
- assert_equals(button.style.display, "none", "button should not be visible with no cast devices");
+<!DOCTYPE html>
+<title>media controls cast button</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<script src="media-controls.js"></script>
+<video></video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
+ video.src = findMediaFile("video", "content/test");
- // Pretend we have a cast device
- internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true);
- // Now should have cast button
- assert_false(("display" in button.style) && (button.style.display == "none"), "button should exist");
- dimensions = overlayCastButtonDimensions(video);
- assert_not_equals(dimensions[0], 0, "button should exist");
- assert_not_equals(dimensions[1], 0, "button should exist");
+ video.onloadedmetadata = t.step_func_done(function() {
+ // Should not have a cast button by default
+ var button = overlayCastButton(video);
+ assert_equals(button.style.display, "none", "button should not be visible with no cast devices");
- // Check position, should be in the top left corner of the video
- rect = button.getBoundingClientRect();
- videoRect = video.getBoundingClientRect();
- assert_greater_than_equal(rect.top, videoRect.top, "button should be at top left of video");
- assert_greater_than_equal(rect.left, videoRect.left, "button should be at top left of video");
- assert_less_than_equal(rect.bottom, videoRect.top + videoRect.height / 2, "button should be at top left of video");
- assert_less_than_equal(rect.right, videoRect.left + videoRect.width / 2, "button should be at top left of video");
+ // Pretend we have a cast device
+ internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true);
+ // Now should have cast button
+ assert_false(("display" in button.style) && (button.style.display == "none"), "button should exist");
+ var rect = button.getBoundingClientRect();
+ assert_not_equals(rect.width, 0, "button should exist");
+ assert_not_equals(rect.height, 0, "button should exist");
- // Remove cast device - cast button should go away
- internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false);
- assert_equals(button.style.display, "none", "button should not be visible after cast device goes away");
- t.done();
- })
- });
- </script>
- </body>
-</html>
+ // Check position, should be in the top left corner of the video
+ var videoRect = video.getBoundingClientRect();
+ assert_greater_than_equal(rect.top, videoRect.top, "button should be at top left of video");
+ assert_greater_than_equal(rect.left, videoRect.left, "button should be at top left of video");
+ assert_less_than_equal(rect.bottom, videoRect.top + videoRect.height / 2, "button should be at top left of video");
+ assert_less_than_equal(rect.right, videoRect.left + videoRect.width / 2, "button should be at top left of video");
+
+ // Remove cast device - cast button should go away
+ internals.mediaPlayerRemoteRouteAvailabilityChanged(video, false);
+ assert_equals(button.style.display, "none", "button should not be visible after cast device goes away");
+ });
+
+ function overlayCastButton(element) {
+ var controlID = "-internal-media-controls-overlay-cast-button";
+ var button = mediaControlsElement(internals.shadowRoot(element).firstChild, controlID);
+ if (!button)
+ throw "Failed to find cast button";
+ return button;
+ }
+});
+</script>
« no previous file with comments | « third_party/WebKit/LayoutTests/media/controls-drag-timebar-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698