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

Unified Diff: third_party/WebKit/LayoutTests/media/video-controls-zoomed.html

Issue 2115833002: Convert video-controls* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nits Created 4 years, 6 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-controls-zoomed.html
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-zoomed.html b/third_party/WebKit/LayoutTests/media/video-controls-zoomed.html
index ce33016f4aaa71e7f98996da9b894ab403bddfbc..b831b91ef3b0277c41393565b7bc43a80276415f 100644
--- a/third_party/WebKit/LayoutTests/media/video-controls-zoomed.html
+++ b/third_party/WebKit/LayoutTests/media/video-controls-zoomed.html
@@ -1,63 +1,40 @@
-<html>
-<head>
- <title>Test controls with zooming</title>
- <style type="text/css" media="screen">
- video {
- margin: 50px;
- }
- </style>
- <script src=media-file.js></script>
- <script src=media-controls.js></script>
- <script type="text/javascript" charset="utf-8">
- function runTest()
- {
- window.setTimeout(function() {
- document.documentElement.style.zoom = '150%';
- video.addEventListener("playing", function() {
- testExpected("video.paused", false);
- endTest();
- });
+<!DOCTYPE html>
+<title>Test controls with zooming.</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>
+<style>
+video {
+ margin: 50px;
+}
+</style>
+<video controls></video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
+ assert_true(video.controls);
- if (window.eventSender)
- {
- // Find the play button and click the middle of its bounding box.
- var playCoords;
- try {
- playCoords = mediaControlsButtonCoordinates(video, "play-button");
- } catch (exception) {
- failTest(exception.description);
- return;
- }
- var clickX = playCoords[0];
- var clickY = playCoords[1];
+ video.oncanplaythrough = t.step_func(function() {
+ setTimeout(function() {
+ document.documentElement.style.zoom = "150%";
+ video.onplaying = t.step_func_done(function() {
+ assert_false(video.paused);
+ });
+ // Find the play button and click the middle of its bounding box.
+ var playCoords = mediaControlsButtonCoordinates(video, "play-button");
// Apply the page zoom value to the coordinates because
- // getBoundingClientRect() used in
- // mediaControlsButtonCoordinates() doesn't do it.
- clickX = clickX * 1.5;
- clickY = clickY * 1.5;
+ // getBoundingClientRect() used in mediaControlsButtonCoordinates() doesn't do it.
+ var clickX = playCoords[0] * 1.5;
+ var clickY = playCoords[1] * 1.5;
eventSender.mouseMoveTo(clickX, clickY);
eventSender.mouseDown();
eventSender.mouseUp();
- }
- }, 50);
- }
- </script>
-</head>
-<body>
- <video controls></video>
- <p>Test controls on zoomed video.</p>
- <p>This test only runs in DRT!</p>
- <!-- 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>
- testExpected("video.controls", null, '!=');
- waitForEvent('canplaythrough', function() {
- runTest();
- } );
- video.src = findMediaFile("video", "content/test");
- </script>
-</body>
-</html>
+ }, 50);
+ });
+
+ video.src = findMediaFile("video", "content/test");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698