Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / video-pause-immediately.html
bloba519784f9e93d96e8fcbaa381ec2ed7cf121416e
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;
9 function test()
11 findMediaElement();
12 video.src = findMediaFile("video", "content/test");
13 waitForEvent("canplay", canplay);
14 waitForEvent("playing", playing);
15 waitForEvent("pause", pause);
18 function canplay()
20 video.play();
23 function playing()
25 video.addEventListener("timeupdate", timeupdate);
28 function timeupdate()
30 if (video.currentTime > 0) {
31 video.removeEventListener("timeupdate", timeupdate);
32 video.pause();
33 timeAfterPause = video.currentTime;
37 function pause()
39 testExpected("(video.currentTime - timeAfterPause)", 0);
40 testExpected("(video.played.end(0) - timeAfterPause)", 0);
41 endTest();
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>