diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /layout/tools/reftest/b2g_start_script.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/tools/reftest/b2g_start_script.js')
-rw-r--r-- | layout/tools/reftest/b2g_start_script.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/layout/tools/reftest/b2g_start_script.js b/layout/tools/reftest/b2g_start_script.js new file mode 100644 index 000000000..7c368412f --- /dev/null +++ b/layout/tools/reftest/b2g_start_script.js @@ -0,0 +1,57 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const { utils: Cu, classes: Cc, interfaces: Ci } = Components; + +function setPermissions() { + if (__webDriverArguments.length < 2) { + return; + } + + let serverAddr = __webDriverArguments[0]; + let serverPort = __webDriverArguments[1]; + let perms = Cc["@mozilla.org/permissionmanager;1"] + .getService(Ci.nsIPermissionManager); + let ioService = Cc["@mozilla.org/network/io-service;1"] + .getService(Ci.nsIIOService); + let uri = ioService.newURI("http://" + serverAddr + ":" + serverPort, null, null); + perms.add(uri, "allowXULXBL", Ci.nsIPermissionManager.ALLOW_ACTION); +} + +var cm = Cc["@mozilla.org/categorymanager;1"] + .getService(Ci.nsICategoryManager); + +// Disable update timers that cause b2g failures. +if (cm) { + cm.deleteCategoryEntry("update-timer", "nsUpdateService", false); +} + +// Load into any existing windows +var wm = Cc["@mozilla.org/appshell/window-mediator;1"] + .getService(Ci.nsIWindowMediator); +var win = wm.getMostRecentWindow(''); + +setPermissions(); + +// Loading this into the global namespace causes intermittent failures. +// See bug 882888 for more details. +var reftest = {}; +Cu.import("chrome://reftest/content/reftest.jsm", reftest); + +// Prevent display off during testing. +navigator.mozPower.screenEnabled = true; +var settingLock = navigator.mozSettings.createLock(); +var settingResult = settingLock.set({ + 'screen.timeout': 0 +}); +settingResult.onsuccess = function () { + dump("Set screen.time to 0\n"); + // Start the reftests + reftest.OnRefTestLoad(win); +} +settingResult.onerror = function () { + dump("Change screen.time failed\n"); + // Start the reftests + reftest.OnRefTestLoad(win); +} |