| Index: LayoutTests/media/video-loop-from-ended.html
|
| diff --git a/LayoutTests/media/video-loop-from-ended.html b/LayoutTests/media/video-loop-from-ended.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..55fecdb64e6b83d6ae0aa7b79e904b73faa0b17d
|
| --- /dev/null
|
| +++ b/LayoutTests/media/video-loop-from-ended.html
|
| @@ -0,0 +1,87 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| + <head>
|
| + <script src=media-file.js></script>
|
| + <script src=video-test.js></script>
|
| +
|
| + <script>
|
| + function start()
|
| + {
|
| + findMediaElement();
|
| + var mediaFile = findMediaFile("video", "content/test");
|
| + video.src = mediaFile;
|
| +
|
| + consoleWrite("<br><em>++ Video is initially paused and 'loop' unset.</em>");
|
| + testExpected("video.paused", true)
|
| + testExpected("video.loop", false);
|
| +
|
| + seekThenPlayWhenReady();
|
| + }
|
| +
|
| + function seekThenPlayWhenReady() {
|
| + if (video.readyState < HTMLMediaElement.HAVE_METADATA) {
|
| + setTimeout(seekThenPlayWhenReady, 100);
|
| + return;
|
| + }
|
| +
|
| + consoleWrite("<br><em>++ Seek to just before the end of the video and play.</em>");
|
| + run("video.currentTime = video.duration - .5");
|
| + waitForEvent("play");
|
| + waitForEvent("ended", ended);
|
| + run("video.play()");
|
| + consoleWrite("");
|
| + }
|
| +
|
| + function ended()
|
| + {
|
| + consoleWrite("<br><em>++ Verify played to end and stopped.</em>");
|
| + testExpected("video.ended", true);
|
| + testExpected("video.paused", true);
|
| + // Using reportExpected to avoid logging floating point value which may differ across engines.
|
| + reportExpected(video.currentTime == video.duration, "video.currentTime", "==", "video.duration", video.currentTime);
|
| +
|
| + consoleWrite("<br><em>++ With playback ended, set 'loop' attribute. This will cause ended == false; looping video cannot be 'ended', only paused.</em>");
|
| + testExpected("video.loop", false);
|
| + run("video.loop = true");
|
| + testExpected("video.loop", true);
|
| + testExpected("video.ended", false);
|
| + testExpected("video.paused", true);
|
| +
|
| + consoleWrite("<br><em>++ Play video with 'loop' set. Expect seek back to start.<em>");
|
| + waitForEvent("seeked", seeked);
|
| + run("video.play()");
|
| + consoleWrite("");
|
| + }
|
| +
|
| + function seeked()
|
| + {
|
| + consoleWrite("<br><em>++ Observed seek. Verify current time decreased and still playing.</em>");
|
| + testExpected("video.loop", true);
|
| + testExpected("video.paused", false);
|
| + testExpected("video.ended", false);
|
| + // Using reportExpected to avoid logging floating point value which may differ across engines.
|
| + reportExpected(video.currentTime < video.duration, "video.currentTime", "<", "video.duration", video.currentTime);
|
| +
|
| + consoleWrite("<br><em>++ Pausing now that test is over to prevent additional unwanted looping.</em>");
|
| + run("video.pause()");
|
| + consoleWrite("");
|
| + endTest();
|
| + }
|
| + </script>
|
| +
|
| + </head>
|
| + <body>
|
| + <video controls></video>
|
| + <p><b>Test looping edge case to verify http://crbug.com/364442. Steps:</b>
|
| + <ol>
|
| + <li>Seek toward end of video (for faster testing).</li>
|
| + <li>Play video to end with 'loop' set to false.</li>
|
| + <li>Once ended, set 'loop' to true.</li>
|
| + <li>Call play.</li>
|
| + <li>Verify that 'seeked' event fires, seeking back to the beginning.</li>
|
| + <li>Pause video and end test.</li>
|
| + </ol>
|
| + </p>
|
| + <script>start()</script>
|
| + </body>
|
| +</html>
|
|
|