Expand test infrastructure to support scrolling tests
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Apr 2015 00:05:17 +0000 (00:05 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Apr 2015 00:05:17 +0000 (00:05 +0000)
commit88027fa1f25b0494cc5bd7d5c9ab77f6d3759973
tree1f74de3e57029abfaf91713af3601e868ae900af
parent747ea569e1a1fb3898f311327a8f7247f6e6534f
Expand test infrastructure to support scrolling tests
https://bugs.webkit.org/show_bug.cgi?id=143286
<rdar://problem/20375516>

Reviewed by Simon Fraser.

Source/WebCore:

No new functionality.

This series of changes adds a new singleton class, 'WheelEventTestTrigger', which encapsulates a
function object to be fired when scroll events are finished. The object also keeps track of reasons
why the test should not yet fire (e.g., 'rubberbanding' is active) so that tests do not incorrectly
check rendering state in the middle of an animation.

This code is not yet hooked up to the rendering system, and so does not have any effect on behavior.

* CMakeLists.txt: Add new WheelEventTestTrigger files.
* WebCore.vcxproj/WebCore.vcxproj: Ditto.
* WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* page/MainFrame.cpp:
(WebCore::MainFrame::MainFrame): Add new member to constructor.
(WebCore::MainFrame::testTrigger): Added.
(WebCore::MainFrame::ensureTestTrigger): Added.
(WebCore::MainFrame::clearTrigger): Added.
* page/MainFrame.h:
* page/WheelEventTestTrigger.cpp: Added.
(WebCore::WheelEventTestTrigger::WheelEventTestTrigger):
(WebCore::WheelEventTestTrigger::createWeakPtr):
(WebCore::WheelEventTestTrigger::clearAllTestDeferrals):
(WebCore::WheelEventTestTrigger::setTestNotificationCallback):
(WebCore::WheelEventTestTrigger::deferTestsForReason):
(WebCore::WheelEventTestTrigger::removeTestDeferralForReason):
(WebCore::WheelEventTestTrigger::triggerTestTimerFired):
* page/WheelEventTestTrigger.h: Added.

Source/WebKit2:

Extend the WK2 testing API to include a method for setting a JSC callback function to be triggered
by the new WebCore::WheelEventTestTrigger singleton.

* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageStartMonitoringScrollOperations): WK2 method that causes the testing system to begin tracking wheel events.
(WKBundlePageRegisterScrollOperationCompletionCallback): WK2 method to set the callback function for testing.
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:

Tools:

Extend the WK1 and WK2 test programs to support two new EventSender commands:
(1) monitorWheelEvents: Tells DRT and WKTR to track the wheel event and animation state, so that we can
block executing tests until WebKit has completed any rubberband, scroll, or scroll-snap animations.
(2) callAfterScrollingCompletes: Provide a callback method to be executed when WebKit determines that
relevant rubberband, scroll, and scroll-snap animations are finished.

* DumpRenderTree/mac/EventSendingController.mm:
(+[EventSendingController isSelectorExcludedFromWebScript:]): Update to recognize 'callAfterScrollingCompletes:'
and 'monitorWheelEvents'.
(+[EventSendingController webScriptNameForSelector:]): Ditto.
(-[EventSendingController mouseScrollByX:andY:continuously:]): Add some stderr logging to help when
debugging test failures.
(-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): Ditto.
(-[EventSendingController callAfterScrollingCompletes:]): Added. Protects the JSObject representing the callback
function, then passes it to WebCore to be called once the test deferrals have been cleared.
(-[EventSendingController monitorWheelEvents:]): Added. Activates the wheel event tracking used by the
'callAfterScrollingCompletes' method.
* WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl: Added signatures for 'callAfterScrollingCompletes'
and 'monitorWheelEvents'.
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::EventSendingController::callAfterScrollingCompletes): Added. Protects the JSObject representing the
callback function, then passes it to WebCore to be called once the test deferrals have been cleared
(WTR::EventSendingController::monitorWheelEvents): Added. Activates the wheel event tracking used by the
'callAfterScrollingComplates' method.
* WebKitTestRunner/InjectedBundle/EventSendingController.h:

LayoutTests:

Correct a scrolling test that had not been issuing wheel events to a valid
view. This was found by some new logging in this patch.

* platform/mac/fast/scrolling/scroll-div-latched-div-expected.txt:
* platform/mac/fast/scrolling/scroll-div-latched-div.html:
* platform/mac-wk1/scrollbars/scrollevent-iframe-no-scrolling-wheel-expected.txt: Added.*

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182768 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk1/scrollbars/scrollevent-iframe-no-scrolling-wheel-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/scrolling/scroll-div-latched-div-expected.txt
LayoutTests/platform/mac/fast/scrolling/scroll-div-latched-div.html
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/MainFrame.cpp
Source/WebCore/page/MainFrame.h
Source/WebCore/page/WheelEventTestTrigger.cpp [new file with mode: 0644]
Source/WebCore/page/WheelEventTestTrigger.h [new file with mode: 0644]
Source/WebCore/platform/PlatformExportMacros.h
Source/WebCore/platform/spi/mac/NSSharingServicePickerSPI.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
Tools/ChangeLog
Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
Tools/DumpRenderTree/mac/EventSendingController.mm
Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl
Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h