summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/gamepad/events-manual.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/gamepad/events-manual.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/gamepad/events-manual.html')
-rw-r--r--testing/web-platform/tests/gamepad/events-manual.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/web-platform/tests/gamepad/events-manual.html b/testing/web-platform/tests/gamepad/events-manual.html
new file mode 100644
index 000000000..321c9b2b0
--- /dev/null
+++ b/testing/web-platform/tests/gamepad/events-manual.html
@@ -0,0 +1,34 @@
+<!doctype html>
+<html>
+<head>
+<title>Manual Gamepad events tests</title>
+<link rel="help" href="https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#the-gamepadconnected-event">
+<link rel="help" href="https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#the-gamepaddisconnected-event">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+setup({explicit_timeout: true});
+
+function set_instructions(text) {
+ document.getElementById("instructions").textContent = text;
+}
+
+var index = -1;
+addEventListener("gamepadconnected", function (e) {
+ assert_equals(index, -1, "Too many connected events?");
+ assert_class_string(e, "GamepadEvent");
+ assert_class_string(e.gamepad, "Gamepad");
+ index = e.gamepad.index;
+ set_instructions("Found a gamepad. Now disconnect the gamepad.");
+});
+addEventListener("gamepaddisconnected", function (e) {
+ assert_class_string(e, "GamepadEvent");
+ assert_equals(e.gamepad.index, index);
+ done();
+});
+</script>
+</head>
+<body>
+<p id="instructions">This test requires a gamepad. Connect one and press any button to start the test.</p>
+</body>
+</html>