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" />
14 <video width=
"320" height=
"240" id=
"video" src=
"video.ogg" controls
></video>
18 <script class=
"testbody" type=
"text/javascript">
21 var video = document.getElementById(
"video");
23 function runTest(event) {
24 ok(true,
"----- test #" + testnum +
" -----");
28 // Check initial state upon load
29 is(event.type,
"load",
"checking event type");
30 is(video.paused, true,
"checking video play state");
31 is(video.muted, false,
"checking video mute state");
33 // Let the fadein happen
34 synthesizeMouse(video,
12,
228, { type :
"mouseover" });
35 setTimeout(runTest,
0, { type:
"setTimeout" });
39 is(event.type,
"setTimeout",
"checking event type");
40 // Click the play button
41 synthesizeMouse(video,
12,
228, { });
45 is(event.type,
"play",
"checking event type");
46 is(video.paused, false,
"checking video play state");
47 is(video.muted, false,
"checking video mute state");
49 // Click the pause button
50 synthesizeMouse(video,
12,
228, { });
54 is(event.type,
"pause",
"checking event type");
55 is(video.paused, true,
"checking video play state");
56 is(video.muted, false,
"checking video mute state");
58 // Click the mute button
59 // XXX volume event is sent synchronously, so do this in a timeout
60 setTimeout(
"synthesizeMouse(video, 308, 228, { });",
0);
64 is(event.type,
"volumechange",
"checking event type");
65 is(video.paused, true,
"checking video play state");
66 is(video.muted, true,
"checking video mute state");
68 // Click the unmute button
69 // XXX volume event is sent synchronously, so do this in a timeout
70 setTimeout(
"synthesizeMouse(video, 308, 228, { });",
0);
74 is(event.type,
"volumechange",
"checking event type");
75 is(video.paused, true,
"checking video play state");
76 is(video.muted, false,
"checking video mute state");
82 throw
"unexpected test #" + testnum +
" w/ event " + event.name;
88 window.onload = runTest;
89 video.addEventListener(
"play", runTest, false);
90 video.addEventListener(
"pause", runTest, false);
91 video.addEventListener(
"volumechange", runTest, false);
93 SimpleTest.waitForExplicitFinish();