Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: LayoutTests/gamepad/gamepad-api.html

Issue 808643005: Sync Navigator.getGamepads() with the spec Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/gamepad/gamepad-api-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <body> 2 <body>
3 <script src="../resources/js-test.js"></script> 3 <script src="../resources/js-test.js"></script>
4 <script> 4 <script>
5 description("Validates the exposed Gamepad API.") 5 description("Validates the exposed Gamepad API.")
6 6
7 shouldBeDefined("navigator.getGamepads"); 7 shouldBeDefined("navigator.getGamepads");
8 shouldBeDefined("GamepadEvent"); 8 shouldBeDefined("GamepadEvent");
9 9
10 gamepads = navigator.getGamepads(); 10 gamepads = navigator.getGamepads();
11 shouldBe("gamepads.length", "4"); 11 shouldBeType("gamepads", "Array");
12 shouldBeUndefined("gamepads[0]"); 12 shouldBe("gamepads.length", "0");
13 shouldBe("gamepads.item.__proto__", "Function.prototype") 13
14 shouldBeNull("gamepads.item(0)"); 14 // A new Array object must be returned every time.
15 shouldBeFalse("navigator.getGamepads() === navigator.getGamepads()");
15 16
16 if (window.gamepadController) 17 if (window.gamepadController)
17 { 18 {
18 gamepadController.connect(0); 19 gamepadController.connect(0);
19 gamepadController.setId(0, "MockStick 3000"); 20 gamepadController.setId(0, "MockStick 3000");
20 gamepadController.setButtonCount(0, 1); 21 gamepadController.setButtonCount(0, 1);
21 gamepadController.setAxisCount(0, 1); 22 gamepadController.setAxisCount(0, 1);
22 23
23 gamepad = navigator.getGamepads()[0]; 24 gamepad = navigator.getGamepads()[0];
24 shouldBeNonNull("gamepad"); 25 shouldBeNonNull("gamepad");
25 shouldBeTrue("gamepad.connected"); 26 shouldBeTrue("gamepad.connected");
26 shouldBe("gamepad.__proto__", "Gamepad.prototype"); 27 shouldBe("gamepad.__proto__", "Gamepad.prototype");
27 shouldBe("gamepad.id.__proto__", "String.prototype"); 28 shouldBe("gamepad.id.__proto__", "String.prototype");
28 shouldBe("gamepad.connected.__proto__", "Boolean.prototype"); 29 shouldBe("gamepad.connected.__proto__", "Boolean.prototype");
29 shouldBe("gamepad.index.__proto__", "Number.prototype"); 30 shouldBe("gamepad.index.__proto__", "Number.prototype");
30 shouldBe("gamepad.timestamp.__proto__", "Number.prototype"); 31 shouldBe("gamepad.timestamp.__proto__", "Number.prototype");
31 shouldBe("gamepad.axes.__proto__", "Array.prototype"); 32 shouldBe("gamepad.axes.__proto__", "Array.prototype");
32 shouldBe("gamepad.axes[0].__proto__", "Number.prototype"); 33 shouldBe("gamepad.axes[0].__proto__", "Number.prototype");
33 shouldBe("gamepad.buttons.__proto__", "Array.prototype"); 34 shouldBe("gamepad.buttons.__proto__", "Array.prototype");
34 shouldBe("gamepad.buttons[0].pressed.__proto__", "Boolean.prototype"); 35 shouldBe("gamepad.buttons[0].pressed.__proto__", "Boolean.prototype");
35 shouldBe("gamepad.buttons[0].value.__proto__", "Number.prototype"); 36 shouldBe("gamepad.buttons[0].value.__proto__", "Number.prototype");
36 shouldBe("gamepad.mapping.__proto__", "String.prototype"); 37 shouldBe("gamepad.mapping.__proto__", "String.prototype");
37 } 38 }
38 else 39 else
39 { 40 {
40 testFailed("no gamepadController available."); 41 testFailed("no gamepadController available.");
41 } 42 }
42 </script> 43 </script>
43 </body> 44 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/gamepad/gamepad-api-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698