Bug 1282874 - Move addEventListener into the first callback in test_gamepad_connect_events.html. r=qDot
authorChih-Yi Leu <cleu@mozilla.com>
Wed, 27 Jul 2016 01:20:00 -0400
changeset 347017 bcb2a29ee460a790e11ee9178dd62ceddf7f79fe
parent 347016 5f98e30cc66ebe5b5e3aaf4071d8c69e85a4ae91
child 347018 5484e1694dc559510ff4679890b08a59eb78bad9
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqDot
bugs1282874
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1282874 - Move addEventListener into the first callback in test_gamepad_connect_events.html. r=qDot
dom/tests/mochitest/gamepad/test_gamepad_connect_events.html
--- a/dom/tests/mochitest/gamepad/test_gamepad_connect_events.html
+++ b/dom/tests/mochitest/gamepad/test_gamepad_connect_events.html
@@ -19,36 +19,36 @@ var gamepad_index;
 
 function pressButton() {
   GamepadService.newButtonEvent(gamepad_index, 0, true);
   GamepadService.newButtonEvent(gamepad_index, 0, false);
 }
 
  // Add a gamepad
 function startTests() {
-   GamepadService.addGamepad("test gamepad", // id
-                             GamepadService.standardMapping,
-                             4, // buttons
-                             2).then(function(i) {
-                               gamepad_index = i;
-                               gamepad_connected()
-                             });
+  window.addEventListener("gamepadbuttondown", function() {
+    // Wait to ensure that all frames received the button press as well.
+    SpecialPowers.executeSoon(tests[testNum++]);
+  });
+
+  GamepadService.addGamepad("test gamepad", // id
+                            GamepadService.standardMapping,
+                            4, // buttons
+                            2).then(function(i) {
+                              gamepad_index = i;
+                              gamepad_connected()
+                            });
 }
 
 var f1, f2;
 function gamepad_connected() {
   f1 = document.getElementById('f1');
   pressButton();
 }
 
-window.addEventListener("gamepadbuttondown", function() {
-  // Wait to ensure that all frames received the button press as well.
-  SpecialPowers.executeSoon(tests[testNum++]);
-});
-
 var testNum = 0;
 var tests = [
   test1,
   test2,
 ];
 
 function test1() {
   is(f1.contentWindow.connectedEvents, 1, "right number of connection events in frame 1");