Index: Source/web/tests/WebFrameTest.cpp |
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
index 32ecf1a46c2d059dc8b599180a729e3ebee284dd..75f4d56138e70755e41973a871821fc8505e7c39 100644 |
--- a/Source/web/tests/WebFrameTest.cpp |
+++ b/Source/web/tests/WebFrameTest.cpp |
@@ -7634,6 +7634,18 @@ protected: |
return event; |
} |
+ void ScrollByWheel(FrameTestHelpers::WebViewHelper* webViewHelper, int windowX, int windowY, float deltaX, float deltaY) |
+ { |
+ WebMouseWheelEvent event; |
+ event.type = WebInputEvent::MouseWheel; |
+ event.deltaX = deltaX; |
+ event.deltaY = deltaY; |
+ event.windowX = windowX; |
+ event.windowY = windowY; |
+ event.canScroll = true; |
+ webViewHelper->webViewImpl()->handleInputEvent(event); |
+ } |
+ |
void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) |
{ |
webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEvent::GestureScrollBegin)); |
@@ -7844,6 +7856,26 @@ TEST_F(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled) |
Mock::VerifyAndClearExpectations(&client); |
} |
+TEST_F(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll) |
+{ |
+ OverscrollWebViewClient client; |
+ registerMockedHttpURLLoad("overscroll/overscroll.html"); |
+ FrameTestHelpers::WebViewHelper webViewHelper; |
+ webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", true, 0, &client, configureAndroid); |
+ |
+ // On disabling ReportWheelOverscroll, overscroll is not reported on MouseWheel. |
+ webViewHelper.webView()->settings()->setReportWheelOverscroll(false); |
+ EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPoint(), WebFloatSize())).Times(0); |
+ ScrollByWheel(&webViewHelper, 10, 10, 1000, 1000); |
+ Mock::VerifyAndClearExpectations(&client); |
+ |
+ // On enabling ReportWheelOverscroll, overscroll is reported on MouseWheel. |
+ webViewHelper.webView()->settings()->setReportWheelOverscroll(true); |
+ EXPECT_CALL(client, didOverscroll(WebFloatSize(-1000, -1000), WebFloatSize(-1000, -1000), WebFloatPoint(), WebFloatSize())); |
+ ScrollByWheel(&webViewHelper, 10, 10, 1000, 1000); |
+ Mock::VerifyAndClearExpectations(&client); |
+} |
+ |
TEST_F(WebFrameTest, OrientationFrameDetach) |
{ |
RuntimeEnabledFeatures::setOrientationEventEnabled(true); |