Changeset 185483 in webkit
- Timestamp:
- Jun 11, 2015 7:16:28 PM (9 years ago)
- Location:
- trunk/Tools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r185478 r185483 1 2015-06-11 Dewei Zhu <dewei_zhu@apple.com> 2 3 Move cursor to corner and fix safari window size before running benchmark 4 https://bugs.webkit.org/show_bug.cgi?id=145858 5 6 Reviewed by Ryosuke Niwa 7 8 * Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py: 9 (OSXBrowserDriver.prepareEnv): 10 (OSXBrowserDriver): 11 (OSXBrowserDriver.moveCursor): 12 (OSXBrowserDriver.getScreenSize): 13 * Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py: 14 (OSXChromeDriver.launchUrl): 15 (OSXChromeCanaryDriver.launchUrl): 16 * Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py: 17 (OSXFirefoxDriver.launchUrl): 18 (OSXFirefoxNightlyDriver.launchUrl): 19 * Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py: 20 (OSXSafariDriver.prepareEnv): 21 (OSXSafariDriver): 22 (OSXSafariDriver.maximizeWindow): 23 1 24 2015-06-11 Daniel Bates <dabates@apple.com> 2 25 -
trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py
r185242 r185483 5 5 6 6 from AppKit import NSRunningApplication 7 from AppKit import NSScreen 8 from Quartz.CoreGraphics import CGEventCreateMouseEvent 9 from Quartz.CoreGraphics import CGEventPost 10 from Quartz.CoreGraphics import kCGEventMouseMoved 11 from Quartz.CoreGraphics import kCGHIDEventTap 12 from Quartz.CoreGraphics import kCGMouseButtonLeft 7 13 from browser_driver import BrowserDriver 8 14 … … 16 22 def prepareEnv(self): 17 23 self.closeBrowsers() 24 self.moveCursor(0, 0) 18 25 19 26 def closeBrowsers(self): … … 44 51 subprocess.Popen(["/usr/bin/caffeinate", "-disw", str(process.pid)]) 45 52 return process 53 54 @classmethod 55 def moveCursor(cls, x, y): 56 moveEvent = CGEventCreateMouseEvent(None, kCGEventMouseMoved, (x, y), kCGMouseButtonLeft) 57 CGEventPost(kCGHIDEventTap, moveEvent) 58 59 @classmethod 60 def screenSize(cls): 61 return NSScreen.mainScreen().frame().size -
trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py
r184109 r185483 16 16 17 17 def launchUrl(self, url, browserBuildPath): 18 self.launchProcess(buildDir=browserBuildPath, appName='Google Chrome.app', url=url, args=['--args', '--homepage', url ])18 self.launchProcess(buildDir=browserBuildPath, appName='Google Chrome.app', url=url, args=['--args', '--homepage', url, '--window-size={width},{height}'.format(width=int(self.screenSize().width), height=int(self.screenSize().height))]) 19 19 20 20 … … 23 23 24 24 def launchUrl(self, url, browserBuildPath): 25 self.launchProcess(buildDir=browserBuildPath, appName='Google Chrome Canary.app', url=url, args=['--args', '--homepage', url ])25 self.launchProcess(buildDir=browserBuildPath, appName='Google Chrome Canary.app', url=url, args=['--args', '--homepage', url, '--window-size={width},{height}'.format(width=int(self.screenSize().width), height=int(self.screenSize().height))]) -
trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py
r184109 r185483 16 16 17 17 def launchUrl(self, url, browserBuildPath): 18 self.launchProcess(buildDir=browserBuildPath, appName='Firefox.app', url=url, args=[url ])18 self.launchProcess(buildDir=browserBuildPath, appName='Firefox.app', url=url, args=[url, '--args', '-width', str(int(self.screenSize().width)), '-height', str(int(self.screenSize().height))]) 19 19 20 20 … … 23 23 24 24 def launchUrl(self, url, browserBuildPath): 25 self.launchProcess(buildDir=browserBuildPath, appName='FirefoxNightly.app', url=url, args=[url ])25 self.launchProcess(buildDir=browserBuildPath, appName='FirefoxNightly.app', url=url, args=[url, '--args', '-width', str(int(self.screenSize().width)), '-height', str(int(self.screenSize().height))]) -
trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py
r185351 r185483 3 3 import logging 4 4 import os 5 import re 5 6 import subprocess 6 7 import time … … 17 18 18 19 def prepareEnv(self): 20 super(OSXSafariDriver, self).closeBrowsers() 19 21 self.safariProcess = None 20 self.closeBrowsers()21 22 forceRemove(os.path.join(os.path.expanduser('~'), 'Library/Saved Application State/com.apple.Safari.savedState')) 22 23 forceRemove(os.path.join(os.path.expanduser('~'), 'Library/Safari/LastSession.plist')) 24 self.maximizeWindow() 23 25 self.safariPreferences = ["-HomePage", "about:blank", "-WarnAboutFraudulentWebsites", "0", "-ExtensionsEnabled", "0", "-ShowStatusBar", "0", "-NewWindowBehavior", "1", "-NewTabBehavior", "1"] 24 26 … … 47 49 if self.safariProcess and self.safariProcess.returncode: 48 50 sys.exit('Browser crashed with exitcode %d' % self._process.returncode) 51 52 @classmethod 53 def maximizeWindow(cls): 54 try: 55 subprocess.check_call(['/usr/bin/defaults', 'write', 'com.apple.Safari', 'NSWindow Frame BrowserWindowFrame', ' '.join(['0', '0', str(cls.screenSize().width), str(cls.screenSize().height)] * 2)]) 56 except Exception as error: 57 _log.error('Reset safari window size failed - Error: {}'.format(error))
Note: See TracChangeset
for help on using the changeset viewer.