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

Unified Diff: third_party/WebKit/LayoutTests/media/video-controls-hide-on-move-outside-controls.html

Issue 2120793002: Convert video-controls-hide* and video-controls-in* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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-hide-on-move-outside-controls.html
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-hide-on-move-outside-controls.html b/third_party/WebKit/LayoutTests/media/video-controls-hide-on-move-outside-controls.html
index 4e4dc55a9ab9cbcd19d45175209cb6103e0cdce1..aa6c60271c3616045e61337d09f73659284ddec1 100644
--- a/third_party/WebKit/LayoutTests/media/video-controls-hide-on-move-outside-controls.html
+++ b/third_party/WebKit/LayoutTests/media/video-controls-hide-on-move-outside-controls.html
@@ -1,56 +1,33 @@
<!DOCTYPE html>
-<html>
-<style>
-#no-video-media {
- width: 320px;
- height: 240px;
-}
-</style>
-<!-- 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 src=media-file.js></script>
-<script src=media-controls.js></script>
+<title>Test video controls visibility when mouse is not over controls.</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 controls loop></video>
<script>
-var controls;
+async_test(function(t) {
+ var video = document.querySelector("video");
-function runTest()
-{
- video = document.getElementById("no-video-media");
+ video.oncanplaythrough = t.step_func(function() {
+ assert_true(video.paused);
- testExpected("video.paused", true);
- if (!window.testRunner)
- return;
+ // Click the play button.
+ var coords = mediaControlsButtonCoordinates(video, "play-button");
+ eventSender.mouseMoveTo(coords[0], coords[1]);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ assert_false(video.paused);
- // Click the play button.
- var playCoords = mediaControlsButtonCoordinates(video, "play-button");
- var clickX = playCoords[0];
- var clickY = playCoords[1];
- eventSender.mouseMoveTo(clickX, clickY);
- eventSender.mouseDown();
- eventSender.mouseUp();
- testExpected("video.paused", false);
+ runAfterHideMediaControlsTimerFired(t.step_func_done(function() {
+ var controls = mediaControlsButton(video, "panel");
+ assert_equals(getComputedStyle(controls).opacity, "0");
+ }), video);
- runAfterHideMediaControlsTimerFired(function()
- {
- controls = mediaControlsButton(video, "panel");
- testExpected("getComputedStyle(controls).opacity", 0);
+ // Move the mouse to the upper-left corner of the video.
+ eventSender.mouseMoveTo(video.offsetLeft + 4, video.offsetTop + 4);
+ });
- consoleWrite("");
- endTest();
- }, video);
-
- // Move the mouse to the upper-left corner of the video.
- eventSender.mouseMoveTo(video.offsetLeft + 4, video.offsetTop + 4);
-}
-</script>
-<body>
- <p>Test video element control visibility when mouse is not over element.</p>
- <p>This test only runs in DRT!</p>
-
- <video id="no-video-media" controls loop oncanplaythrough="runTest()"></video>
- <script>
- setSrcById("no-video-media", findMediaFile("video", "content/test"));
- </script>
-</body>
-</html>
+ video.src = findMediaFile("video", "content/test");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698