Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / content / media / video / test / test_onloadedmetadata.html
blob758e9250d55d61b5e5fb8f4bbc89348512d815be
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=467972
5 -->
6 <head>
7 <title>Test for Bug 467972</title>
8 <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=467972">Mozilla Bug 467972</a>
15 <video id="v"
16 src="320x240.ogg"
17 onloadedmetadata="return loadedMetaData();"
18 onended="playbackEnded();"
19 onloadeddata="return loadedData();"
20 onseeking="seekStarted();"
21 onseeked="seekEnded();"
22 controls></video>
24 <p id="display"></p>
25 <div id="content" style="display: none">
27 </div>
28 <pre id="test">
29 <script type="application/javascript">
31 /** Test for Bug 467972 **/
34 var gEnded = false;
35 var gSeekStarted = false;
36 var gSeekEnded = false;
37 var gLoadedDataCount = 0;
38 var gLoadedMetaDataCount = 0;
40 function get(id) {
41 return document.getElementById(id);
44 function video() {
45 return get('v');
48 function seekStarted() {
49 gSeekStarted = true;
52 function seekEnded() {
53 gSeekEnded = true;
54 video().play();
57 function loadedData() {
58 gLoadedDataCount++;
59 ok(gLoadedDataCount <= 1, "No more than 1 onloaddata events");
62 function loadedMetaData() {
63 gLoadedMetaDataCount++;
64 ok(gLoadedMetaDataCount <= 1, "No more than 1 onloadedmetadata events");
65 video().play();
66 return false;
69 function playbackEnded() {
70 if (!gEnded) {
71 video().currentTime = 0;
72 gEnded = true;
73 } else {
74 ok(gSeekEnded, "Should have received seekended");
75 ok(gSeekStarted, "Should have received seekstarted");
76 is(gLoadedDataCount, 1, "Should have 1 onloadeddata event");
77 is(gLoadedMetaDataCount, 1, "Should have 1 onloadedmetadata event");
78 SimpleTest.finish();
80 return false;
83 SimpleTest.waitForExplicitFinish();
85 </script>
86 </pre>
87 </body>
88 </html>