Add a user.js file Firefox profile. Change HTTP server to run on background thread.

This commit is contained in:
Rob Sayre 2011-06-23 11:24:36 -07:00
parent faaf3a4907
commit f777fcf792
2 changed files with 63 additions and 12 deletions

View File

@ -0,0 +1,33 @@
user_pref("browser.console.showInPanel", true);
user_pref("browser.dom.window.dump.enabled", true);
user_pref("browser.firstrun.show.localepicker", false);
user_pref("browser.firstrun.show.uidiscovery", false);
user_pref("dom.allow_scripts_to_close_windows", true);
user_pref("dom.disable_open_during_load", false);
user_pref("dom.max_script_run_time", 0); // no slow script dialogs
user_pref("dom.max_chrome_script_run_time", 0);
user_pref("dom.popup_maximum", -1);
user_pref("dom.send_after_paint_to_content", true);
user_pref("dom.successive_dialog_time_limit", 0);
user_pref("security.warn_submit_insecure", false);
user_pref("browser.shell.checkDefaultBrowser", false);
user_pref("shell.checkDefaultClient", false);
user_pref("browser.warnOnQuit", false);
user_pref("accessibility.typeaheadfind.autostart", false);
user_pref("javascript.options.showInConsole", true);
user_pref("devtools.errorconsole.enabled", true);
user_pref("layout.debug.enable_data_xbl", true);
user_pref("browser.EULA.override", true);
user_pref("javascript.options.tracejit.content", true);
user_pref("javascript.options.methodjit.content", true);
user_pref("javascript.options.jitprofiling.content", true);
user_pref("javascript.options.methodjit_always", false);
user_pref("gfx.color_management.force_srgb", true);
user_pref("network.manage-offline-status", false);
user_pref("test.mousescroll", true);
user_pref("network.http.prompt-temp-redirect", false);
user_pref("media.cache_size", 100);
user_pref("security.warn_viewing_mixed", false);
user_pref("app.update.enabled", false);
user_pref("browser.panorama.experienced_first_run", true); // Assume experienced
user_pref("dom.w3c_touch_events.enabled", true);

View File

@ -1,5 +1,6 @@
import json, platform, os, sys, subprocess, urllib, urllib2 import json, platform, os, shutil, sys, subprocess, tempfile, threading, urllib, urllib2
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import SocketServer
from optparse import OptionParser from optparse import OptionParser
from urlparse import urlparse from urlparse import urlparse
@ -69,8 +70,11 @@ class Result:
self.snapshot = snapshot self.snapshot = snapshot
self.failure = failure self.failure = failure
class TestServer(SocketServer.TCPServer):
allow_reuse_address = True
class PDFTestHandler(BaseHTTPRequestHandler): class PDFTestHandler(BaseHTTPRequestHandler):
# Disable annoying noise by default # Disable annoying noise by default
def log_request(code=0, size=0): def log_request(code=0, size=0):
if VERBOSE: if VERBOSE:
@ -78,7 +82,6 @@ class PDFTestHandler(BaseHTTPRequestHandler):
def do_GET(self): def do_GET(self):
url = urlparse(self.path) url = urlparse(self.path)
print "GET",url
# Ignore query string # Ignore query string
path, _ = url.path, url.query path, _ = url.path, url.query
path = os.path.abspath(os.path.realpath(DOC_ROOT + os.sep + path)) path = os.path.abspath(os.path.realpath(DOC_ROOT + os.sep + path))
@ -143,6 +146,19 @@ class BrowserCommand():
def _fixupMacPath(self): def _fixupMacPath(self):
self.path = self.path + "/Contents/MacOS/firefox-bin" self.path = self.path + "/Contents/MacOS/firefox-bin"
def setup(self):
self.tempDir = tempfile.mkdtemp()
self.profileDir = os.path.join(self.tempDir, "profile")
shutil.copytree(os.path.join(DOC_ROOT, "test", "resources", "firefox"),
self.profileDir)
def teardown(self):
shutil.rmtree(self.tempDir)
def start(self, url):
cmds = [self.path, "-no-remote", "-profile", self.profileDir, url]
subprocess.call(cmds)
def makeBrowserCommands(browserManifestFile): def makeBrowserCommands(browserManifestFile):
with open(browserManifestFile) as bmf: with open(browserManifestFile) as bmf:
browsers = [BrowserCommand(browser) for browser in json.load(bmf)] browsers = [BrowserCommand(browser) for browser in json.load(bmf)]
@ -196,11 +212,13 @@ def setUp(options):
State.remaining = len(testBrowsers) * len(manifestList) State.remaining = len(testBrowsers) * len(manifestList)
for b in testBrowsers: for b in testBrowsers:
print 'Launching', b.name try:
qs = 'browser='+ urllib.quote(b.name) +'&manifestFile='+ urllib.quote(options.manifestFile) b.setup()
subprocess.Popen(( os.path.abspath(os.path.realpath(b.path)), print 'Launching', b.name
'http://localhost:8080/test/test_slave.html?'+ qs)) qs = 'browser='+ urllib.quote(b.name) +'&manifestFile='+ urllib.quote(options.manifestFile)
b.start('http://localhost:8080/test/test_slave.html?'+ qs)
finally:
b.teardown()
def check(task, results, browser): def check(task, results, browser):
failed = False failed = False
@ -350,12 +368,12 @@ def main():
if options == None: if options == None:
sys.exit(1) sys.exit(1)
httpd = TestServer(('127.0.0.1', 8080), PDFTestHandler)
httpd_thread = threading.Thread(target=httpd.serve_forever)
httpd_thread.setDaemon(True)
httpd_thread.start()
setUp(options) setUp(options)
server = HTTPServer(('127.0.0.1', 8080), PDFTestHandler)
while not State.done:
server.handle_request()
processResults() processResults()
if __name__ == '__main__': if __name__ == '__main__':