OLD | NEW |
---|---|
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 7604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7615 event.type = type; | 7615 event.type = type; |
7616 event.x = 100; | 7616 event.x = 100; |
7617 event.y = 100; | 7617 event.y = 100; |
7618 if (type == WebInputEvent::GestureScrollUpdate) { | 7618 if (type == WebInputEvent::GestureScrollUpdate) { |
7619 event.data.scrollUpdate.deltaX = deltaX; | 7619 event.data.scrollUpdate.deltaX = deltaX; |
7620 event.data.scrollUpdate.deltaY = deltaY; | 7620 event.data.scrollUpdate.deltaY = deltaY; |
7621 } | 7621 } |
7622 return event; | 7622 return event; |
7623 } | 7623 } |
7624 | 7624 |
7625 void ScrollByWheel(FrameTestHelpers::WebViewHelper* webViewHelper, int windo wX, int windowY, float deltaX, float deltaY) | |
7626 { | |
7627 WebMouseWheelEvent event; | |
7628 event.type = WebInputEvent::MouseWheel; | |
7629 event.deltaX = deltaX; | |
7630 event.deltaY = deltaY; | |
7631 event.windowX = windowX; | |
7632 event.windowY = windowY; | |
7633 event.canScroll = true; | |
7634 webViewHelper->webViewImpl()->handleInputEvent(event); | |
7635 } | |
7636 | |
7625 void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) | 7637 void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) |
7626 { | 7638 { |
7627 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve nt::GestureScrollBegin)); | 7639 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve nt::GestureScrollBegin)); |
7628 } | 7640 } |
7629 | 7641 |
7630 void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, float delt aX, float deltaY) | 7642 void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, float delt aX, float deltaY) |
7631 { | 7643 { |
7632 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve nt::GestureScrollUpdate, deltaX, deltaY)); | 7644 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve nt::GestureScrollUpdate, deltaX, deltaY)); |
7633 } | 7645 } |
7634 | 7646 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7825 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, 0), WebFloatSize(-20, -3 0), WebFloatPoint(33, 33), WebFloatSize())); | 7837 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, 0), WebFloatSize(-20, -3 0), WebFloatPoint(33, 33), WebFloatSize())); |
7826 ScrollUpdate(&webViewHelper, 30, 0); | 7838 ScrollUpdate(&webViewHelper, 30, 0); |
7827 Mock::VerifyAndClearExpectations(&client); | 7839 Mock::VerifyAndClearExpectations(&client); |
7828 | 7840 |
7829 // Overscroll is not reported. | 7841 // Overscroll is not reported. |
7830 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(33, 33), WebFloatSize())).Times(0); | 7842 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(33, 33), WebFloatSize())).Times(0); |
7831 ScrollEnd(&webViewHelper); | 7843 ScrollEnd(&webViewHelper); |
7832 Mock::VerifyAndClearExpectations(&client); | 7844 Mock::VerifyAndClearExpectations(&client); |
7833 } | 7845 } |
7834 | 7846 |
7847 TEST_F(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll) | |
7848 { | |
7849 OverscrollWebViewClient client; | |
7850 registerMockedHttpURLLoad("overscroll/overscroll.html"); | |
7851 FrameTestHelpers::WebViewHelper webViewHelper; | |
7852 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr ue, 0, &client, configureAndroid); | |
7853 | |
7854 // On disabling elasticoverscroll, overscroll is not reported on MouseWheel. | |
bokan
2015/06/26 17:40:41
Nit: s/elasticoverscroll/reportsWheelOverscroll
MuVen
2015/06/29 13:27:17
Done.
| |
7855 webViewHelper.webView()->settings()->setReportWheelOverscroll(false); | |
7856 EXPECT_CALL(client, didOverscroll(WebFloatSize(), WebFloatSize(), WebFloatPo int(), WebFloatSize())).Times(0); | |
7857 ScrollByWheel(&webViewHelper, 10, 10, 1000, 1000); | |
7858 Mock::VerifyAndClearExpectations(&client); | |
7859 | |
7860 // On enabling elasticoverscroll, overscroll is reported on MouseWheel. | |
7861 webViewHelper.webView()->settings()->setReportWheelOverscroll(true); | |
7862 EXPECT_CALL(client, didOverscroll(WebFloatSize(1000, 1000), WebFloatSize(100 0, 1000), WebFloatPoint(), WebFloatSize())); | |
7863 ScrollByWheel(&webViewHelper, 10, 10, 1000, 1000); | |
7864 Mock::VerifyAndClearExpectations(&client); | |
7865 } | |
7866 | |
7835 TEST_F(WebFrameTest, OrientationFrameDetach) | 7867 TEST_F(WebFrameTest, OrientationFrameDetach) |
7836 { | 7868 { |
7837 RuntimeEnabledFeatures::setOrientationEventEnabled(true); | 7869 RuntimeEnabledFeatures::setOrientationEventEnabled(true); |
7838 registerMockedHttpURLLoad("orientation-frame-detach.html"); | 7870 registerMockedHttpURLLoad("orientation-frame-detach.html"); |
7839 FrameTestHelpers::WebViewHelper webViewHelper; | 7871 FrameTestHelpers::WebViewHelper webViewHelper; |
7840 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "orie ntation-frame-detach.html", true); | 7872 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "orie ntation-frame-detach.html", true); |
7841 webViewImpl->mainFrameImpl()->sendOrientationChangeEvent(); | 7873 webViewImpl->mainFrameImpl()->sendOrientationChangeEvent(); |
7842 } | 7874 } |
7843 | 7875 |
7844 TEST_F(WebFrameTest, MaxFramesDetach) | 7876 TEST_F(WebFrameTest, MaxFramesDetach) |
7845 { | 7877 { |
7846 registerMockedHttpURLLoad("max-frames-detach.html"); | 7878 registerMockedHttpURLLoad("max-frames-detach.html"); |
7847 FrameTestHelpers::WebViewHelper webViewHelper; | 7879 FrameTestHelpers::WebViewHelper webViewHelper; |
7848 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true); | 7880 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true); |
7849 webViewImpl->mainFrameImpl()->collectGarbage(); | 7881 webViewImpl->mainFrameImpl()->collectGarbage(); |
7850 } | 7882 } |
7851 | 7883 |
7852 } // namespace blink | 7884 } // namespace blink |
OLD | NEW |