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

Unified Diff: third_party/WebKit/LayoutTests/media/video-mouse-focus.html

Issue 2123573002: Convert video-[enter, mouse, scales]* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
Index: third_party/WebKit/LayoutTests/media/video-mouse-focus.html
diff --git a/third_party/WebKit/LayoutTests/media/video-mouse-focus.html b/third_party/WebKit/LayoutTests/media/video-mouse-focus.html
index 0cb7212e49f4dff08cd9f35f6ba50edd33f2d560..8b8ba7ea6c1019b1bf514bf0ab4831eabe7073b9 100644
--- a/third_party/WebKit/LayoutTests/media/video-mouse-focus.html
+++ b/third_party/WebKit/LayoutTests/media/video-mouse-focus.html
@@ -1,38 +1,23 @@
<!DOCTYPE html>
-<html>
- <head>
- <!-- 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>
- <script>
- var startTest = function() {
- if (!window.eventSender) {
- logResult(false, "This test requires window.eventSender.");
- return;
- }
+<title>This tests that a mouse click event will not cause a media element to gain focus.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-controls.js"></script>
+<video controls></video>
+<script>
+test(function() {
+ var video = document.querySelector("video");
+ var rect = video.getBoundingClientRect();
+ // Click on the center of the video element.
+ var x = rect.left + rect.width / 2;
+ var y = rect.top + rect.height / 2;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ assert_not_equals(document.activeElement, video);
- findMediaElement();
- var rect = video.getBoundingClientRect();
- consoleWrite("Click on the center of the video element.");
- var x = rect.left + rect.width / 2;
- var y = rect.top + rect.height / 2;
- eventSender.mouseMoveTo(x, y);
- eventSender.mouseDown();
- eventSender.mouseUp();
- testExpected("document.activeElement.id", "video", "!=");
-
- consoleWrite("Click on the play button.");
- eventSender.mouseMoveTo(rect.left + 20, rect.top + rect.height - 20);
- eventSender.mouseDown();
- eventSender.mouseUp();
- testExpected("document.activeElement.id", "video", "!=");
-
- endTest();
- };
- </script>
- </head>
- <body onload="startTest();">
- <p>This tests that a mouse click event will not cause a media element to gain focus.</p>
- <video id="video" controls></video>
- </body>
-</html>
+ // Click on the play button.
+ mediaControlsButton(video, "play-button").click();
+ assert_not_equals(document.activeElement, video);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698