| <!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> |