diff --git a/build/automation.py.in b/build/automation.py.in index 4cd5f6dfb6a..067e824eb8b 100644 --- a/build/automation.py.in +++ b/build/automation.py.in @@ -223,7 +223,7 @@ def readLocations(locationsPath = "server-locations.txt"): return locations -def initializeProfile(profileDir): +def initializeProfile(profileDir, extraPrefs = []): "Sets up the standard testing profile." # Start with a clean slate. @@ -333,6 +333,14 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t """ % {"pacURL": pacURL} prefs.append(part) + for v in extraPrefs: + thispref = v.split("=") + if len(thispref) < 2: + print "Error: syntax error in --extra-pref=" + v + sys.exit(1) + part = 'user_pref("%s", %s);\n' % (thispref[0], thispref[1]) + prefs.append(part) + # write the preferences prefsFile = open(profileDir + "/" + "user.js", "a") prefsFile.write("".join(prefs)) diff --git a/testing/mochitest/runtests.py.in b/testing/mochitest/runtests.py.in index 725f3f4376a..cbe2383fec7 100644 --- a/testing/mochitest/runtests.py.in +++ b/testing/mochitest/runtests.py.in @@ -214,6 +214,12 @@ class MochitestOptions(optparse.OptionParser): "environment") defaults["environment"] = [] + self.add_option("--setpref", + action = "append", type = "string", + dest = "extraPrefs", metavar = "PREF=VALUE", + help = "defines an extra user preference") + defaults["extraPrefs"] = [] + self.add_option("--browser-arg", action = "append", type = "string", dest = "browserArgs", metavar = "ARG", @@ -426,7 +432,7 @@ Are you executing $objdir/_tests/testing/mochitest/runtests.py?""" sys.exit(1) browserEnv[v[:ix]] = v[ix + 1:] - automation.initializeProfile(PROFILE_DIRECTORY) + automation.initializeProfile(PROFILE_DIRECTORY, options.extraPrefs) manifest = addChromeToProfile(options) copyExtraFilesToProfile(options) server = MochitestServer(options)