1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
<!DOCTYPE HTML>
<html>
<head>
<title>Audio controls test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="head.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content">
<audio id="audio" controls preload="auto"></audio>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
const audio = document.getElementById("audio");
const controlBar = getElementWithinVideo(audio, "controlBar");
add_setup(async function setup() {
await new Promise(resolve => {
audio.addEventListener("loadedmetadata", resolve, {once: true});
audio.src = "audio.wav";
});
});
add_task(async function test_double_click_does_not_fullscreen() {
SimpleTest.requestCompleteLog();
SimpleTest.requestFlakyTimeout("Waiting to ensure that fullscreen event does not fire");
const { x, y } = audio.getBoundingClientRect();
const endedPromise = new Promise(resolve => {
audio.addEventListener("ended", () => {
info('Audio ended event fired!');
resolve();
}, { once: true });
setTimeout( () => {
info('Audio ran out of time before ended event fired!');
resolve();
}, audio.duration * 1000);
});
let noFullscreenEvent = true;
document.addEventListener("mozfullscreenchange", () => {
noFullscreenEvent = false;
}, { once: true });
info("Simulate double click on media player.");
synthesizeMouse(audio, x, y, { clickCount: 2 });
info("Waiting for video to end...");
await endedPromise;
// By this point, if the double click was going to trigger fullscreen then
// it should have happened by now.
ok(
noFullscreenEvent,
"Double clicking should not trigger fullscreen event"
);
});
</script>
</pre>
</body>
</html>
|