https://bugs.webkit.org/show_bug.cgi?id=174808
Patch by Matthew Stewart <matthew_r_stewart@apple.com> on 2017-07-24
Reviewed by Stephanie Lewis.
* Scripts/webkitpy/benchmark_runner/browser_driver/linux_chrome_driver.py:
(LinuxChromeDriver.launch_driver):
* Scripts/webkitpy/benchmark_runner/browser_driver/linux_firefox_driver.py:
(LinuxFirefoxDriver.launch_driver):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:
(OSXChromeDriver.launch_driver):
(OSXChromeCanaryDriver.launch_driver):
(create_chrome_options):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py:
(OSXFirefoxDriver.launch_driver):
(OSXFirefoxNightlyDriver.launch_driver):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
(OSXSafariDriver.launch_driver):
* Scripts/webkitpy/benchmark_runner/webdriver_benchmark_runner.py:
(WebDriverBenchmarkRunner._run_one_test):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219860
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-07-24 Matthew Stewart <matthew_r_stewart@apple.com>
+
+ Fix BenchmarkRunner to only import selenium when needed
+ https://bugs.webkit.org/show_bug.cgi?id=174808
+
+ Reviewed by Stephanie Lewis.
+
+ * Scripts/webkitpy/benchmark_runner/browser_driver/linux_chrome_driver.py:
+ (LinuxChromeDriver.launch_driver):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/linux_firefox_driver.py:
+ (LinuxFirefoxDriver.launch_driver):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:
+ (OSXChromeDriver.launch_driver):
+ (OSXChromeCanaryDriver.launch_driver):
+ (create_chrome_options):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py:
+ (OSXFirefoxDriver.launch_driver):
+ (OSXFirefoxNightlyDriver.launch_driver):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
+ (OSXSafariDriver.launch_driver):
+ * Scripts/webkitpy/benchmark_runner/webdriver_benchmark_runner.py:
+ (WebDriverBenchmarkRunner._run_one_test):
+
2017-07-23 Darin Adler <darin@apple.com>
More NeverDestroyed and related cleanup
import os
from linux_browser_driver import LinuxBrowserDriver
-from selenium import webdriver
-from selenium.webdriver.chrome.options import Options
class LinuxChromeDriver(LinuxBrowserDriver):
super(LinuxChromeDriver, self).launch_url(url, options, browser_build_path)
def launch_driver(self, url, options, browser_build_path):
+ from webkitpy.thirdparty.autoinstalled.selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--disable-web-security")
options.add_argument("--user-data-dir")
binary_path = os.path.join(browser_build_path, 'chromium-browser')
options.binary_location = binary_path
driver_executable = self.webdriver_binary_path
+ from webkitpy.thirdparty.autoinstalled.selenium import webdriver
driver = webdriver.Chrome(chrome_options=options, executable_path=driver_executable)
super(LinuxChromeDriver, self).launch_webdriver(url, driver)
return driver
import os
from linux_browser_driver import LinuxBrowserDriver
-from selenium import webdriver
-from selenium.webdriver.firefox.options import Options
class LinuxFirefoxDriver(LinuxBrowserDriver):
super(LinuxFirefoxDriver, self).launch_url(url, options, browser_build_path)
def launch_driver(self, url, options, browser_build_path):
+ from webkitpy.thirdparty.autoinstalled.selenium.webdriver.firefox.options import Options
options = Options()
if browser_build_path:
binary_path = os.path.join(browser_build_path, 'firefox-bin')
options.binary_location = binary_path
driver_executable = self.webdriver_binary_path
+ from webkitpy.thirdparty.autoinstalled.selenium import webdriver
driver = webdriver.Firefox(firefox_options=options, executable_path=driver_executable)
super(LinuxFirefoxDriver, self).launch_webdriver(url, driver)
return driver
import os
from osx_browser_driver import OSXBrowserDriver
-from selenium import webdriver
-from selenium.webdriver.chrome.options import Options
_log = logging.getLogger(__name__)
window_size_arg = '--window-size={width},{height}'.format(width=int(OSXBrowserDriver._screen_size().width), height=int(OSXBrowserDriver._screen_size().height))
args = ['--args', '--homepage', window_size_arg]
-chrome_options = Options()
-chrome_options.add_argument("--disable-web-security")
-chrome_options.add_argument("--user-data-dir")
-chrome_options.add_argument("--disable-extensions")
-chrome_options.add_argument(window_size_arg)
-
class OSXChromeDriver(OSXBrowserDriver):
process_name = 'Google Chrome'
self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
def launch_driver(self, url, options, browser_build_path):
+ chrome_options = create_chrome_options()
if browser_build_path:
app_path = os.path.join(browser_build_path, self.app_name)
binary_path = os.path.join(app_path, "Contents/MacOS", self.process_name)
chrome_options.binary_location = binary_path
driver_executable = self.webdriver_binary_path
+ from webkitpy.thirdparty.autoinstalled.selenium import webdriver
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=driver_executable)
self._launch_webdriver(url=url, driver=driver)
return driver
self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
def launch_driver(self, url, options, browser_build_path):
+ chrome_options = create_chrome_options()
if not browser_build_path:
browser_build_path = '/Applications/'
app_path = os.path.join(browser_build_path, self.app_name)
binary_path = os.path.join(app_path, "Contents/MacOS", self.process_name)
chrome_options.binary_location = binary_path
driver_executable = self.webdriver_binary_path
+ from webkitpy.thirdparty.autoinstalled.selenium import webdriver
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=driver_executable)
self._launch_webdriver(url=url, driver=driver)
return driver
+
+
+def create_chrome_options():
+ from webkitpy.thirdparty.autoinstalled.selenium.webdriver.chrome.options import Options
+ chrome_options = Options()
+ chrome_options.add_argument("--disable-web-security")
+ chrome_options.add_argument("--user-data-dir")
+ chrome_options.add_argument("--disable-extensions")
+ chrome_options.add_argument(window_size_arg)
+ return chrome_options
import os
from osx_browser_driver import OSXBrowserDriver
-from selenium import webdriver
-from selenium.webdriver.firefox.options import Options
_log = logging.getLogger(__name__)
args = ['--args', '-width', str(int(OSXBrowserDriver._screen_size().width)), '-height', str(int(OSXBrowserDriver._screen_size().height))]
-firefox_options = Options()
class OSXFirefoxDriver(OSXBrowserDriver):
self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
def launch_driver(self, url, options, browser_build_path):
+ from webkitpy.thirdparty.autoinstalled.selenium.webdriver.firefox.options import Options
+ firefox_options = Options()
if browser_build_path:
app_path = os.path.join(browser_build_path, self.app_name)
binary_path = os.path.join(app_path, "Contents/MacOS", self.process_name)
firefox_options.binary_location = binary_path
driver_executable = self.webdriver_binary_path
+ from webkitpy.thirdparty.autoinstalled.selenium import webdriver
driver = webdriver.Firefox(firefox_options=firefox_options, executable_path=driver_executable)
self._launch_webdriver(url=url, driver=driver)
return driver
self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
def launch_driver(self, url, options, browser_build_path):
+ from webkitpy.thirdparty.autoinstalled.selenium.webdriver.firefox.options import Options
+ firefox_options = Options()
if not browser_build_path:
browser_build_path = '/Applications/'
app_path = os.path.join(browser_build_path, self.app_name)
binary_path = os.path.join(app_path, "Contents/MacOS", self.process_name)
firefox_options.binary_location = binary_path
driver_executable = self.webdriver_binary_path
+ from webkitpy.thirdparty.autoinstalled.selenium import webdriver
driver = webdriver.Firefox(firefox_options=firefox_options, executable_path=driver_executable)
self._launch_webdriver(url=url, driver=driver)
return driver
from osx_browser_driver import OSXBrowserDriver
from webkitpy.benchmark_runner.utils import force_remove
-from selenium import webdriver
_log = logging.getLogger(__name__)
subprocess.Popen(['open', '-a', args[0], url])
def launch_driver(self, url, options, browser_build_path):
+ from webkitpy.thirdparty.autoinstalled.selenium import webdriver
driver = webdriver.Safari(quiet=False)
self._launch_webdriver(url=url, driver=driver)
return driver
import logging
from benchmark_runner import BenchmarkRunner
-from selenium.webdriver.support.ui import WebDriverWait
_log = logging.getLogger(__name__)
return result
def _run_one_test(self, web_root, test_file):
+ from webkitpy.thirdparty.autoinstalled.selenium.webdriver.support.ui import WebDriverWait
result = None
try:
url = 'file://{root}/{plan_name}/{test_file}'.format(root=web_root, plan_name=self._plan_name, test_file=test_file)