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 mozNoDynamicControls
></video>
18 <script class=
"testbody" type=
"text/javascript">
20 function runTest(event) {
21 ok(true,
"----- test #" + testnum +
" -----");
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, { });
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, { });
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);
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);
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");
72 throw
"unexpected test #" + testnum +
" w/ event " + event.type;
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();