Index: LayoutTests/gamepad/multiple-event-listeners.html |
diff --git a/LayoutTests/gamepad/multiple-event-listeners.html b/LayoutTests/gamepad/multiple-event-listeners.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a7f9b78f7199bfefab1138b77de405b364e63538 |
--- /dev/null |
+++ b/LayoutTests/gamepad/multiple-event-listeners.html |
@@ -0,0 +1,31 @@ |
+<!DOCTYPE html> |
+<html> |
+<body> |
+<script src="../resources/js-test.js"></script> |
+<script> |
+description("Test that when there are multiple gamepad event listeners and one is getting removed the others still receive events."); |
+window.jsTestIsAsync = true; |
+ |
+if (!window.gamepadController) { |
+ debug("This test cannot work without gamepadController."); |
+} |
+ |
+var listenerToRemove = window.addEventListener('gamepadconnected', function() {}); |
+window.addEventListener('gamepadconnected', function() { |
+ testPassed("gamepadconnected event received"); |
+ finishJSTest(); |
+}); |
+window.removeEventListener('gamepadconnected', listenerToRemove); |
+ |
+setTimeout(function() { |
+ testFailed("gamepadconnected event should have been recieved."); |
+ finishJSTest(); |
+}, 50); |
+ |
+if (gamepadController) { |
+ gamepadController.connect(0); |
+ gamepadController.dispatchConnected(0); |
+} |
+ |
+</script> |
+</html> |