Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/video-seek-past-end-playing.html |
| diff --git a/third_party/WebKit/LayoutTests/media/video-seek-past-end-playing.html b/third_party/WebKit/LayoutTests/media/video-seek-past-end-playing.html |
| index a2656c302fbe813d01cb5569092c2432c802faf1..7f46371d321a1ca197c9ea09d0efcac9cb2d68f3 100644 |
| --- a/third_party/WebKit/LayoutTests/media/video-seek-past-end-playing.html |
| +++ b/third_party/WebKit/LayoutTests/media/video-seek-past-end-playing.html |
| @@ -1,52 +1,40 @@ |
| -<html> |
| - <body> |
| - |
| -<video loop controls></video> |
| -<p>Test that seeking video with 'loop' past it's end rewinds to the beginning and continues playback.</p> |
| -<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> |
| +<!DOCTYPE html> |
| +<title>Test that seeking video with "loop" past it's end rewinds to the beginning and continues playback.</title> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="media-file.js"></script> |
| +<video loop></video> |
| <script> |
| +async_test(function(t) { |
| var timeupdateEventCount = 0; |
| + var video = document.querySelector("video"); |
| - waitForEventOnce('canplaythrough', function () { |
| - testExpected("video.paused", true); |
| - run("video.play()"); |
| - testExpected("video.paused", false); |
| + video.oncanplaythrough = t.step_func(function () { |
| + video.oncanplaythrough = null; |
|
fs
2016/06/27 12:09:54
Nit: indentation
Srirama
2016/06/27 13:10:37
Done.
|
| + assert_true(video.paused); |
| + video.play(); |
| + assert_false(video.paused); |
| }); |
| - function timeupdate() |
| - { |
| + video.ontimeupdate = t.step_func(function() { |
| ++timeupdateEventCount; |
| // wait 2 timeupdate events so we are sure the media engine is |
| // playing the media. |
| if (timeupdateEventCount == 2) { |
| - consoleWrite(""); |
| - testExpected("video.paused", false); |
| + assert_false(video.paused); |
| // make sure time is advancing and seek past end |
| - testExpected("mediaElement.currentTime", 0, '>'); |
| - run("video.currentTime = 500"); |
| + assert_greater_than(video.currentTime, 0); |
| + video.currentTime = 500; |
| } else if (timeupdateEventCount == 10) { |
| // Wait some more timeupdate events so we can check the |
| // media engine performed the seek. |
| - consoleWrite(""); |
| - testExpected("video.paused", false); |
| - testExpected("mediaElement.currentTime", 0, '>'); |
| - consoleWrite(""); |
| - // reset the counter to prevent infinite loop if the |
| - // test is re-executed manually. |
| - timeupdateEventCount = 0; |
| - endTest(); |
| + assert_false(video.paused); |
| + assert_greater_than(video.currentTime, 0); |
| + t.done(); |
| } |
| - } |
| + }); |
| - mediaElement.addEventListener("timeupdate", timeupdate); |
| - var mediaFile = findMediaFile("video", "content/test"); |
| - disableFullTestDetailsPrinting(); |
| - runSilently("video.src = '" + mediaFile + "'"); |
| - enableFullTestDetailsPrinting(); |
| -</script> |
| - </body> |
| -</html> |
| + video.src = findMediaFile("video", "content/test"); |
| +}); |
| +</script> |