Implement Focus UI
[framework/web/webkit-efl.git] / LayoutTests / media / video-seek-past-end-playing.html
1 <html>
2     <body>
3
4 <video loop controls></video>
5 <p>Test that seeking video with 'loop' past it's end rewinds to the beginning and continues playback.</p>
6 <script src=media-file.js></script>
7 <script src=video-test.js></script>
8 <script>
9     var timeupdateEventCount = 0;
10
11     waitForEvent('canplaythrough', function () { 
12         testExpected("video.paused", true);
13         run("video.play()");
14         testExpected("video.paused", false);
15     });
16
17     function timeupdate()
18     {
19         ++timeupdateEventCount;
20
21         // wait 2 timeupdate events so we are sure the media engine is
22         // playing the media.
23         if (timeupdateEventCount == 2) {
24            consoleWrite("");
25            testExpected("video.paused", false);
26            // make sure time is advancing and seek past end
27            testExpected("mediaElement.currentTime", 0, '>');
28            run("video.currentTime = 500");
29         } else if (timeupdateEventCount == 10) {
30            // Wait some more timeupdate events so we can check the
31            // media engine performed the seek.
32            consoleWrite("");
33            testExpected("video.paused", false);
34            testExpected("mediaElement.currentTime", 0, '>');
35            consoleWrite("");
36            // reset the counter to prevent infinite loop if the
37            // test is re-executed manually.
38            timeupdateEventCount = 0;
39            endTest();
40         }
41     }
42
43     mediaElement.addEventListener("timeupdate", timeupdate);
44     var mediaFile = findMediaFile("video", "content/test");
45     disableFullTestDetailsPrinting();
46     runSilently("video.src = '" + mediaFile + "'");
47     enableFullTestDetailsPrinting();
48 </script>
49     </body>
50 </html>