diff --git a/dom/tests/mochitest/gamepad/mock_gamepad.js b/dom/tests/mochitest/gamepad/mock_gamepad.js index a8832a31a8ac..a246604242e5 100644 --- a/dom/tests/mochitest/gamepad/mock_gamepad.js +++ b/dom/tests/mochitest/gamepad/mock_gamepad.js @@ -3,11 +3,10 @@ var GamepadService; -GamepadService = SpecialPowers.Cc["@mozilla.org/gamepad-test;1"].getService(SpecialPowers.Ci.nsIGamepadServiceTest); - - -var addGamepad = function(name, mapping, buttons, axes) { - return new Promise((resolve, reject) => { - resolve(GamepadService.addGamepad(name, mapping, buttons, axes)); - }); -} +function runGamepadTest (callback) { + SpecialPowers.pushPrefEnv({"set" : [["dom.gamepad.test.enabled", true]]}, + () => { + GamepadService = navigator.requestGamepadServiceTest(); + callback(); + }); +} \ No newline at end of file diff --git a/dom/tests/mochitest/gamepad/test_check_timestamp.html b/dom/tests/mochitest/gamepad/test_check_timestamp.html index d54e1d29c4b9..fa167d57b8e5 100644 --- a/dom/tests/mochitest/gamepad/test_check_timestamp.html +++ b/dom/tests/mochitest/gamepad/test_check_timestamp.html @@ -10,25 +10,31 @@