Index: third_party/WebKit/LayoutTests/media/video-controls-always-visible-when-control-hovered.html |
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-always-visible-when-control-hovered.html b/third_party/WebKit/LayoutTests/media/video-controls-always-visible-when-control-hovered.html |
index f2af987b3d877e68561e64a8d02d0ef3e706345c..5bc07fb0c117cae2013c744d37b62e7224b5dd5c 100644 |
--- a/third_party/WebKit/LayoutTests/media/video-controls-always-visible-when-control-hovered.html |
+++ b/third_party/WebKit/LayoutTests/media/video-controls-always-visible-when-control-hovered.html |
@@ -1,55 +1,31 @@ |
<!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>Verify that media controls are always visible when hovered.</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() { |
- testExpected("video.paused", true); |
- if (!window.testRunner) |
- return; |
+ assert_true(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); |
+ // Click the play button. |
+ var playCoords = mediaControlsButtonCoordinates(video, "play-button"); |
+ eventSender.mouseMoveTo(playCoords[0], playCoords[1]); |
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+ assert_false(video.paused); |
- runAfterHideMediaControlsTimerFired(function() |
- { |
- controls = mediaControlsButton(video, "panel"); |
- testExpected("getComputedStyle(controls).opacity", 1); |
+ runAfterHideMediaControlsTimerFired(t.step_func_done(function() { |
+ var controls = mediaControlsButton(video, "panel"); |
+ assert_equals(getComputedStyle(controls).opacity, "1"); |
+ }), video); |
+ }); |
- consoleWrite(""); |
- endTest(); |
- }, video); |
-} |
-</script> |
-<body> |
- <p>Test video element control visibility after click on control. After the click |
- the mouse does not move, so the control is still hovered and it should |
- remain visible.</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> |