Chromium Code Reviews| Index: Source/web/tests/WebFrameTest.cpp |
| diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
| index d6f0cf34c83bdd2a6b4950b5d323e8b9aee802aa..a3a180268483db0ccaa0516d124085309387bc60 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,49 @@ 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(0, -10.01), WebFloatSize(0, -10.01), WebFloatPoint(100, 100), WebFloatSize())); |
| + ScrollUpdate(&webViewHelper, 0, 10.01); |
| + Mock::VerifyAndClearExpectations(&client); |
|
majidvp
2015/07/09 18:01:18
I suggest adding a test to verify that the thresho
majidvp
2015/07/09 18:21:30
What about this?
|
| + |
| + // 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. |
| + EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); |
| + ScrollEnd(&webViewHelper); |
| + Mock::VerifyAndClearExpectations(&client); |
| +} |
| + |
| TEST_F(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll) |
| { |
| OverscrollWebViewClient client; |