Diff
Modified: trunk/Tools/ChangeLog (219849 => 219850)
--- trunk/Tools/ChangeLog 2017-07-24 23:54:27 UTC (rev 219849)
+++ trunk/Tools/ChangeLog 2017-07-25 00:40:52 UTC (rev 219850)
@@ -1,3 +1,57 @@
+2017-07-24 Matthew Stewart <[email protected]>
+
+ Add WebDriver support in browser driver part of BenchmarkRunner
+ https://bugs.webkit.org/show_bug.cgi?id=174445
+
+ Reviewed by Stephanie Lewis.
+
+ Adds a launch_driver function to each BrowserDriver subclass. This
+ function sets up the arguments for the webdriver and launches the
+ webdriver specific to that browser.
+
+ * Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py:
+ (BrowserDriver.launch_webdriver):
+ (BrowserDriver):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/linux_browser_driver.py:
+ (LinuxBrowserDriver.launch_webdriver):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/linux_chrome_driver.py:
+ (LinuxChromeDriver.launch_url):
+ (LinuxChromeDriver):
+ (LinuxChromeDriver.launch_driver):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/linux_epiphany_driver.py:
+ (EpiphanyBrowserDriver.launch_url):
+ (EpiphanyBrowserDriver):
+ (EpiphanyBrowserDriver.launch_driver):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/linux_firefox_driver.py:
+ (LinuxFirefoxDriver):
+ (LinuxFirefoxDriver.launch_url):
+ (LinuxFirefoxDriver.launch_driver):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/linux_minibrowsergtk_driver.py:
+ (GTKMiniBrowserDriver.launch_url):
+ (GTKMiniBrowserDriver):
+ (GTKMiniBrowserDriver.launch_driver):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
+ (OSXBrowserDriver._launch_webdriver):
+ (OSXBrowserDriver):
+ (OSXBrowserDriver._screen_size):
+ (OSXBrowserDriver._insert_url):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:
+ (OSXChromeDriver):
+ (OSXChromeDriver.launch_url):
+ (OSXChromeDriver.launch_driver):
+ (OSXChromeCanaryDriver):
+ (OSXChromeCanaryDriver.launch_url):
+ (OSXChromeCanaryDriver.launch_driver):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py:
+ (OSXFirefoxDriver):
+ (OSXFirefoxDriver.launch_url):
+ (OSXFirefoxDriver.launch_driver):
+ (OSXFirefoxNightlyDriver):
+ (OSXFirefoxNightlyDriver.launch_url):
+ (OSXFirefoxNightlyDriver.launch_driver):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
+ (OSXSafariDriver.launch_driver):
+
2017-07-24 Wenson Hsieh <[email protected]>
[Mac WK2] Add an API test to cover r219765 (null dereference in [WKWebView dealloc])
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py (219849 => 219850)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py 2017-07-24 23:54:27 UTC (rev 219849)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py 2017-07-25 00:40:52 UTC (rev 219850)
@@ -18,6 +18,10 @@
pass
@abstractmethod
+ def launch_webdriver(self, url, driver):
+ pass
+
+ @abstractmethod
def add_additional_results(self, test_url, results):
return results
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_browser_driver.py (219849 => 219850)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_browser_driver.py 2017-07-24 23:54:27 UTC (rev 219849)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_browser_driver.py 2017-07-25 00:40:52 UTC (rev 219850)
@@ -97,6 +97,10 @@
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
+ def launch_webdriver(self, url, driver):
+ _log.info('Launching "%s" with url "%s"' % (driver.name, url))
+ driver.get(url)
+
def _get_first_executable_path_from_list(self, searchlist):
searchpath = [os.path.curdir] + os.environ['PATH'].split(os.pathsep)
for program in searchlist:
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_chrome_driver.py (219849 => 219850)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_chrome_driver.py 2017-07-24 23:54:27 UTC (rev 219849)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_chrome_driver.py 2017-07-25 00:40:52 UTC (rev 219850)
@@ -24,7 +24,11 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import os
+
from linux_browser_driver import LinuxBrowserDriver
+from selenium import webdriver
+from selenium.webdriver.chrome.options import Options
class LinuxChromeDriver(LinuxBrowserDriver):
@@ -35,3 +39,16 @@
self._browser_arguments = ['--temp-profile', '--start-maximized',
'--homepage', url]
super(LinuxChromeDriver, self).launch_url(url, options, browser_build_path)
+
+ def launch_driver(self, url, options, browser_build_path):
+ options = Options()
+ options.add_argument("--disable-web-security")
+ options.add_argument("--user-data-dir")
+ options.add_argument("--disable-extensions")
+ options.add_argument("--start-maximized")
+ if browser_build_path:
+ binary_path = os.path.join(browser_build_path, 'chromium-browser')
+ options.binary_location = binary_path
+ driver = webdriver.Chrome(chrome_options=options)
+ super(LinuxChromeDriver, self).launch_webdriver(url, driver)
+ return driver
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_epiphany_driver.py (219849 => 219850)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_epiphany_driver.py 2017-07-24 23:54:27 UTC (rev 219849)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_epiphany_driver.py 2017-07-25 00:40:52 UTC (rev 219850)
@@ -36,3 +36,6 @@
'--profile=""
url]
super(EpiphanyBrowserDriver, self).launch_url(url, options, browser_build_path)
+
+ def launch_driver(self, url, options, browser_build_path):
+ raise ValueError("Browser {browser} is not available with webdriver".format(browser=self.browser_name))
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_firefox_driver.py (219849 => 219850)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_firefox_driver.py 2017-07-24 23:54:27 UTC (rev 219849)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_firefox_driver.py 2017-07-25 00:40:52 UTC (rev 219850)
@@ -24,12 +24,16 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import os
+
from linux_browser_driver import LinuxBrowserDriver
+from selenium import webdriver
+from selenium.webdriver.firefox.options import Options
class LinuxFirefoxDriver(LinuxBrowserDriver):
browser_name = 'firefox'
- process_search_list = ['firefox']
+ process_search_list = ['firefox', 'firefox-bin']
def launch_url(self, url, options, browser_build_path):
self._browser_arguments = ['-new-instance', '-profile', self._temp_profiledir,
@@ -37,3 +41,12 @@
'-height', str(self._screen_size().height),
url]
super(LinuxFirefoxDriver, self).launch_url(url, options, browser_build_path)
+
+ def launch_driver(self, url, options, browser_build_path):
+ options = Options()
+ if browser_build_path:
+ binary_path = os.path.join(browser_build_path, 'firefox-bin')
+ options.binary_location = binary_path
+ driver = webdriver.Firefox(firefox_options=options)
+ super(LinuxFirefoxDriver, self).launch_webdriver(url, driver)
+ return driver
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_minibrowsergtk_driver.py (219849 => 219850)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_minibrowsergtk_driver.py 2017-07-24 23:54:27 UTC (rev 219849)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_minibrowsergtk_driver.py 2017-07-25 00:40:52 UTC (rev 219850)
@@ -38,3 +38,6 @@
self._browser_arguments.append('--geometry={w}x{h}'.format(w=self._screen_size().width, h=self._screen_size().height))
self._browser_arguments.append(url)
super(GTKMiniBrowserDriver, self).launch_url(url, options, browser_build_path)
+
+ def launch_driver(self, url, options, browser_build_path):
+ raise ValueError("Browser {browser} is not available with webdriver".format(browser=self.browser_name))
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py (219849 => 219850)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py 2017-07-24 23:54:27 UTC (rev 219849)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py 2017-07-25 00:40:52 UTC (rev 219850)
@@ -43,6 +43,11 @@
cls._launch_process_with_caffinate(args)
@classmethod
+ def _launch_webdriver(cls, url, driver):
+ _log.info('Launching "%s" with url "%s"' % (driver.name, url))
+ driver.get(url)
+
+ @classmethod
def _terminate_processes(cls, process_name):
_log.info('Closing all processes with name %s' % process_name)
subprocess.call(['/usr/bin/killall', process_name])
@@ -57,3 +62,9 @@
def _screen_size(cls):
from AppKit import NSScreen
return NSScreen.mainScreen().frame().size
+
+ @classmethod
+ def _insert_url(cls, args, pos, url):
+ temp_args = args[:]
+ temp_args.insert(pos, url)
+ return temp_args
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py (219849 => 219850)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py 2017-07-24 23:54:27 UTC (rev 219849)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py 2017-07-25 00:40:52 UTC (rev 219850)
@@ -6,22 +6,54 @@
import time
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'
browser_name = 'chrome'
+ app_name = 'Google Chrome.app'
def launch_url(self, url, options, browser_build_path):
- self._launch_process(build_dir=browser_build_path, app_name='Google Chrome.app', url="" args=['--args', '--homepage', url, '--window-size={width},{height}'.format(width=int(self._screen_size().width), height=int(self._screen_size().height))])
+ args_with_url = self._insert_url(args, 2, url)
+ self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url="" args=args_with_url)
+ def launch_driver(self, url, options, browser_build_path):
+ 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 = webdriver.Chrome(chrome_options=chrome_options)
+ self._launch_webdriver(url="" driver=driver)
+ return driver
+
class OSXChromeCanaryDriver(OSXBrowserDriver):
process_name = 'Google Chrome Canary'
browser_name = 'chrome-canary'
+ app_name = 'Google Chrome Canary.app'
def launch_url(self, url, options, browser_build_path):
- self._launch_process(build_dir=browser_build_path, app_name='Google Chrome Canary.app', url="" args=['--args', '--homepage', url, '--window-size={width},{height}'.format(width=int(self._screen_size().width), height=int(self._screen_size().height))])
+ args_with_url = self._insert_url(args, 2, url)
+ self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url="" args=args_with_url)
+
+ def launch_driver(self, url, options, browser_build_path):
+ 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 = webdriver.Chrome(chrome_options=chrome_options)
+ self._launch_webdriver(url="" driver=driver)
+ return driver
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py (219849 => 219850)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py 2017-07-24 23:54:27 UTC (rev 219849)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py 2017-07-25 00:40:52 UTC (rev 219850)
@@ -6,22 +6,50 @@
import time
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):
process_name = 'firefox'
browser_name = 'firefox'
+ app_name = 'Firefox.app'
def launch_url(self, url, options, browser_build_path):
- self._launch_process(build_dir=browser_build_path, app_name='Firefox.app', url="" args=[url, '--args', '-width', str(int(self._screen_size().width)), '-height', str(int(self._screen_size().height))])
+ args_with_url = self._insert_url(args, 0, url)
+ self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url="" args=args_with_url)
+ def launch_driver(self, url, options, browser_build_path):
+ 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 = webdriver.Firefox(firefox_options=firefox_options)
+ self._launch_webdriver(url="" driver=driver)
+ return driver
+
class OSXFirefoxNightlyDriver(OSXBrowserDriver):
process_name = 'firefox'
browser_name = 'firefox-nightly'
+ app_name = 'FirefoxNightly.app'
def launch_url(self, url, options, browser_build_path):
- self._launch_process(build_dir=browser_build_path, app_name='FirefoxNightly.app', url="" args=[url, '--args', '-width', str(int(self._screen_size().width)), '-height', str(int(self._screen_size().height))])
+ args_with_url = self._insert_url(args, 0, url)
+ self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url="" args=args_with_url)
+
+ def launch_driver(self, url, options, browser_build_path):
+ 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 = webdriver.Firefox(firefox_options=firefox_options)
+ self._launch_webdriver(url="" driver=driver)
+ return driver
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py (219849 => 219850)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py 2017-07-24 23:54:27 UTC (rev 219849)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py 2017-07-25 00:40:52 UTC (rev 219850)
@@ -8,6 +8,7 @@
from osx_browser_driver import OSXBrowserDriver
from webkitpy.benchmark_runner.utils import force_remove
+from selenium import webdriver
_log = logging.getLogger(__name__)
@@ -45,6 +46,11 @@
time.sleep(3)
subprocess.Popen(['open', '-a', args[0], url])
+ def launch_driver(self, url, options, browser_build_path):
+ driver = webdriver.Safari(quiet=False)
+ self._launch_webdriver(url="" driver=driver)
+ return driver
+
def close_browsers(self):
super(OSXSafariDriver, self).close_browsers()
if self._safari_process and self._safari_process.returncode: