Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/controls-drag-timebar.html |
| diff --git a/third_party/WebKit/LayoutTests/media/controls-drag-timebar.html b/third_party/WebKit/LayoutTests/media/controls-drag-timebar.html |
| index 2b58e979ba9a84c7b416d0c7bf411254a6a1e2c6..7229355d1d5e16644fdeaf436cbb01bb09f67ad9 100644 |
| --- a/third_party/WebKit/LayoutTests/media/controls-drag-timebar.html |
| +++ b/third_party/WebKit/LayoutTests/media/controls-drag-timebar.html |
| @@ -1,96 +1,66 @@ |
| <!DOCTYPE html> |
| -<html> |
| - <head> |
| - <title>drag timebar test</title> |
| - <script src=media-controls.js></script> |
| - <script src=media-file.js></script> |
| - <!-- 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> |
| - var x; |
| - var y; |
| - var seekCount; |
| - var moveCount; |
| - |
| - if (window.testRunner) |
| - testRunner.dumpAsText(); |
| - |
| - function test() |
| - { |
| - seekCount = 0; |
| - moveCount = 0; |
| - |
| - testExpected("video.paused", false); |
| - |
| - if (window.eventSender) { |
| - var seekCoords; |
| - try { |
| - seekCoords = mediaControlsButtonCoordinates(video, "timeline"); |
| - } catch (exception) { |
| - failTest(exception.description); |
| - return; |
| - } |
| - x = seekCoords[0]; |
| - y = seekCoords[1]; |
| - |
| - eventSender.dragMode = false; |
| - eventSender.mouseMoveTo(x, y); |
| - eventSender.mouseDown(); |
| - |
| - testExpected("video.paused", true); |
| - |
| - // Drag mouse off of the slider thumb to make sure it continues to track |
| - y += 100; |
| - eventSender.mouseMoveTo(x, y); |
| - } |
| - window.setTimeout("move()", 100); |
| - } |
| - |
| - function move() |
| - { |
| - ++moveCount; |
| - |
| - var delta = (10 + moveCount * 2) * (moveCount % 2 ? 1 : -1); |
| - |
| - if (window.eventSender) { |
| - x += delta; |
| - eventSender.mouseMoveTo(x, y); |
| - } |
| - } |
| - |
| - function seeked() |
| - { |
| - |
| - ++seekCount; |
| - if (seekCount < 6) { |
| - window.setTimeout("move()", 100); |
| - return; |
| - } |
| - |
| - if (window.eventSender) { |
| - testExpected("video.paused", true); |
| - eventSender.mouseUp(); |
| - } |
| - |
| - testExpected("video.paused", false); |
| - |
| - endTest(); |
| - } |
| - |
| - function start() |
| - { |
| - findMediaElement(); |
| - waitForEventOnce('playing', test); |
| - waitForEvent('seeked', seeked); |
| - video.src = findMediaFile("video", "content/test"); |
| - video.play(); |
| - } |
| - </script> |
| - </head> |
| - |
| - <body onload="start()"> |
| - <p>Test that dragging the timebar thumb causes seeks.</p> |
| - <video controls></video> |
| - </body> |
| -</html> |
| +<title>Test that dragging the timebar thumb causes seeks.</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> |
| +<script> |
| +async_test(function(t) { |
| + var x; |
|
fs
2016/05/29 14:28:17
Maybe group these and call them "currentMousePosit
Srirama
2016/05/30 13:19:19
Done. Is this what you are expecting, or did i mes
foolip
2016/05/30 13:34:14
Oh, you talked about this :) Wait for fs to commen
fs
2016/05/30 13:37:22
I was thinking of 'x' and 'y' only, like:
var cur
Srirama
2016/05/30 13:59:22
Done, assuming that you still want this change.
|
| + var y; |
| + var seekCount; |
| + var moveCount; |
| + |
| + var video = document.querySelector("video"); |
| + video.onplaying = t.step_func(test); |
| + video.onseeked = t.step_func(seeked); |
| + video.src = findMediaFile("video", "content/test"); |
| + video.play(); |
| + |
| + function test() { |
| + video.onplaying = null; |
| + seekCount = 0; |
| + moveCount = 0; |
| + |
| + assert_equals(video.paused, false); |
| + |
| + var seekCoords = mediaControlsButtonCoordinates(video, "timeline"); |
| + x = seekCoords[0]; |
| + y = seekCoords[1]; |
| + |
| + eventSender.dragMode = false; |
| + eventSender.mouseMoveTo(x, y); |
| + eventSender.mouseDown(); |
| + |
| + assert_equals(video.paused, true); |
| + |
| + // Drag mouse off of the slider thumb to make sure it continues to track |
| + y += 100; |
| + eventSender.mouseMoveTo(x, y); |
| + |
| + setTimeout(t.step_func(move), 100); |
| + } |
| + |
| + function move() { |
| + ++moveCount; |
| + |
| + x += (10 + moveCount * 2) * (moveCount % 2 ? 1 : -1); |
| + eventSender.mouseMoveTo(x, y); |
| + } |
| + |
| + function seeked() { |
| + ++seekCount; |
| + if (seekCount < 6) { |
| + setTimeout(t.step_func(move), 100); |
| + return; |
| + } |
| + |
| + assert_equals(video.paused, true); |
| + eventSender.mouseUp(); |
| + |
| + assert_equals(video.paused, false); |
| + t.done(); |
| + } |
| +}); |
| +</script> |