blob: 5ec141ec82d93c5996fcc37018e3f31ebec64ca5 [file] [log] [blame]
Ted Mielczarek634cdba2014-12-11 14:23:301<!doctype html>
2<html>
3<head>
4<title>Gamepad IDL tests</title>
5<link rel="help" href="https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#gamepad-interface">
6<link rel="help" href="https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#gamepadbutton-interface">
7<link rel="help" href="https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#gamepadevent-interface">
8<link rel="help" href="https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension">
9<script src="/resources/testharness.js"></script>
10<script src="/resources/testharnessreport.js"></script>
11<script src="/resources/WebIDLParser.js"></script>
12<script src="/resources/idlharness.js"></script>
13</head>
14<body>
15<pre id="untested_idl" style="display: none">
16interface Navigator {
17};
18
19interface Event {
20};
21</pre>
22<pre id="idl" style="display: none">
23interface Gamepad {
24 readonly attribute DOMString id;
25 readonly attribute long index;
26 readonly attribute boolean connected;
27 readonly attribute DOMHighResTimeStamp timestamp;
28 readonly attribute GamepadMappingType mapping;
29 readonly attribute double[] axes;
30 readonly attribute GamepadButton[] buttons;
31};
32
33enum GamepadMappingType {
34 "",
35 "standard"
36};
37
38interface GamepadButton {
39 readonly attribute boolean pressed;
40 readonly attribute double value;
41};
42
43[Constructor(DOMString type, optional GamepadEventInit eventInitDict)]
44interface GamepadEvent : Event
45{
46 readonly attribute Gamepad? gamepad;
47};
48
49dictionary GamepadEventInit : EventInit
50{
51 Gamepad? gamepad = null;
52};
53
54partial interface Navigator {
55 Gamepad[] getGamepads();
56};
57</pre>
58<script>
59var idl_array = new IdlArray();
60idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
61idl_array.add_idls(document.getElementById("idl").textContent);
62idl_array.add_objects({
63 GamepadEvent: [new GamepadEvent("something")],
64 Navigator: ["navigator"],
65 });
66idl_array.test();
67</script>
68<div id="log"></div>
69</body>
70</html>