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

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
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 7670 matching lines...) Expand 10 before | Expand all | Expand 10 after
7681 view->close(); 7681 view->close();
7682 } 7682 }
7683 7683
7684 class OverscrollWebViewClient : public FrameTestHelpers::TestWebViewClient { 7684 class OverscrollWebViewClient : public FrameTestHelpers::TestWebViewClient {
7685 public: 7685 public:
7686 MOCK_METHOD4(didOverscroll, void(const WebFloatSize&, const WebFloatSize&, c onst WebFloatPoint&, const WebFloatSize&)); 7686 MOCK_METHOD4(didOverscroll, void(const WebFloatSize&, const WebFloatSize&, c onst WebFloatPoint&, const WebFloatSize&));
7687 }; 7687 };
7688 7688
7689 class WebFrameOverscrollTest : public WebFrameTest { 7689 class WebFrameOverscrollTest : public WebFrameTest {
7690 protected: 7690 protected:
7691 WebGestureEvent generateEvent(WebInputEvent::Type type, int deltaX = 0, int deltaY = 0) 7691 WebGestureEvent generateEvent(WebInputEvent::Type type, float deltaX = 0, fl oat deltaY = 0)
7692 { 7692 {
7693 WebGestureEvent event; 7693 WebGestureEvent event;
7694 event.type = type; 7694 event.type = type;
7695 event.x = 100; 7695 event.x = 100;
7696 event.y = 100; 7696 event.y = 100;
7697 if (type == WebInputEvent::GestureScrollUpdate) { 7697 if (type == WebInputEvent::GestureScrollUpdate) {
7698 event.data.scrollUpdate.deltaX = deltaX; 7698 event.data.scrollUpdate.deltaX = deltaX;
7699 event.data.scrollUpdate.deltaY = deltaY; 7699 event.data.scrollUpdate.deltaY = deltaY;
7700 } 7700 }
7701 return event; 7701 return event;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
7916 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, 0), WebFloatSize(-20, -3 0), WebFloatPoint(33, 33), WebFloatSize())); 7916 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, 0), WebFloatSize(-20, -3 0), WebFloatPoint(33, 33), WebFloatSize()));
7917 ScrollUpdate(&webViewHelper, 30, 0); 7917 ScrollUpdate(&webViewHelper, 30, 0);
7918 Mock::VerifyAndClearExpectations(&client); 7918 Mock::VerifyAndClearExpectations(&client);
7919 7919
7920 // Overscroll is not reported. 7920 // Overscroll is not reported.
7921 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(33, 33), WebFloatSize())).Times(0); 7921 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(33, 33), WebFloatSize())).Times(0);
7922 ScrollEnd(&webViewHelper); 7922 ScrollEnd(&webViewHelper);
7923 Mock::VerifyAndClearExpectations(&client); 7923 Mock::VerifyAndClearExpectations(&client);
7924 } 7924 }
7925 7925
7926 TEST_F(WebFrameOverscrollTest, NoOverscrollForResidualvalues)
majidvp 2015/07/09 15:02:46 s/Residualvalues/SmallValues/
MuVen 2015/07/09 17:51:35 Done.
7927 {
7928 OverscrollWebViewClient client;
7929 registerMockedHttpURLLoad("overscroll/overscroll.html");
7930 FrameTestHelpers::WebViewHelper webViewHelper;
7931 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr ue, 0, &client, configureAndroid);
7932
7933 ScrollBegin(&webViewHelper);
7934 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -10.001), WebFloatSize(0, -10.001), WebFloatPoint(100, 100), WebFloatSize()));
7935 ScrollUpdate(&webViewHelper, 0, 10.001);
7936 Mock::VerifyAndClearExpectations(&client);
7937
7938 // ForResidual values overscrollDelta should be nullified and didOverscroll shouldn't be called.
majidvp 2015/07/09 15:02:46 s/ForResidual/For residual/ s/nullified/reset/
MuVen 2015/07/09 17:51:35 Done.
7939 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(100, 100), WebFloatSize())).Times(0);
majidvp 2015/07/09 15:02:46 I think these call expectations are busted. Essent
MuVen 2015/07/09 17:51:35 Done.
7940 ScrollUpdate(&webViewHelper, 0, 0.001);
7941 Mock::VerifyAndClearExpectations(&client);
7942
7943 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(100, 100), WebFloatSize())).Times(0);
7944 ScrollUpdate(&webViewHelper, 0.001, 0.001);
7945 Mock::VerifyAndClearExpectations(&client);
7946
7947 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(100, 100), WebFloatSize())).Times(0);
7948 ScrollUpdate(&webViewHelper, 0.001, 0);
majidvp 2015/07/09 15:02:46 Please use the threshold value (0.1) and a negativ
MuVen 2015/07/09 17:51:35 used threshold value(0.9) as if (std::abs(unusedD
7949 Mock::VerifyAndClearExpectations(&client);
7950
7951 // Overscroll is not reported.
7952 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(33, 33), WebFloatSize())).Times(0);
7953 ScrollEnd(&webViewHelper);
7954 Mock::VerifyAndClearExpectations(&client);
7955 }
7956
7926 TEST_F(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll) 7957 TEST_F(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll)
7927 { 7958 {
7928 OverscrollWebViewClient client; 7959 OverscrollWebViewClient client;
7929 registerMockedHttpURLLoad("overscroll/overscroll.html"); 7960 registerMockedHttpURLLoad("overscroll/overscroll.html");
7930 FrameTestHelpers::WebViewHelper webViewHelper; 7961 FrameTestHelpers::WebViewHelper webViewHelper;
7931 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr ue, 0, &client, configureAndroid); 7962 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr ue, 0, &client, configureAndroid);
7932 7963
7933 // On disabling ReportWheelOverscroll, overscroll is not reported on MouseWh eel. 7964 // On disabling ReportWheelOverscroll, overscroll is not reported on MouseWh eel.
7934 webViewHelper.webView()->settings()->setReportWheelOverscroll(false); 7965 webViewHelper.webView()->settings()->setReportWheelOverscroll(false);
7935 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(), WebFloatSize())).Times(0); 7966 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(), WebFloatSize())).Times(0);
(...skipping 18 matching lines...) Expand all
7954 7985
7955 TEST_F(WebFrameTest, MaxFramesDetach) 7986 TEST_F(WebFrameTest, MaxFramesDetach)
7956 { 7987 {
7957 registerMockedHttpURLLoad("max-frames-detach.html"); 7988 registerMockedHttpURLLoad("max-frames-detach.html");
7958 FrameTestHelpers::WebViewHelper webViewHelper; 7989 FrameTestHelpers::WebViewHelper webViewHelper;
7959 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true); 7990 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true);
7960 webViewImpl->mainFrameImpl()->collectGarbage(); 7991 webViewImpl->mainFrameImpl()->collectGarbage();
7961 } 7992 }
7962 7993
7963 } // namespace blink 7994 } // namespace blink
OLDNEW
« Source/core/input/EventHandler.cpp ('K') | « Source/core/input/EventHandler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698