| 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..85932856b9a9d165513e80442d0bc4f671f9fe16 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,37 @@
|
| -<!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.
|
| + video.currentTime = video.duration / 2;
|
| + video.onseeked = t.step_func(function() {
|
| + // Setting loop to true and seeking to duration.
|
| + video.loop = true;
|
| + video.currentTime = video.duration;
|
| + video.onseeked = t.step_func(function() {
|
| + // Seek to duration completed. Waiting for a seek to the beginning.
|
| + video.onseeked = t.step_func_done(function() {
|
| + assert_equals(video.currentTime, 0);
|
| + });
|
| + });
|
| + });
|
| + });
|
| + });
|
| +});
|
| +</script>
|
|
|