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

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 1195803003: Report accurate Overscroll on handleWheel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed unittest failures 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/web/WebSettingsImpl.cpp ('k') | public/web/WebSettings.h » ('j') | 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 7616 matching lines...) Expand 10 before | Expand all | Expand 10 after
7627 event.type = type; 7627 event.type = type;
7628 event.x = 100; 7628 event.x = 100;
7629 event.y = 100; 7629 event.y = 100;
7630 if (type == WebInputEvent::GestureScrollUpdate) { 7630 if (type == WebInputEvent::GestureScrollUpdate) {
7631 event.data.scrollUpdate.deltaX = deltaX; 7631 event.data.scrollUpdate.deltaX = deltaX;
7632 event.data.scrollUpdate.deltaY = deltaY; 7632 event.data.scrollUpdate.deltaY = deltaY;
7633 } 7633 }
7634 return event; 7634 return event;
7635 } 7635 }
7636 7636
7637 void ScrollByWheel(FrameTestHelpers::WebViewHelper* webViewHelper, int windo wX, int windowY, float deltaX, float deltaY)
7638 {
7639 WebMouseWheelEvent event;
7640 event.type = WebInputEvent::MouseWheel;
7641 event.deltaX = deltaX;
7642 event.deltaY = deltaY;
7643 event.windowX = windowX;
7644 event.windowY = windowY;
7645 event.canScroll = true;
7646 webViewHelper->webViewImpl()->handleInputEvent(event);
7647 }
7648
7637 void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) 7649 void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper)
7638 { 7650 {
7639 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve nt::GestureScrollBegin)); 7651 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve nt::GestureScrollBegin));
7640 } 7652 }
7641 7653
7642 void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, float delt aX, float deltaY) 7654 void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, float delt aX, float deltaY)
7643 { 7655 {
7644 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve nt::GestureScrollUpdate, deltaX, deltaY)); 7656 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve nt::GestureScrollUpdate, deltaX, deltaY));
7645 } 7657 }
7646 7658
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
7837 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, 0), WebFloatSize(-20, -3 0), WebFloatPoint(33, 33), WebFloatSize())); 7849 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, 0), WebFloatSize(-20, -3 0), WebFloatPoint(33, 33), WebFloatSize()));
7838 ScrollUpdate(&webViewHelper, 30, 0); 7850 ScrollUpdate(&webViewHelper, 30, 0);
7839 Mock::VerifyAndClearExpectations(&client); 7851 Mock::VerifyAndClearExpectations(&client);
7840 7852
7841 // Overscroll is not reported. 7853 // Overscroll is not reported.
7842 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(33, 33), WebFloatSize())).Times(0); 7854 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(33, 33), WebFloatSize())).Times(0);
7843 ScrollEnd(&webViewHelper); 7855 ScrollEnd(&webViewHelper);
7844 Mock::VerifyAndClearExpectations(&client); 7856 Mock::VerifyAndClearExpectations(&client);
7845 } 7857 }
7846 7858
7859 TEST_F(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll)
7860 {
7861 OverscrollWebViewClient client;
7862 registerMockedHttpURLLoad("overscroll/overscroll.html");
7863 FrameTestHelpers::WebViewHelper webViewHelper;
7864 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr ue, 0, &client, configureAndroid);
7865
7866 // On disabling ReportWheelOverscroll, overscroll is not reported on MouseWh eel.
7867 webViewHelper.webView()->settings()->setReportWheelOverscroll(false);
7868 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(), WebFloatSize())).Times(0);
7869 ScrollByWheel(&webViewHelper, 10, 10, 1000, 1000);
7870 Mock::VerifyAndClearExpectations(&client);
7871
7872 // On enabling ReportWheelOverscroll, overscroll is reported on MouseWheel.
7873 webViewHelper.webView()->settings()->setReportWheelOverscroll(true);
7874 EXPECT_CALL(client, didOverscroll(WebFloatSize(-1000, -1000), WebFloatSize(- 1000, -1000), WebFloatPoint(), WebFloatSize()));
7875 ScrollByWheel(&webViewHelper, 10, 10, 1000, 1000);
7876 Mock::VerifyAndClearExpectations(&client);
7877 }
7878
7847 TEST_F(WebFrameTest, OrientationFrameDetach) 7879 TEST_F(WebFrameTest, OrientationFrameDetach)
7848 { 7880 {
7849 RuntimeEnabledFeatures::setOrientationEventEnabled(true); 7881 RuntimeEnabledFeatures::setOrientationEventEnabled(true);
7850 registerMockedHttpURLLoad("orientation-frame-detach.html"); 7882 registerMockedHttpURLLoad("orientation-frame-detach.html");
7851 FrameTestHelpers::WebViewHelper webViewHelper; 7883 FrameTestHelpers::WebViewHelper webViewHelper;
7852 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "orie ntation-frame-detach.html", true); 7884 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "orie ntation-frame-detach.html", true);
7853 webViewImpl->mainFrameImpl()->sendOrientationChangeEvent(); 7885 webViewImpl->mainFrameImpl()->sendOrientationChangeEvent();
7854 } 7886 }
7855 7887
7856 TEST_F(WebFrameTest, MaxFramesDetach) 7888 TEST_F(WebFrameTest, MaxFramesDetach)
7857 { 7889 {
7858 registerMockedHttpURLLoad("max-frames-detach.html"); 7890 registerMockedHttpURLLoad("max-frames-detach.html");
7859 FrameTestHelpers::WebViewHelper webViewHelper; 7891 FrameTestHelpers::WebViewHelper webViewHelper;
7860 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true); 7892 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true);
7861 webViewImpl->mainFrameImpl()->collectGarbage(); 7893 webViewImpl->mainFrameImpl()->collectGarbage();
7862 } 7894 }
7863 7895
7864 } // namespace blink 7896 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebSettingsImpl.cpp ('k') | public/web/WebSettings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698