Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / video-seek-past-end-paused.html
blobde693f6f65e2eeaea6cbbb163e84c2c139ceb5d1
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src=media-file.js></script>
5 <script src=video-test.js></script>
6 <script>
7 var timeupdateEventCount = 0;
9 function doSetup()
11 findMediaElement();
12 waitForEvent('canplaythrough', canPlayThrough);
13 video.src = findMediaFile('video', 'content/test');
15 window.addEventListener('load', doSetup, false);
17 function canPlayThrough()
19 testExpected("video.paused", true);
20 testExpected("video.ended", false);
21 video.addEventListener('timeupdate', timeUpdate);
22 run("video.play()");
25 function timeUpdate()
27 ++timeupdateEventCount;
29 // Wait 2 timeupdate events so we are sure the media engine is
30 // playing the media.
31 if (timeupdateEventCount == 2) {
32 consoleWrite("");
33 video.removeEventListener('timeupdate', timeUpdate);
34 // Make sure time is advancing.
35 testExpected("video.paused", false);
36 testExpected("mediaElement.currentTime", 0, '>');
37 video.addEventListener('pause', paused);
38 video.pause();
42 function paused() {
43 consoleWrite("");
44 testExpected("video.paused", true);
45 video.addEventListener('seeked', seeked);
46 // Seek past end.
47 video.currentTime = 500;
50 function seeked()
52 consoleWrite("");
54 testExpected("video.paused", true);
55 // Don't use "testExpected()" so we won't log the actual duration to the
56 // results file, as the floating point result may differ with different engines.
57 reportExpected(mediaElement.currentTime == mediaElement.duration, "mediaElement.currentTime", "==", "mediaElement.duration", mediaElement.currentTime);
59 testExpected("video.ended", true);
60 consoleWrite("");
61 timeupdateEventCount = 0;
62 endTest();
64 </script>
65 </head>
66 <body>
67 <video controls></video>
68 <p>Test that seeking a paused video past its end sets currentTime to duration and leaves the video paused.</p>
69 </body>
70 </html>