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

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

Issue 1214673006: Reset unusedDelta on Onverscroll for residual values. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased to the latest Created 5 years, 5 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/core/input/EventHandler.cpp ('k') | no next file » | 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 0def1a09287f0dc4dfee920924c911ae017df12b..95b162baef4d5aaae1f8586918476aa32c3e2cb1 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -7690,7 +7690,7 @@ public:
class WebFrameOverscrollTest : public WebFrameTest {
protected:
- WebGestureEvent generateEvent(WebInputEvent::Type type, int deltaX = 0, int deltaY = 0)
+ WebGestureEvent generateEvent(WebInputEvent::Type type, float deltaX = 0.0, float deltaY = 0.0)
{
WebGestureEvent event;
event.type = type;
@@ -7925,6 +7925,56 @@ TEST_F(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled)
Mock::VerifyAndClearExpectations(&client);
}
+TEST_F(WebFrameOverscrollTest, NoOverscrollForSmallvalues)
+{
+ OverscrollWebViewClient client;
+ registerMockedHttpURLLoad("overscroll/overscroll.html");
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", true, 0, &client, configureAndroid);
+
+ ScrollBegin(&webViewHelper);
+ EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, -10), WebFloatSize(-10, -10), WebFloatPoint(100, 100), WebFloatSize()));
+ ScrollUpdate(&webViewHelper, 10, 10);
+ Mock::VerifyAndClearExpectations(&client);
+
+ EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -0.10), WebFloatSize(-10, -10.10), WebFloatPoint(100, 100), WebFloatSize()));
+ ScrollUpdate(&webViewHelper, 0, 0.10);
+ Mock::VerifyAndClearExpectations(&client);
+
+ EXPECT_CALL(client, didOverscroll(WebFloatSize(-0.10, 0), WebFloatSize(-10.10, -10.10), WebFloatPoint(100, 100), WebFloatSize()));
+ ScrollUpdate(&webViewHelper, 0.10, 0);
+ Mock::VerifyAndClearExpectations(&client);
+
+ // For residual values overscrollDelta should be reset and didOverscroll shouldn't be called.
+ EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
+ ScrollUpdate(&webViewHelper, 0, 0.09);
+ Mock::VerifyAndClearExpectations(&client);
+
+ EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
+ ScrollUpdate(&webViewHelper, 0.09, 0.09);
+ Mock::VerifyAndClearExpectations(&client);
+
+ EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
+ ScrollUpdate(&webViewHelper, 0.09, 0);
+ Mock::VerifyAndClearExpectations(&client);
+
+ EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
+ ScrollUpdate(&webViewHelper, 0, -0.09);
+ Mock::VerifyAndClearExpectations(&client);
+
+ EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
+ ScrollUpdate(&webViewHelper, -0.09, -0.09);
+ Mock::VerifyAndClearExpectations(&client);
+
+ EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
+ ScrollUpdate(&webViewHelper, -0.09, 0);
+ Mock::VerifyAndClearExpectations(&client);
+
+ EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
+ ScrollEnd(&webViewHelper);
+ Mock::VerifyAndClearExpectations(&client);
+}
+
TEST_F(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll)
{
OverscrollWebViewClient client;
« no previous file with comments | « Source/core/input/EventHandler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698