Move cursor to (10, 0) instead of (0, 0) and polish the mouse move code
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jun 2015 23:40:08 +0000 (23:40 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jun 2015 23:40:08 +0000 (23:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145945

Patch by Dewei Zhu <dewei_zhu@apple.com> on 2015-06-12
Reviewed by Stephanie Lewis.

* Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
(OSXBrowserDriver.prepareEnv):
(OSXBrowserDriver.moveCursor): Deleted.
(OSXBrowserDriver): Deleted.
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
(OSXSafariDriver.prepareEnv):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185524 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py
Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py

index 84ee72a..c73c6b5 100644 (file)
@@ -1,3 +1,17 @@
+2015-06-12  Dewei Zhu  <dewei_zhu@apple.com>
+
+        Move cursor to (10, 0) instead of (0, 0) and polish the mouse move code
+        https://bugs.webkit.org/show_bug.cgi?id=145945
+
+        Reviewed by Stephanie Lewis.
+
+        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
+        (OSXBrowserDriver.prepareEnv):
+        (OSXBrowserDriver.moveCursor): Deleted.
+        (OSXBrowserDriver): Deleted.
+        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
+        (OSXSafariDriver.prepareEnv):
+
 2015-06-12  Brent Fulgham  <bfulgham@apple.com>
 
         Revise update-webkit-dependency to use LWP::UserAgent instead of LWP::Simple for better handling of https
index 85b32cc..09c14d2 100644 (file)
@@ -5,11 +5,7 @@ import subprocess
 
 from AppKit import NSRunningApplication
 from AppKit import NSScreen
-from Quartz.CoreGraphics import CGEventCreateMouseEvent
-from Quartz.CoreGraphics import CGEventPost
-from Quartz.CoreGraphics import kCGEventMouseMoved
-from Quartz.CoreGraphics import kCGHIDEventTap
-from Quartz.CoreGraphics import kCGMouseButtonLeft
+from Quartz import CGWarpMouseCursorPosition
 from browser_driver import BrowserDriver
 
 
@@ -21,7 +17,7 @@ class OSXBrowserDriver(BrowserDriver):
 
     def prepareEnv(self):
         self.closeBrowsers()
-        self.moveCursor(0, 0)
+        CGWarpMouseCursorPosition((10, 0))
 
     def closeBrowsers(self):
         self.terminateProcesses(self.bundleIdentifier)
@@ -52,10 +48,5 @@ class OSXBrowserDriver(BrowserDriver):
         return process
 
     @classmethod
-    def moveCursor(cls, x, y):
-        moveEvent = CGEventCreateMouseEvent(None, kCGEventMouseMoved, (x, y), kCGMouseButtonLeft)
-        CGEventPost(kCGHIDEventTap, moveEvent)
-
-    @classmethod
     def screenSize(cls):
         return NSScreen.mainScreen().frame().size
index 62f58f8..c4ca1a4 100644 (file)
@@ -17,8 +17,8 @@ class OSXSafariDriver(OSXBrowserDriver):
     bundleIdentifier = 'com.apple.Safari'
 
     def prepareEnv(self):
-        super(OSXSafariDriver, self).closeBrowsers()
         self.safariProcess = None
+        super(OSXSafariDriver, self).prepareEnv()
         forceRemove(os.path.join(os.path.expanduser('~'), 'Library/Saved Application State/com.apple.Safari.savedState'))
         forceRemove(os.path.join(os.path.expanduser('~'), 'Library/Safari/LastSession.plist'))
         self.maximizeWindow()