Index: third_party/WebKit/LayoutTests/media/video-controls-auto-hide-after-play-by-touch.html |
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-auto-hide-after-play-by-touch.html b/third_party/WebKit/LayoutTests/media/video-controls-auto-hide-after-play-by-touch.html |
index 61709d0678eedea279f8c2c3164e5bc46d76ff60..3c2c2799967d2706be58ce1f80716b7934d174da 100644 |
--- a/third_party/WebKit/LayoutTests/media/video-controls-auto-hide-after-play-by-touch.html |
+++ b/third_party/WebKit/LayoutTests/media/video-controls-auto-hide-after-play-by-touch.html |
@@ -1,63 +1,38 @@ |
<!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 control element visibility when play by touch.</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> |
+async_test(function(t) { |
+ var video = document.querySelector("video"); |
-var controls; |
+ video.oncanplaythrough = t.step_func(function() { |
+ var controls = mediaControlsButton(video, "panel"); |
-function dispatchActivateEvent(target) { |
- // Create a DOMActivate event and dispatch it |
- var event = document.createEvent('UIEvents'); |
- event.initUIEvent('DOMActivate', true, true, window, 1) |
- target.dispatchEvent(event); |
-} |
+ assert_true(video.paused); |
+ // Click the play button. |
+ var playCoords = mediaControlsButtonCoordinates(video, "play-button"); |
+ var clickX = playCoords[0]; |
+ var clickY = playCoords[1]; |
+ eventSender.gestureTap(clickX, clickY); |
+ eventSender.gestureTapDown(clickX, clickY); |
-function runTest() |
-{ |
- video = document.getElementById("no-video-media"); |
- controls = mediaControlsButton(video, "panel"); |
+ // Create a DOMActivate event and dispatch it. |
+ var event = document.createEvent("UIEvents"); |
+ event.initUIEvent("DOMActivate", true, true, window, 1); |
+ controls.dispatchEvent(event); |
- testExpected("video.paused", true); |
- if (!window.testRunner) |
- return; |
+ assert_false(video.paused); |
- // Click the play button. |
- var playCoords = mediaControlsButtonCoordinates(video, "play-button"); |
- var clickX = playCoords[0]; |
- var clickY = playCoords[1]; |
- eventSender.gestureTap(clickX, clickY); |
- eventSender.gestureTapDown(clickX, clickY); |
- dispatchActivateEvent(controls); |
+ runAfterHideMediaControlsTimerFired(t.step_func_done(function() { |
+ assert_equals(getComputedStyle(controls).opacity, "0"); |
+ }), video); |
+ }); |
- testExpected("video.paused", false); |
- |
- runAfterHideMediaControlsTimerFired(function() |
- { |
- testExpected("getComputedStyle(controls).opacity", 0); |
- |
- consoleWrite(""); |
- endTest(); |
- }, video); |
-} |
-</script> |
-<body> |
- <p>Test video control element visibility when play by touch.</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> |