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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/core/input/EventHandler.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 7672 matching lines...) Expand 10 before | Expand all | Expand 10 after
7683 view->close(); 7683 view->close();
7684 } 7684 }
7685 7685
7686 class OverscrollWebViewClient : public FrameTestHelpers::TestWebViewClient { 7686 class OverscrollWebViewClient : public FrameTestHelpers::TestWebViewClient {
7687 public: 7687 public:
7688 MOCK_METHOD4(didOverscroll, void(const WebFloatSize&, const WebFloatSize&, c onst WebFloatPoint&, const WebFloatSize&)); 7688 MOCK_METHOD4(didOverscroll, void(const WebFloatSize&, const WebFloatSize&, c onst WebFloatPoint&, const WebFloatSize&));
7689 }; 7689 };
7690 7690
7691 class WebFrameOverscrollTest : public WebFrameTest { 7691 class WebFrameOverscrollTest : public WebFrameTest {
7692 protected: 7692 protected:
7693 WebGestureEvent generateEvent(WebInputEvent::Type type, int deltaX = 0, int deltaY = 0) 7693 WebGestureEvent generateEvent(WebInputEvent::Type type, float deltaX = 0.0, float deltaY = 0.0)
7694 { 7694 {
7695 WebGestureEvent event; 7695 WebGestureEvent event;
7696 event.type = type; 7696 event.type = type;
7697 event.x = 100; 7697 event.x = 100;
7698 event.y = 100; 7698 event.y = 100;
7699 if (type == WebInputEvent::GestureScrollUpdate) { 7699 if (type == WebInputEvent::GestureScrollUpdate) {
7700 event.data.scrollUpdate.deltaX = deltaX; 7700 event.data.scrollUpdate.deltaX = deltaX;
7701 event.data.scrollUpdate.deltaY = deltaY; 7701 event.data.scrollUpdate.deltaY = deltaY;
7702 } 7702 }
7703 return event; 7703 return event;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
7918 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, 0), WebFloatSize(-20, -3 0), WebFloatPoint(33, 33), WebFloatSize())); 7918 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, 0), WebFloatSize(-20, -3 0), WebFloatPoint(33, 33), WebFloatSize()));
7919 ScrollUpdate(&webViewHelper, 30, 0); 7919 ScrollUpdate(&webViewHelper, 30, 0);
7920 Mock::VerifyAndClearExpectations(&client); 7920 Mock::VerifyAndClearExpectations(&client);
7921 7921
7922 // Overscroll is not reported. 7922 // Overscroll is not reported.
7923 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); 7923 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7924 ScrollEnd(&webViewHelper); 7924 ScrollEnd(&webViewHelper);
7925 Mock::VerifyAndClearExpectations(&client); 7925 Mock::VerifyAndClearExpectations(&client);
7926 } 7926 }
7927 7927
7928 TEST_F(WebFrameOverscrollTest, NoOverscrollForSmallvalues)
7929 {
7930 OverscrollWebViewClient client;
7931 registerMockedHttpURLLoad("overscroll/overscroll.html");
7932 FrameTestHelpers::WebViewHelper webViewHelper;
7933 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr ue, 0, &client, configureAndroid);
7934
7935 ScrollBegin(&webViewHelper);
7936 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, -10), WebFloatSize(-10, -10), WebFloatPoint(100, 100), WebFloatSize()));
7937 ScrollUpdate(&webViewHelper, 10, 10);
7938 Mock::VerifyAndClearExpectations(&client);
7939
7940 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -0.10), WebFloatSize(-10, -10.10), WebFloatPoint(100, 100), WebFloatSize()));
7941 ScrollUpdate(&webViewHelper, 0, 0.10);
7942 Mock::VerifyAndClearExpectations(&client);
7943
7944 EXPECT_CALL(client, didOverscroll(WebFloatSize(-0.10, 0), WebFloatSize(-10.1 0, -10.10), WebFloatPoint(100, 100), WebFloatSize()));
7945 ScrollUpdate(&webViewHelper, 0.10, 0);
7946 Mock::VerifyAndClearExpectations(&client);
7947
7948 // For residual values overscrollDelta should be reset and didOverscroll sho uldn't be called.
7949 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7950 ScrollUpdate(&webViewHelper, 0, 0.09);
7951 Mock::VerifyAndClearExpectations(&client);
7952
7953 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7954 ScrollUpdate(&webViewHelper, 0.09, 0.09);
7955 Mock::VerifyAndClearExpectations(&client);
7956
7957 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7958 ScrollUpdate(&webViewHelper, 0.09, 0);
7959 Mock::VerifyAndClearExpectations(&client);
7960
7961 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7962 ScrollUpdate(&webViewHelper, 0, -0.09);
7963 Mock::VerifyAndClearExpectations(&client);
7964
7965 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7966 ScrollUpdate(&webViewHelper, -0.09, -0.09);
7967 Mock::VerifyAndClearExpectations(&client);
7968
7969 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7970 ScrollUpdate(&webViewHelper, -0.09, 0);
7971 Mock::VerifyAndClearExpectations(&client);
7972
7973 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7974 ScrollEnd(&webViewHelper);
7975 Mock::VerifyAndClearExpectations(&client);
7976 }
7977
7928 TEST_F(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll) 7978 TEST_F(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll)
7929 { 7979 {
7930 OverscrollWebViewClient client; 7980 OverscrollWebViewClient client;
7931 registerMockedHttpURLLoad("overscroll/overscroll.html"); 7981 registerMockedHttpURLLoad("overscroll/overscroll.html");
7932 FrameTestHelpers::WebViewHelper webViewHelper; 7982 FrameTestHelpers::WebViewHelper webViewHelper;
7933 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr ue, 0, &client, configureAndroid); 7983 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr ue, 0, &client, configureAndroid);
7934 7984
7935 // On disabling ReportWheelOverscroll, overscroll is not reported on MouseWh eel. 7985 // On disabling ReportWheelOverscroll, overscroll is not reported on MouseWh eel.
7936 webViewHelper.webView()->settings()->setReportWheelOverscroll(false); 7986 webViewHelper.webView()->settings()->setReportWheelOverscroll(false);
7937 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); 7987 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
(...skipping 18 matching lines...) Expand all
7956 8006
7957 TEST_F(WebFrameTest, MaxFramesDetach) 8007 TEST_F(WebFrameTest, MaxFramesDetach)
7958 { 8008 {
7959 registerMockedHttpURLLoad("max-frames-detach.html"); 8009 registerMockedHttpURLLoad("max-frames-detach.html");
7960 FrameTestHelpers::WebViewHelper webViewHelper; 8010 FrameTestHelpers::WebViewHelper webViewHelper;
7961 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true); 8011 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true);
7962 webViewImpl->mainFrameImpl()->collectGarbage(); 8012 webViewImpl->mainFrameImpl()->collectGarbage();
7963 } 8013 }
7964 8014
7965 } // namespace blink 8015 } // namespace blink
OLDNEW
« 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