Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/video-seek-to-duration-with-playbackrate-zero.html |
| diff --git a/third_party/WebKit/LayoutTests/media/video-seek-to-duration-with-playbackrate-zero.html b/third_party/WebKit/LayoutTests/media/video-seek-to-duration-with-playbackrate-zero.html |
| index 5590140c13f61bc1cacf5845fbd1aec8d3c551aa..7e7b79ae3b9e9afcea120fad453aa9b3639ec383 100644 |
| --- a/third_party/WebKit/LayoutTests/media/video-seek-to-duration-with-playbackrate-zero.html |
| +++ b/third_party/WebKit/LayoutTests/media/video-seek-to-duration-with-playbackrate-zero.html |
| @@ -1,60 +1,39 @@ |
| -<!doctype html> |
| -<html> |
| - <head> |
| - <title>Test behavior when seeking to the duration and the playback rate equals 0.</title> |
| - <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 behavior when seeking to the duration and the playback rate equals 0.</title> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="media-file.js"></script> |
| +<video></video> |
| +<script> |
| +async_test(function(t) { |
| + var video = document.querySelector("video"); |
| - <script> |
| - function onLoad() |
| - { |
| - findMediaElement(); |
| - video.src = findMediaFile("video", "content/test"); |
| - video.load(); |
| - waitForEvent("seeking"); |
| + video.src = findMediaFile("video", "content/test"); |
| + video.load(); |
| + video.onseeking = t.step_func(function() {}); |
| - waitForEventOnce("loadedmetadata", function() |
| - { |
| - consoleWrite("Seeking to duration"); |
| - video.currentTime = video.duration; |
| - video.playbackRate = 0; |
| - waitForEventOnce("seeked"); |
| - waitForEventOnce("ended", firstEnded); |
| - }); |
| - |
| - function firstEnded() |
| - { |
| - testExpected("video.currentTime == video.duration", true); |
| - consoleWrite("Seeking to the middle of the video"); |
| - video.currentTime = video.duration / 2; |
| - waitForEventOnce("seeked", seekToMiddleDone); |
| - } |
| - |
| - function seekToMiddleDone() |
| - { |
| - consoleWrite("Setting loop to true and seeking to duration."); |
| - video.loop = true; |
| - video.currentTime = video.duration; |
| - waitForEventOnce("seeked", seekToDurationComplete); |
| - } |
| - |
| - function seekToDurationComplete() |
| - { |
| - consoleWrite("Seek to duration completed. Waiting for a seek to the beginning."); |
| - waitForEventOnce("seeked", seekToBeginningComplete); |
| - } |
| - |
| - function seekToBeginningComplete() |
| - { |
| - testExpected("video.currentTime", 0); |
| - endTest(); |
| - } |
| - } |
| - </script> |
| - </head> |
| - <body onload="onLoad()"> |
| - <video id="v" preload="metadata"></video> |
| - </body> |
| -</html> |
| + video.onloadedmetadata = t.step_func(function() { |
| + video.onloadedmetadata = null; |
| + video.currentTime = video.duration; |
| + video.playbackRate = 0; |
| + video.onended = t.step_func(function() { |
| + assert_equals(video.currentTime, video.duration); |
| + // Seeking to the middle of the video"); |
|
fs
2016/06/27 12:09:54
Nit: stray "); at the end (replace with .)
Srirama
2016/06/27 13:10:37
Done.
|
| + video.currentTime = video.duration / 2; |
| + video.onseeked = t.step_func(function() { |
| + video.onseeked = null; |
|
fs
2016/06/27 12:09:54
Nit: this will be set again below
Srirama
2016/06/27 13:10:37
Done.
|
| + // Setting loop to true and seeking to duration. |
| + video.loop = true; |
| + video.currentTime = video.duration; |
| + video.onseeked = t.step_func(function() { |
| + video.onseeked = null; |
|
fs
2016/06/27 12:09:54
Nit: ditto
Srirama
2016/06/27 13:10:37
Done.
|
| + // Seek to duration completed. Waiting for a seek to the beginning. |
| + video.onseeked = t.step_func_done(function() { |
| + assert_equals(video.currentTime, 0); |
| + }); |
| + }); |
| + }); |
| + }); |
| + }); |
| +}); |
| +</script> |