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
|
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<!DOCTYPE HTML>
<html>
<head>
<title>Test gamepad</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script type="text/javascript" src="mock_gamepad.js"></script>
<script class="testbody" type="text/javascript">
const { is, ok, SimpleTest, SpecialPowers } = window.parent;
window.addEventListener("gamepadconnected", () => {
ok(false, "gamepadconnected event must not fire");
});
window.addEventListener("gamepaddisconnected", () => {
ok(false, "gamepaddisconnected event must not fire");
});
runGamepadTest(async ()=> {
// Add a gamepad - normally would cause "gamepadconnected" to fire
const index = await GamepadService.addGamepad("test gamepad", // id
GamepadService.standardMapping,
GamepadService.noHand,
4,
2,
0,
0,
0
);
is(navigator.getGamepads().length, 0, "Expected 0 gamepads in insecure context");
await GamepadService.removeGamepad(index);
SimpleTest.finish();
});
</script>
</body>
</html>
|