[Mac] Add support for testing swipes
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Sep 2015 21:11:44 +0000 (21:11 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Sep 2015 21:11:44 +0000 (21:11 +0000)
commitafbf70f4aa5ed2289edf4c264b3cd9a8de700f96
tree0c33d08118af0ffbaf5bb9ef1e2a53bc2d055e03
parentb5e840a66b822f6b02367892a47a50001ca059c9
[Mac] Add support for testing swipes
https://bugs.webkit.org/show_bug.cgi?id=148700

Reviewed by Beth Dakin.

* WebKitTestRunner/EventSenderProxy.h:
* WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::cgEventPhaseFromString):
(WTR::cgEventMomentumPhaseFromString):
(WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases):
(WTR::EventSendingController::swipeGestureWithWheelAndMomentumPhases):
* WebKitTestRunner/InjectedBundle/EventSendingController.h:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::installDidBeginSwipeCallback):
(WTR::TestRunner::installWillEndSwipeCallback):
(WTR::TestRunner::installDidEndSwipeCallback):
(WTR::TestRunner::installDidRemoveSwipeSnapshotCallback):
(WTR::TestRunner::callDidBeginSwipeCallback):
(WTR::TestRunner::callWillEndSwipeCallback):
(WTR::TestRunner::callDidEndSwipeCallback):
(WTR::TestRunner::callDidRemoveSwipeSnapshotCallback):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createOtherPage):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::didReceiveMessageFromInjectedBundle):
(WTR::TestController::didBeginNavigationGesture):
(WTR::TestController::willEndNavigationGesture):
(WTR::TestController::didEndNavigationGesture):
(WTR::TestController::didRemoveNavigationGestureSnapshot):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didBeginSwipe):
(WTR::TestInvocation::willEndSwipe):
(WTR::TestInvocation::didEndSwipe):
(WTR::TestInvocation::didRemoveSwipeSnapshot):
* WebKitTestRunner/TestInvocation.h:
Add callbacks when navigation gestures didBegin/willEnd/didEnd, and
when the snapshot is removed.

Add swipeGestureWithWheelAndMomentumPhases, just like the equivalent
mouseScrollBy function.

* WebKitTestRunner/mac/EventSenderProxy.mm:
(-[EventSenderSyntheticEvent initPressureEventAtLocation:globalLocation:stage:pressure:phase:time:eventNumber:]):
(-[EventSenderSyntheticEvent type]):
(-[EventSenderSyntheticEvent subtype]):
(-[EventSenderSyntheticEvent locationInWindow]):
(-[EventSenderSyntheticEvent location]):
(-[EventSenderSyntheticEvent momentumPhase]):
(-[EventSenderSyntheticEvent _isTouchesEnded]):
(-[EventSenderSyntheticEvent _cgsEventRecord]):
Rename EventSenderPressureEvent to EventSenderSyntheticEvent and add some
more adjustable values.

(WTR::EventSenderProxy::mouseForceDown):
(WTR::EventSenderProxy::mouseForceUp):
(WTR::EventSenderProxy::mouseForceChanged):
Adopt EventSenderSyntheticEvent.

(WTR::nsEventPhaseFromCGEventPhase):
(WTR::EventSenderProxy::swipeGestureWithWheelAndMomentumPhases):
Make use of EventSenderSyntheticEvent to synthesize swipe gesture events.

* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Enable swipe.

* swipe/basic-cached-back-swipe-expected.txt: Added.
* swipe/basic-cached-back-swipe.html: Added.
* swipe/resources/swipe-test.js: Added.
(eventQueue.enqueueScrollEvent):
(eventQueue.enqueueSwipeEvent):
(eventQueue.hasPendingEvents):
(eventQueue._processEventQueue):
(eventQueue._processEventQueueSoon):
(shouldBe):
(log):
(dumpLog):
(initializeLog):
(startMeasuringDuration):
(measuredDurationShouldBeLessThan):
Add a test for the simplest case, a back swipe after a normal navigation
with the page cache enabled.

* TestExpectations:
* platform/mac-wk2/TestExpectations:
Disable these tests everywhere except Mac WebKit2.

* UIProcess/API/mac/WKView.mm:
(takeWindowSnapshot):
(-[WKView _takeViewSnapshot]):
Fall back to the non-hardware snapshotting path if the hardware path fails,
which usually happens if the view is fully off-screen (as in the case
of WebKitTestRunner).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189287 268f45cc-cd09-0410-ab3c-d52691b4dbfc
34 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/platform/mac-mavericks/TestExpectations
LayoutTests/platform/mac-wk2/TestExpectations
LayoutTests/swipe/basic-cached-back-swipe-expected.txt [new file with mode: 0644]
LayoutTests/swipe/basic-cached-back-swipe.html [new file with mode: 0644]
LayoutTests/swipe/resources/swipe-test.js [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm
Tools/ChangeLog
Tools/WebKitTestRunner/EventSenderProxy.h
Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/InjectedBundle/ios/EventSenderProxyIOS.mm
Tools/WebKitTestRunner/PlatformWebView.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp
Tools/WebKitTestRunner/TestInvocation.h
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp
Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp
Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp
Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp
Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
Tools/WebKitTestRunner/ios/TestControllerIOS.mm
Tools/WebKitTestRunner/mac/EventSenderProxy.mm
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
Tools/WebKitTestRunner/mac/TestControllerMac.mm