Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / content / media / video / test / test_seek1.html
blob4ffe719a1d2a265b48b10f7500f011768ee57c84
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>Media test: seek test 1</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 onended='return playbackEnded();'
13 onloadedmetadata='return startTest();'
14 onseeking='return seekStarted();'
15 onseeked='return seekEnded();'></video>
16 <pre id="test">
17 <script class="testbody" type="text/javascript">
18 var startPassed = false;
19 var endPassed = false;
20 var seekFlagStart = false;
21 var seekFlagEnd = false;
22 var readonly = true;
23 var completed = false;
25 var v = document.getElementById('v');
26 ok(!v.seeking, "seeking should default to false");
27 try {
28 v.seeking = 1;
29 readonly = false;
31 catch(e) {
32 readonly = true;
34 ok(readonly, "seeking should be readonly");
36 function startTest() {
37 if (completed)
38 return false;
39 var v = document.getElementById('v');
40 v.play();
41 v.currentTime=2;
42 return false;
45 function seekStarted() {
46 if (completed)
47 return false;
49 var v = document.getElementById('v');
50 v.pause();
51 startPassed = true;
52 seekFlagStart = v.seeking;
53 return false;
56 function seekEnded() {
57 if (completed)
58 return false;
60 var v = document.getElementById('v');
61 var t = v.currentTime;
62 ok(t >= 2 && t <= 3, "Video currentTime should be around 2: " + t);
63 v.play();
64 endPassed = true;
65 seekFlagEnd = v.seeking;
66 return false;
69 function playbackEnded() {
70 if (completed)
71 return false;
73 completed = true;
74 ok(startPassed, "seeking event");
75 ok(endPassed, "seeked event");
76 ok(seekFlagStart, "seeking flag on start should be true");
77 ok(!seekFlagEnd, "seeking flag on end should be false");
78 SimpleTest.finish();
79 return false;
82 SimpleTest.waitForExplicitFinish();
83 </script>
84 </pre>
85 </body>
86 </html>