| <html> |
| <head> |
| <title>Test pause() pauses the clock immediately</title> |
| <script src=media-file.js></script> |
| <script src=video-test.js></script> |
| <script> |
| var timeAfterPause; |
| |
| function test() |
| { |
| findMediaElement(); |
| video.src = findMediaFile("video", "content/test"); |
| waitForEvent("canplay", canplay); |
| waitForEvent("playing", playing); |
| waitForEvent("pause", pause); |
| } |
| |
| function canplay() |
| { |
| video.play(); |
| } |
| |
| function playing() |
| { |
| video.addEventListener("timeupdate", timeupdate); |
| } |
| |
| function timeupdate() |
| { |
| if (video.currentTime > 0) { |
| video.removeEventListener("timeupdate", timeupdate); |
| video.pause(); |
| timeAfterPause = video.currentTime; |
| } |
| } |
| |
| function pause() |
| { |
| testExpected("(video.currentTime - timeAfterPause)", 0.0001, "<"); |
| testExpected("(video.played.end(0) - timeAfterPause)", 0.0001, "<"); |
| endTest(); |
| } |
| </script> |
| </head> |
| <body onload="test()"> |
| <p>Test that pausing the media element has an immediate effect on the clock.</p> |
| <video controls></video> |
| </body> |
| </html> |
| |