Bug 461680 - Improve video control fade in/out animation. r=enn
[wine-gecko.git] / toolkit / content / tests / widgets / test_videocontrols.html
blobd78a392d00e20894d844b612dd971deb2436b1c9
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>Video controls test</title>
5 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
6 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
7 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
9 </head>
10 <body>
11 <p id="display"></p>
13 <div id="content">
14 <video width="320" height="240" id="video" src="video.ogg" controls mozNoDynamicControls></video>
15 </div>
17 <pre id="test">
18 <script class="testbody" type="text/javascript">
20 function runTest(event) {
21 ok(true, "----- test #" + testnum + " -----");
23 switch (testnum) {
24 case 1:
25 // Check initial state upon load
26 is(event.type, "loadeddata", "checking event type");
27 is(video.paused, true, "checking video play state");
28 is(video.muted, false, "checking video mute state");
30 // Click the play button
31 synthesizeMouse(video, 12, 228, { });
32 break;
34 case 2:
35 is(event.type, "play", "checking event type");
36 is(video.paused, false, "checking video play state");
37 is(video.muted, false, "checking video mute state");
39 // Click the pause button
40 synthesizeMouse(video, 12, 228, { });
41 break;
43 case 3:
44 is(event.type, "pause", "checking event type");
45 is(video.paused, true, "checking video play state");
46 is(video.muted, false, "checking video mute state");
48 // Click the mute button
49 // XXX volume event is sent synchronously, so do this in a timeout
50 setTimeout("synthesizeMouse(video, 308, 228, { });", 0);
51 break;
53 case 4:
54 is(event.type, "volumechange", "checking event type");
55 is(video.paused, true, "checking video play state");
56 is(video.muted, true, "checking video mute state");
58 // Click the unmute button
59 // XXX volume event is sent synchronously, so do this in a timeout
60 setTimeout("synthesizeMouse(video, 308, 228, { });", 0);
61 break;
63 case 5:
64 is(event.type, "volumechange", "checking event type");
65 is(video.paused, true, "checking video play state");
66 is(video.muted, false, "checking video mute state");
68 SimpleTest.finish();
69 break;
71 default:
72 throw "unexpected test #" + testnum + " w/ event " + event.type;
75 testnum++;
78 var testnum = 1;
79 var video = document.getElementById("video");
81 // Kick off test once we've got enough to do something.
82 video.addEventListener("loadeddata", runTest, false);
84 // Other events expected by the test.
85 video.addEventListener("play", runTest, false);
86 video.addEventListener("pause", runTest, false);
87 video.addEventListener("volumechange", runTest, false);
89 SimpleTest.waitForExplicitFinish();
91 </script>
92 </pre>
93 </body>
94 </html>