upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / media / video-pause-immediately.html
1 <html>
2     <head>
3         <title>Test pause() pauses the clock immediately</title>
4         <script src=media-file.js></script>
5         <script src=video-test.js></script>
6         <script>
7             var timeAfterPause;
8
9             function test()
10             {
11                 findMediaElement();
12                 video.src = findMediaFile("video", "content/test");
13                 waitForEvent("canplay", canplay);
14                 waitForEvent("playing", playing);
15                 waitForEvent("pause", pause);
16             }
17
18             function canplay()
19             {
20                 video.play();
21             }
22
23             function playing()
24             {
25                 video.addEventListener("timeupdate", timeupdate);
26             }
27
28             function timeupdate()
29             {
30                 video.removeEventListener("timeupdate", timeupdate);
31                 if (video.currentTime > 0) {
32                     video.pause();
33                     timeAfterPause = video.currentTime;
34                 }
35             }
36
37             function pause()
38             {
39                 testExpected("(video.currentTime - timeAfterPause)", 0);
40                 testExpected("(video.played.end(0) - timeAfterPause)", 0);
41                 endTest();
42             }
43         </script>
44      </head>
45     <body onload="test()">
46         <p>Test that pausing the media element has an immediate effect on the clock.</p>
47         <video controls></video>
48     </body>
49 </html>
50