Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / media-element-play-after-eos.html
blob67e608dfd76ee8f8c30df4b00d1f39d6d7b7582f
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 repeated = false;
8 var mediaElement = new Audio();
10 function start()
12 mediaElement.src = findMediaFile('audio', 'content/silence');
13 waitForEvent("loadedmetadata", mediaLoadedMetadata);
16 function mediaLoadedMetadata()
18 waitForEventOnce("playing", mediaPlaying);
19 waitForEvent("pause", mediaPause);
20 waitForEvent("ended", mediaEnded);
21 run("mediaElement.play()");
24 function mediaPlaying()
26 mediaElement.currentTime = mediaElement.duration - 0.2;
29 function mediaPause()
31 testExpected("mediaElement.paused", true);
34 function mediaEnded()
36 testExpected("mediaElement.ended", true);
38 if (repeated) {
39 endTest();
40 return;
43 repeated = true;
44 waitForEventOnce("playing", mediaPlaying);
45 run("mediaElement.play()");
48 </script>
49 </head>
50 <body onload="start()">
51 <p>This tests ensure that media element emits the 'playing' event every time it starts playing after eos. It also ensure that 'pause' and 'ended' events are sent when media playback ends.</p>
52 </body>
53 </html>