From d42d9f8a629fab376d1cfafa56fe9cb862834b75 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Tue, 19 Feb 2013 13:27:28 -0500 Subject: [PATCH] Bug 832491 - enable --timeout support in browser-chrome mochitests; r=jmaher --- testing/mochitest/browser-test.js | 9 ++++++--- testing/mochitest/runtests.py | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/testing/mochitest/browser-test.js b/testing/mochitest/browser-test.js index 7418ee6d7493..7ecdd6dee66d 100644 --- a/testing/mochitest/browser-test.js +++ b/testing/mochitest/browser-test.js @@ -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); } }, diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index 3ba38ad04c3d..7efd2e2ab310 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -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)