Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 1195803003: Report accurate Overscroll on handleWheel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed unittest failures Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebSettingsImpl.cpp ('k') | public/web/WebSettings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/web/WebSettingsImpl.cpp ('k') | public/web/WebSettings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698