Bug 832491 - enable --timeout support in browser-chrome mochitests; r=jmaher

This commit is contained in:
Nathan Froyd 2013-02-19 13:27:28 -05:00
parent 4f82e5a42a
commit d42d9f8a62
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,5 @@
// Test timeout (seconds)
const TIMEOUT_SECONDS = 30;
var gTimeoutSeconds = 30;
var gConfig;
if (Cc === undefined) {
@ -29,6 +29,9 @@ function testOnLoad() {
prefs.setBoolPref("testing.browserTestHarness.running", true);
if (prefs.prefHasUserValue("testing.browserTestHarness.timeout"))
gTimeoutSeconds = prefs.getIntPref("testing.browserTestHarness.timeout");
var sstring = Cc["@mozilla.org/supports-string;1"].
createInstance(Ci.nsISupportsString);
sstring.data = location.search;
@ -407,14 +410,14 @@ Tester.prototype = {
"Longer timeout required, waiting longer... Remaining timeouts: " +
self.currentTest.scope.__timeoutFactor);
self.currentTest.scope.__waitTimer =
setTimeout(arguments.callee, TIMEOUT_SECONDS * 1000);
setTimeout(arguments.callee, gTimeoutSeconds * 1000);
return;
}
self.currentTest.addResult(new testResult(false, "Test timed out", "", false));
self.currentTest.timedOut = true;
self.currentTest.scope.__waitTimer = null;
self.nextTest();
}, TIMEOUT_SECONDS * 1000);
}, gTimeoutSeconds * 1000);
}
},

View File

@ -584,6 +584,8 @@ class Mochitest(object):
def buildProfile(self, options):
""" create the profile and add optional chrome bits and files if requested """
if options.browserChrome and options.timeout:
options.extraPrefs.append("testing.browserTestHarness.timeout=%d" % options.timeout)
self.automation.initializeProfile(options.profilePath,
options.extraPrefs,
useServerLocations=True)