Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / content / media / video / test / test_ended2.html
blobfb55f2e71e36fd61fcf8ab1c1fab2f41e0860e22
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>Media test: ended and replaying</title>
5 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
6 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
8 </head>
9 <body>
10 <video id='v'
11 src='seek.ogg'
12 onloadedmetadata='return startTest();'
13 onplay='return playbackStarted();'
14 onended='return playbackEnded();'></video>
15 <pre id="test">
16 <script class="testbody" type="text/javascript">
17 // Test if video can be replayed after ended.
18 var v = document.getElementById('v');
19 var completed = false;
20 var playCount = 0;
22 function startTest() {
23 if (completed)
24 return false;
26 v.play();
27 return false;
30 function playbackStarted() {
31 if (completed)
32 return false;
34 playCount++;
37 function playbackEnded() {
38 if (completed)
39 return false
41 ok(v.currentTime >= 3.9 && v.currentTime <= 4.0,
42 "Checking currentTime at end: " + v.currentTime);
43 ok(v.ended, "Checking playback has ended");
44 if (playCount < 2) {
45 v.play();
47 else {
48 ok(playCount == 2, "Check playback after ended event");
49 completed = true;
50 SimpleTest.finish();
52 return false;
55 SimpleTest.waitForExplicitFinish();
56 </script>
57 </pre>
58 </body>
59 </html>