Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / gamepad / gamepad-events-basic.html
blob869f991195522f17bd0ebeb3a7f9dae37fcf07ec
1 <!DOCTYPE html>
2 <body>
3 <script src="../resources/js-test.js"></script>
4 <script>
5 description("Basic test for 'gamepadconnected' and 'gamepaddisconnected' events.");
7 jsTestIsAsync = true;
9 if (window.gamepadController)
11 function onConnected(event) {
12 debug("Gamepad connected");
13 shouldBe("event.__proto__", "GamepadEvent.prototype");
14 shouldBe("event.__proto__.__proto__", "Event.prototype");
15 shouldBeEqualToString("event.gamepad.id", "MockStick 3000");
16 shouldBe("event.gamepad.buttons.length", "3");
17 shouldBe("event.gamepad.axes.length", "3");
18 shouldBe("event.gamepad.buttons[0].value", "1.0");
19 shouldBeTrue("event.gamepad.buttons[0].pressed");
20 shouldBe("event.gamepad.buttons[1].value", "0.0");
21 shouldBeFalse("event.gamepad.buttons[1].pressed");
22 shouldBe("event.gamepad.axes.length", "3");
23 shouldBe("event.gamepad.buttons[2].value", "0.333333");
24 shouldBeTrue("event.gamepad.buttons[2].pressed");
25 shouldBe("event.gamepad.axes[0]", "0.5");
26 shouldBe("event.gamepad.axes[1]", "-1.0");
27 shouldBe("event.gamepad.axes[2]", "0.333333");
28 gamepadController.disconnect(0);
31 function onDisconnected(event) {
32 debug("Gamepad disconnected");
33 shouldBe("event.__proto__", "GamepadEvent.prototype");
34 shouldBe("event.__proto__.__proto__", "Event.prototype");
35 shouldBeEqualToString("event.gamepad.id", "MockStick 3000");
36 shouldBe("event.gamepad.buttons.length", "3");
37 shouldBe("event.gamepad.axes.length", "3");
38 finishJSTest();
41 window.addEventListener('gamepadconnected', onConnected);
42 window.addEventListener('gamepaddisconnected', onDisconnected);
44 gamepadController.connect(0);
45 gamepadController.setId(0, "MockStick 3000");
46 gamepadController.setButtonCount(0, 3);
47 gamepadController.setAxisCount(0, 3);
48 gamepadController.setButtonData(0, 0, 1);
49 gamepadController.setButtonData(0, 1, 0);
50 gamepadController.setButtonData(0, 2, 0.333333);
51 gamepadController.setAxisData(0, 0, .5);
52 gamepadController.setAxisData(0, 1, -1.0);
53 gamepadController.setAxisData(0, 2, 0.333333);
54 gamepadController.dispatchConnected(0);
56 else
58 testFailed("no gamepadController available.");
60 </script>
61 </body>