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

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: Created 6 years 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
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.webkitGetGamepads"); 7 shouldBeDefined("navigator.webkitGetGamepads");
8 shouldBeDefined("navigator.getGamepads"); 8 shouldBeDefined("navigator.getGamepads");
9 shouldBeDefined("GamepadEvent"); 9 shouldBeDefined("GamepadEvent");
10 10
11 webkitGamepads = navigator.webkitGetGamepads(); 11 webkitGamepads = navigator.webkitGetGamepads();
12 shouldBe("webkitGamepads.length", "4"); 12 shouldBe("webkitGamepads.length", "4");
13 shouldBeUndefined("webkitGamepads[0]"); 13 shouldBeUndefined("webkitGamepads[0]");
14 shouldBe("webkitGamepads.item.__proto__", "Function.prototype") 14 shouldBe("webkitGamepads.item.__proto__", "Function.prototype")
15 shouldBeNull("webkitGamepads.item(0)"); 15 shouldBeNull("webkitGamepads.item(0)");
16 16
17 gamepads = navigator.getGamepads(); 17 gamepads = navigator.getGamepads();
18 shouldBe("gamepads.length", "4"); 18 shouldBeType("gamepads", "Array");
19 shouldBeUndefined("gamepads[0]"); 19 shouldBe("gamepads.length", "0");
20 shouldBe("gamepads.item.__proto__", "Function.prototype") 20
21 shouldBeNull("gamepads.item(0)"); 21 // A new Array object must be returned every time.
22 shouldBeFalse("navigator.getGamepads() === navigator.getGamepads()");
22 23
23 if (window.gamepadController) 24 if (window.gamepadController)
24 { 25 {
25 gamepadController.connect(0); 26 gamepadController.connect(0);
26 gamepadController.setId(0, "MockStick 3000"); 27 gamepadController.setId(0, "MockStick 3000");
27 gamepadController.setButtonCount(0, 1); 28 gamepadController.setButtonCount(0, 1);
28 gamepadController.setAxisCount(0, 1); 29 gamepadController.setAxisCount(0, 1);
29 30
30 function checkProperties(isPrefixed) { 31 function checkProperties(isPrefixed) {
31 shouldBe("gamepad.id.__proto__", "String.prototype"); 32 shouldBe("gamepad.id.__proto__", "String.prototype");
(...skipping 26 matching lines...) Expand all
58 shouldBeTrue("gamepad.connected"); 59 shouldBeTrue("gamepad.connected");
59 shouldBe("gamepad.__proto__", "Gamepad.prototype"); 60 shouldBe("gamepad.__proto__", "Gamepad.prototype");
60 checkProperties(false); 61 checkProperties(false);
61 } 62 }
62 else 63 else
63 { 64 {
64 testFailed("no gamepadController available."); 65 testFailed("no gamepadController available.");
65 } 66 }
66 </script> 67 </script>
67 </body> 68 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/gamepad/gamepad-api-expected.txt » ('j') | Source/modules/gamepad/NavigatorGamepad.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698