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

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

Issue 806993002: Removed deprecated navigator.webkitGetGamepads. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missed one layout test expectations update 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
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");
8 shouldBeDefined("navigator.getGamepads"); 7 shouldBeDefined("navigator.getGamepads");
9 shouldBeDefined("GamepadEvent"); 8 shouldBeDefined("GamepadEvent");
10 9
11 webkitGamepads = navigator.webkitGetGamepads();
12 shouldBe("webkitGamepads.length", "4");
13 shouldBeUndefined("webkitGamepads[0]");
14 shouldBe("webkitGamepads.item.__proto__", "Function.prototype")
15 shouldBeNull("webkitGamepads.item(0)");
16
17 gamepads = navigator.getGamepads(); 10 gamepads = navigator.getGamepads();
18 shouldBe("gamepads.length", "4"); 11 shouldBe("gamepads.length", "4");
19 shouldBeUndefined("gamepads[0]"); 12 shouldBeUndefined("gamepads[0]");
20 shouldBe("gamepads.item.__proto__", "Function.prototype") 13 shouldBe("gamepads.item.__proto__", "Function.prototype")
21 shouldBeNull("gamepads.item(0)"); 14 shouldBeNull("gamepads.item(0)");
22 15
23 if (window.gamepadController) 16 if (window.gamepadController)
24 { 17 {
25 gamepadController.connect(0); 18 gamepadController.connect(0);
26 gamepadController.setId(0, "MockStick 3000"); 19 gamepadController.setId(0, "MockStick 3000");
27 gamepadController.setButtonCount(0, 1); 20 gamepadController.setButtonCount(0, 1);
28 gamepadController.setAxisCount(0, 1); 21 gamepadController.setAxisCount(0, 1);
29 22
30 function checkProperties(isPrefixed) {
31 shouldBe("gamepad.id.__proto__", "String.prototype");
32 shouldBe("gamepad.connected.__proto__", "Boolean.prototype");
33 shouldBe("gamepad.index.__proto__", "Number.prototype");
34 shouldBe("gamepad.timestamp.__proto__", "Number.prototype");
35 shouldBe("gamepad.axes.__proto__", "Array.prototype");
36 shouldBe("gamepad.axes[0].__proto__", "Number.prototype");
37
38 shouldBe("gamepad.buttons.__proto__", "Array.prototype");
39 if (isPrefixed) {
40 shouldBe("gamepad.buttons[0].__proto__", "Number.prototype");
41 } else {
42 shouldBe("gamepad.buttons[0].pressed.__proto__", "Boolean.protot ype");
43 shouldBe("gamepad.buttons[0].value.__proto__", "Number.prototype ");
44 }
45
46 if (!isPrefixed)
47 shouldBe("gamepad.mapping.__proto__", "String.prototype");
48 }
49
50 gamepad = navigator.webkitGetGamepads()[0];
51 shouldBeNonNull("gamepad");
52 shouldBeTrue("gamepad.connected");
53 shouldBe("gamepad.__proto__", "WebKitGamepad.prototype");
54 checkProperties(true);
55
56 gamepad = navigator.getGamepads()[0]; 23 gamepad = navigator.getGamepads()[0];
57 shouldBeNonNull("gamepad"); 24 shouldBeNonNull("gamepad");
58 shouldBeTrue("gamepad.connected"); 25 shouldBeTrue("gamepad.connected");
59 shouldBe("gamepad.__proto__", "Gamepad.prototype"); 26 shouldBe("gamepad.__proto__", "Gamepad.prototype");
60 checkProperties(false); 27 shouldBe("gamepad.id.__proto__", "String.prototype");
28 shouldBe("gamepad.connected.__proto__", "Boolean.prototype");
29 shouldBe("gamepad.index.__proto__", "Number.prototype");
30 shouldBe("gamepad.timestamp.__proto__", "Number.prototype");
31 shouldBe("gamepad.axes.__proto__", "Array.prototype");
32 shouldBe("gamepad.axes[0].__proto__", "Number.prototype");
33 shouldBe("gamepad.buttons.__proto__", "Array.prototype");
34 shouldBe("gamepad.buttons[0].pressed.__proto__", "Boolean.prototype");
35 shouldBe("gamepad.buttons[0].value.__proto__", "Number.prototype");
36 shouldBe("gamepad.mapping.__proto__", "String.prototype");
61 } 37 }
62 else 38 else
63 { 39 {
64 testFailed("no gamepadController available."); 40 testFailed("no gamepadController available.");
65 } 41 }
66 </script> 42 </script>
67 </body> 43 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698