Chromium Code Reviews| 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..f8d0752742f28ee7c7f34d70b09b8769e8cd7888 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,32 @@ |
| <!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></video> |
|
fs
2016/06/29 21:15:01
I think 'loop' was here for the same reason as abo
Srirama
2016/06/30 09:34:27
Done.
|
| <script> |
| - |
| -var controls; |
| - |
| -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); |
| -} |
| - |
| - |
| -function runTest() |
| -{ |
| - video = document.getElementById("no-video-media"); |
| - controls = mediaControlsButton(video, "panel"); |
| - |
| - testExpected("video.paused", true); |
| - if (!window.testRunner) |
| - return; |
| - |
| - // 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); |
|
Srirama
2016/06/29 19:35:45
do we need this? the test passes even without this
fs
2016/06/29 21:15:01
Off hand I can't think of any reason for why it wo
Srirama
2016/06/30 09:34:27
I will keep it to be on safe side.
|
| - |
| - 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> |
| +async_test(function(t) { |
| + var video = document.querySelector("video"); |
| + |
| + video.oncanplaythrough = t.step_func(function() { |
| + var controls = mediaControlsButton(video, "panel"); |
| + |
| + 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); |
| + assert_false(video.paused); |
| + |
| + runAfterHideMediaControlsTimerFired(t.step_func_done(function() { |
| + assert_equals(getComputedStyle(controls).opacity, "0"); |
| + }), video); |
| + }); |
| + |
| + video.src = findMediaFile("video", "content/test"); |
| +}); |
| +</script> |