Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / video-seek-to-duration-with-playbackrate-zero.html
blob4c907b6595c618c21ed869528e60f9341da2748e
1 <!doctype html>
2 <html>
3 <head>
4 <title>Test behavior when seeking to the duration and the playback rate equals 0.</title>
5 <script src="media-file.js"></script>
6 <script src="video-test.js"></script>
8 <script>
9 function onLoad()
11 findMediaElement();
12 video.src = findMediaFile("video", "content/test");
13 video.load();
14 waitForEvent("seeking");
16 waitForEventOnce("loadedmetadata", function()
18 consoleWrite("Seeking to duration");
19 video.currentTime = video.duration;
20 video.playbackRate = 0;
21 waitForEventOnce("seeked");
22 waitForEventOnce("ended", firstEnded);
23 });
25 function firstEnded()
27 testExpected("video.currentTime == video.duration", true);
28 consoleWrite("Seeking to the middle of the video");
29 video.currentTime = video.duration / 2;
30 waitForEventOnce("seeked", seekToMiddleDone);
33 function seekToMiddleDone()
35 consoleWrite("Setting loop to true and seeking to duration.");
36 video.loop = true;
37 video.currentTime = video.duration;
38 waitForEventOnce("seeked", seekToDurationComplete);
41 function seekToDurationComplete()
43 consoleWrite("Seek to duration completed. Waiting for a seek to the beginning.");
44 waitForEventOnce("seeked", seekToBeginningComplete);
47 function seekToBeginningComplete()
49 testExpected("video.currentTime", 0);
50 endTest();
53 </script>
54 </head>
55 <body onload="onLoad()">
56 <video id="v" preload="metadata"></video>
57 </body>
58 </html>