Index: Source/web/tests/WebFrameTest.cpp |
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
index d6f0cf34c83bdd2a6b4950b5d323e8b9aee802aa..55eb7b6aa187f3eb6ae5f7419810e7d765cec30d 100644 |
--- a/Source/web/tests/WebFrameTest.cpp |
+++ b/Source/web/tests/WebFrameTest.cpp |
@@ -7689,7 +7689,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; |
@@ -7924,6 +7924,57 @@ 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); |
+ |
+ // Overscroll is not reported. |
majidvp
2015/07/09 19:00:35
nit: this comment does not add any value.
|
+ EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); |
+ ScrollEnd(&webViewHelper); |
+ Mock::VerifyAndClearExpectations(&client); |
+} |
+ |
TEST_F(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll) |
{ |
OverscrollWebViewClient client; |