Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Unified Diff: LayoutTests/media/video-loop-from-ended.html

Issue 898883003: Fixes play seek when user sets loop after ended. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Responding to feedback #3 Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/media/video-loop-from-ended-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/media/video-loop-from-ended-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698