Allow to factor code with ERP5 if needed

parent 98008e8d
...@@ -69,7 +69,7 @@ class TimeoutError(Exception): ...@@ -69,7 +69,7 @@ class TimeoutError(Exception):
pass pass
class Xvfb: class Xvfb:
def __init__(self, xvfb_location, fbdir): def __init__(self, fbdir, xvfb_location="Xvfb"):
self.display_list = [":%s" % i for i in range(123, 144)] self.display_list = [":%s" % i for i in range(123, 144)]
self.display = None self.display = None
self.fbdir = fbdir self.fbdir = fbdir
...@@ -115,7 +115,7 @@ class Xvfb: ...@@ -115,7 +115,7 @@ class Xvfb:
class Browser: class Browser:
use_xvfb = 1 use_xvfb = 1
def __init__(self, bin_location, profile_dir, host): def __init__(self, profile_dir, host, bin_location=None):
self.bin_location = bin_location self.bin_location = bin_location
self.profile_dir = profile_dir self.profile_dir = profile_dir
self.host = host self.host = host
...@@ -175,6 +175,8 @@ class Firefox(Browser): ...@@ -175,6 +175,8 @@ class Firefox(Browser):
def _run(self, url): def _run(self, url):
# Prepare to run # Prepare to run
if not self.bin_location:
self.bin_location = "firefox"
self._createFile('prefs.js', self.getPrefJs()) self._createFile('prefs.js', self.getPrefJs())
self._runCommand((self.bin_location, "firefox", "-no-remote", self._runCommand((self.bin_location, "firefox", "-no-remote",
"-profile", self.profile_dir, url)) "-profile", self.profile_dir, url))
......
...@@ -67,9 +67,9 @@ def run(args): ...@@ -67,9 +67,9 @@ def run(args):
# sleep(10) # sleep(10)
os.environ['DISPLAY'] = config['display'] os.environ['DISPLAY'] = config['display']
xvfb = Xvfb(config['xvfb_binary'], config['etc_directory']) xvfb = Xvfb(config['etc_directory'], config['xvfb_binary'])
profile_dir = os.path.join(config['etc_directory'], 'profile') profile_dir = os.path.join(config['etc_directory'], 'profile')
browser = Firefox(config['browser_binary'], profile_dir, config['base_url']) browser = Firefox(profile_dir, config['base_url'], config['browser_binary'])
try: try:
start = time.time() start = time.time()
xvfb.run() xvfb.run()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment