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

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: 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 7671 matching lines...) Expand 10 before | Expand all | Expand 10 after
7682 view->close(); 7682 view->close();
7683 } 7683 }
7684 7684
7685 class OverscrollWebViewClient : public FrameTestHelpers::TestWebViewClient { 7685 class OverscrollWebViewClient : public FrameTestHelpers::TestWebViewClient {
7686 public: 7686 public:
7687 MOCK_METHOD4(didOverscroll, void(const WebFloatSize&, const WebFloatSize&, c onst WebFloatPoint&, const WebFloatSize&)); 7687 MOCK_METHOD4(didOverscroll, void(const WebFloatSize&, const WebFloatSize&, c onst WebFloatPoint&, const WebFloatSize&));
7688 }; 7688 };
7689 7689
7690 class WebFrameOverscrollTest : public WebFrameTest { 7690 class WebFrameOverscrollTest : public WebFrameTest {
7691 protected: 7691 protected:
7692 WebGestureEvent generateEvent(WebInputEvent::Type type, int deltaX = 0, int deltaY = 0) 7692 WebGestureEvent generateEvent(WebInputEvent::Type type, float deltaX = 0.0, float deltaY = 0.0)
7693 { 7693 {
7694 WebGestureEvent event; 7694 WebGestureEvent event;
7695 event.type = type; 7695 event.type = type;
7696 event.x = 100; 7696 event.x = 100;
7697 event.y = 100; 7697 event.y = 100;
7698 if (type == WebInputEvent::GestureScrollUpdate) { 7698 if (type == WebInputEvent::GestureScrollUpdate) {
7699 event.data.scrollUpdate.deltaX = deltaX; 7699 event.data.scrollUpdate.deltaX = deltaX;
7700 event.data.scrollUpdate.deltaY = deltaY; 7700 event.data.scrollUpdate.deltaY = deltaY;
7701 } 7701 }
7702 return event; 7702 return event;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
7917 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, 0), WebFloatSize(-20, -3 0), WebFloatPoint(33, 33), WebFloatSize())); 7917 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, 0), WebFloatSize(-20, -3 0), WebFloatPoint(33, 33), WebFloatSize()));
7918 ScrollUpdate(&webViewHelper, 30, 0); 7918 ScrollUpdate(&webViewHelper, 30, 0);
7919 Mock::VerifyAndClearExpectations(&client); 7919 Mock::VerifyAndClearExpectations(&client);
7920 7920
7921 // Overscroll is not reported. 7921 // Overscroll is not reported.
7922 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(33, 33), WebFloatSize())).Times(0); 7922 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(33, 33), WebFloatSize())).Times(0);
7923 ScrollEnd(&webViewHelper); 7923 ScrollEnd(&webViewHelper);
7924 Mock::VerifyAndClearExpectations(&client); 7924 Mock::VerifyAndClearExpectations(&client);
7925 } 7925 }
7926 7926
7927 TEST_F(WebFrameOverscrollTest, NoOverscrollForSmallvalues)
7928 {
7929 OverscrollWebViewClient client;
7930 registerMockedHttpURLLoad("overscroll/overscroll.html");
7931 FrameTestHelpers::WebViewHelper webViewHelper;
7932 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr ue, 0, &client, configureAndroid);
7933
7934 ScrollBegin(&webViewHelper);
7935 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, -10), WebFloatSize(-10, -10), WebFloatPoint(100, 100), WebFloatSize()));
7936 ScrollUpdate(&webViewHelper, 10, 10);
7937 Mock::VerifyAndClearExpectations(&client);
7938
7939 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -0.10), WebFloatSize(-10, -10.10), WebFloatPoint(100, 100), WebFloatSize()));
7940 ScrollUpdate(&webViewHelper, 0, 0.10);
7941 Mock::VerifyAndClearExpectations(&client);
7942
7943 EXPECT_CALL(client, didOverscroll(WebFloatSize(-0.10, 0), WebFloatSize(-10.1 0, -10.10), WebFloatPoint(100, 100), WebFloatSize()));
7944 ScrollUpdate(&webViewHelper, 0.10, 0);
7945 Mock::VerifyAndClearExpectations(&client);
7946
7947 // For residual values overscrollDelta should be reset and didOverscroll sho uldn't be called.
7948 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7949 ScrollUpdate(&webViewHelper, 0, 0.09);
7950 Mock::VerifyAndClearExpectations(&client);
7951
7952 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7953 ScrollUpdate(&webViewHelper, 0.09, 0.09);
7954 Mock::VerifyAndClearExpectations(&client);
7955
7956 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7957 ScrollUpdate(&webViewHelper, 0.09, 0);
7958 Mock::VerifyAndClearExpectations(&client);
7959
7960 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7961 ScrollUpdate(&webViewHelper, 0, -0.09);
7962 Mock::VerifyAndClearExpectations(&client);
7963
7964 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7965 ScrollUpdate(&webViewHelper, -0.09, -0.09);
7966 Mock::VerifyAndClearExpectations(&client);
7967
7968 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7969 ScrollUpdate(&webViewHelper, -0.09, 0);
7970 Mock::VerifyAndClearExpectations(&client);
7971
7972 // Overscroll is not reported.
majidvp 2015/07/09 19:00:35 nit: this comment does not add any value.
7973 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
7974 ScrollEnd(&webViewHelper);
7975 Mock::VerifyAndClearExpectations(&client);
7976 }
7977
7927 TEST_F(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll) 7978 TEST_F(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll)
7928 { 7979 {
7929 OverscrollWebViewClient client; 7980 OverscrollWebViewClient client;
7930 registerMockedHttpURLLoad("overscroll/overscroll.html"); 7981 registerMockedHttpURLLoad("overscroll/overscroll.html");
7931 FrameTestHelpers::WebViewHelper webViewHelper; 7982 FrameTestHelpers::WebViewHelper webViewHelper;
7932 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);
7933 7984
7934 // On disabling ReportWheelOverscroll, overscroll is not reported on MouseWh eel. 7985 // On disabling ReportWheelOverscroll, overscroll is not reported on MouseWh eel.
7935 webViewHelper.webView()->settings()->setReportWheelOverscroll(false); 7986 webViewHelper.webView()->settings()->setReportWheelOverscroll(false);
7936 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(), WebFloatSize())).Times(0); 7987 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(), WebFloatSize())).Times(0);
(...skipping 18 matching lines...) Expand all
7955 8006
7956 TEST_F(WebFrameTest, MaxFramesDetach) 8007 TEST_F(WebFrameTest, MaxFramesDetach)
7957 { 8008 {
7958 registerMockedHttpURLLoad("max-frames-detach.html"); 8009 registerMockedHttpURLLoad("max-frames-detach.html");
7959 FrameTestHelpers::WebViewHelper webViewHelper; 8010 FrameTestHelpers::WebViewHelper webViewHelper;
7960 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true); 8011 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true);
7961 webViewImpl->mainFrameImpl()->collectGarbage(); 8012 webViewImpl->mainFrameImpl()->collectGarbage();
7962 } 8013 }
7963 8014
7964 } // 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