REGRESSION(r219850): run-benchmark script broken on Linux
[WebKit-https.git] / Tools / Scripts / webkitpy / benchmark_runner / browser_driver / osx_firefox_driver.py
1 #!/usr/bin/env python
2
3 import logging
4 import os
5
6 from osx_browser_driver import OSXBrowserDriver
7
8
9 _log = logging.getLogger(__name__)
10
11
12 class OSXFirefoxDriver(OSXBrowserDriver):
13     process_name = 'firefox'
14     browser_name = 'firefox'
15     app_name = 'Firefox.app'
16
17     def launch_url(self, url, options, browser_build_path):
18         args_with_url = self._insert_url(create_args(), 0, url)
19         self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
20
21     def launch_driver(self, url, options, browser_build_path):
22         from webkitpy.thirdparty.autoinstalled.selenium.webdriver.firefox.options import Options
23         firefox_options = Options()
24         if browser_build_path:
25             app_path = os.path.join(browser_build_path, self.app_name)
26             binary_path = os.path.join(app_path, "Contents/MacOS", self.process_name)
27             firefox_options.binary_location = binary_path
28         driver_executable = self.webdriver_binary_path
29         from webkitpy.thirdparty.autoinstalled.selenium import webdriver
30         driver = webdriver.Firefox(firefox_options=firefox_options, executable_path=driver_executable)
31         self._launch_webdriver(url=url, driver=driver)
32         return driver
33
34
35 class OSXFirefoxNightlyDriver(OSXBrowserDriver):
36     process_name = 'firefox'
37     browser_name = 'firefox-nightly'
38     app_name = 'FirefoxNightly.app'
39
40     def launch_url(self, url, options, browser_build_path):
41         args_with_url = self._insert_url(create_args(), 0, url)
42         self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
43
44     def launch_driver(self, url, options, browser_build_path):
45         from webkitpy.thirdparty.autoinstalled.selenium.webdriver.firefox.options import Options
46         firefox_options = Options()
47         if not browser_build_path:
48             browser_build_path = '/Applications/'
49         app_path = os.path.join(browser_build_path, self.app_name)
50         binary_path = os.path.join(app_path, "Contents/MacOS", self.process_name)
51         firefox_options.binary_location = binary_path
52         driver_executable = self.webdriver_binary_path
53         from webkitpy.thirdparty.autoinstalled.selenium import webdriver
54         driver = webdriver.Firefox(firefox_options=firefox_options, executable_path=driver_executable)
55         self._launch_webdriver(url=url, driver=driver)
56         return driver
57
58
59 def create_args():
60     args = ['--args', '-width', str(int(OSXBrowserDriver._screen_size().width)), '-height', str(int(OSXBrowserDriver._screen_size().height))]
61     return args