Chromium Code Reviews| 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..eb567816b59f58f1707fcc313d225298f42ab769 |
| --- /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 recieves 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 recieved"); |
| + finishJSTest(); |
| +}); |
| +window.removeEventListener('gamepadconnected', listenerToRemove); |
|
timvolodine
2014/06/16 13:05:17
why is this needed? adding and removing an empty l
kbalazs
2014/06/16 17:01:47
This tests that we still honor the other listeners
|
| + |
| +setTimeout(function() { |
| + testFailed("gamepadconnected event should have been recieved."); |
| + finishJSTest(); |
| +}, 50); |
| + |
| +if (gamepadController) { |
| + gamepadController.connect(0); |
| + gamepadController.dispatchConnected(0); |
| +} |
| + |
| +</script> |
| +</html> |