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

Unified Diff: LayoutTests/gamepad/gamepad-polling-access.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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/gamepad/gamepad-polling-access.html
diff --git a/LayoutTests/gamepad/gamepad-polling-access.html b/LayoutTests/gamepad/gamepad-polling-access.html
index 9bc59a50000bf0ea0e608d7e1eaaa4d61e4238d7..a156b9a545d1c888c93a5d28c6422cfa7ccf4782 100644
--- a/LayoutTests/gamepad/gamepad-polling-access.html
+++ b/LayoutTests/gamepad/gamepad-polling-access.html
@@ -9,22 +9,38 @@
gamepadController.disconnect(1);
gamepadController.disconnect(2);
gamepadController.disconnect(3);
- shouldBe("navigator.getGamepads().length", "4");
- shouldBeNull("navigator.getGamepads().item(0)");
- shouldBeNull("navigator.getGamepads().item(1)");
- shouldBeNull("navigator.getGamepads().item(2)");
- shouldBeNull("navigator.getGamepads().item(3)");
- shouldBeUndefined("navigator.getGamepads()[0]");
- shouldBeUndefined("navigator.getGamepads()[1]");
- shouldBeUndefined("navigator.getGamepads()[2]");
- shouldBeUndefined("navigator.getGamepads()[3]");
+
+ shouldBeType("navigator.getGamepads()", "Array");
+ shouldBe("navigator.getGamepads().length", "0");
+ shouldBeFalse("navigator.getGamepads().hasOwnProperty(0)");
+ shouldBeFalse("navigator.getGamepads().hasOwnProperty(1)");
// connect and disconnect
gamepadController.connect(0);
- shouldBeNonNull("navigator.getGamepads()[0]");
+ shouldBe("navigator.getGamepads().length", "1");
+ shouldBeTrue("navigator.getGamepads().hasOwnProperty(0)");
+ shouldBeType("navigator.getGamepads()[0]", "Gamepad");
+ shouldBe("navigator.getGamepads()[0].index", "0");
+ shouldBeFalse("navigator.getGamepads().hasOwnProperty(1)");
+ gamepadController.connect(1);
+ shouldBe("navigator.getGamepads().length", "2");
+ shouldBeTrue("navigator.getGamepads().hasOwnProperty(0)");
+ shouldBeType("navigator.getGamepads()[0]", "Gamepad");
+ shouldBe("navigator.getGamepads()[0].index", "0");
+ shouldBeTrue("navigator.getGamepads().hasOwnProperty(1)");
+ shouldBeType("navigator.getGamepads()[1]", "Gamepad");
+ shouldBe("navigator.getGamepads()[1].index", "1");
gamepadController.disconnect(0);
- shouldBeNull("navigator.getGamepads().item(0)");
- shouldBeUndefined("navigator.getGamepads()[0]");
+ shouldBe("navigator.getGamepads().length", "2");
+ shouldBeTrue("navigator.getGamepads().hasOwnProperty(0)"); // FIXME
+ shouldBeNull("navigator.getGamepads()[0]"); // FIXME
+ shouldBeTrue("navigator.getGamepads().hasOwnProperty(1)");
+ shouldBeType("navigator.getGamepads()[1]", "Gamepad");
+ shouldBe("navigator.getGamepads()[1].index", "1");
+ gamepadController.disconnect(1);
+ shouldBe("navigator.getGamepads().length", "0");
+ shouldBeFalse("navigator.getGamepads().hasOwnProperty(0)");
+ shouldBeFalse("navigator.getGamepads().hasOwnProperty(1)");
// connect again, and check standard access
gamepadController.connect(0);
« no previous file with comments | « LayoutTests/gamepad/gamepad-api-expected.txt ('k') | LayoutTests/gamepad/gamepad-polling-access-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698