| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/events/blink/input_handler_proxy.h" | 5 #include "ui/events/blink/input_handler_proxy.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/test/histogram_tester.h" | 10 #include "base/test/histogram_tester.h" |
| (...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) | 1700 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) |
| 1701 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); | 1701 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); |
| 1702 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 1702 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 1703 .WillOnce(testing::Return(kImplThreadScrollState)); | 1703 .WillOnce(testing::Return(kImplThreadScrollState)); |
| 1704 EXPECT_CALL( | 1704 EXPECT_CALL( |
| 1705 mock_input_handler_, | 1705 mock_input_handler_, |
| 1706 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Lt(0)))) | 1706 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Lt(0)))) |
| 1707 .WillOnce(testing::Return(overscroll)); | 1707 .WillOnce(testing::Return(overscroll)); |
| 1708 EXPECT_CALL( | 1708 EXPECT_CALL( |
| 1709 mock_client_, | 1709 mock_client_, |
| 1710 DidOverscroll( | 1710 DidOverscroll(overscroll.accumulated_root_overscroll, |
| 1711 overscroll.accumulated_root_overscroll, | 1711 overscroll.unused_scroll_delta, |
| 1712 overscroll.unused_scroll_delta, | 1712 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)), |
| 1713 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)), | 1713 testing::_)); |
| 1714 testing::_)); | |
| 1715 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); | 1714 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); |
| 1716 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); | 1715 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); |
| 1717 time += base::TimeDelta::FromMilliseconds(100); | 1716 time += base::TimeDelta::FromMilliseconds(100); |
| 1718 Animate(time); | 1717 Animate(time); |
| 1719 VERIFY_AND_RESET_MOCKS(); | 1718 VERIFY_AND_RESET_MOCKS(); |
| 1720 | 1719 |
| 1721 // The next call to animate will no longer scroll vertically. | 1720 // The next call to animate will no longer scroll vertically. |
| 1722 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); | 1721 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); |
| 1723 EXPECT_CALL(mock_input_handler_, | 1722 EXPECT_CALL(mock_input_handler_, |
| 1724 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) | 1723 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 | 1857 |
| 1859 // The third animate hits the bottom content edge. | 1858 // The third animate hits the bottom content edge. |
| 1860 overscroll.accumulated_root_overscroll = gfx::Vector2dF(0, 100); | 1859 overscroll.accumulated_root_overscroll = gfx::Vector2dF(0, 100); |
| 1861 overscroll.unused_scroll_delta = gfx::Vector2dF(0, 100); | 1860 overscroll.unused_scroll_delta = gfx::Vector2dF(0, 100); |
| 1862 EXPECT_CALL( | 1861 EXPECT_CALL( |
| 1863 mock_input_handler_, | 1862 mock_input_handler_, |
| 1864 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Lt(0)))) | 1863 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Lt(0)))) |
| 1865 .WillOnce(testing::Return(overscroll)); | 1864 .WillOnce(testing::Return(overscroll)); |
| 1866 EXPECT_CALL( | 1865 EXPECT_CALL( |
| 1867 mock_client_, | 1866 mock_client_, |
| 1868 DidOverscroll( | 1867 DidOverscroll(overscroll.accumulated_root_overscroll, |
| 1869 overscroll.accumulated_root_overscroll, | 1868 overscroll.unused_scroll_delta, |
| 1870 overscroll.unused_scroll_delta, | 1869 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)), |
| 1871 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)), | 1870 testing::_)); |
| 1872 testing::_)); | |
| 1873 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); | 1871 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); |
| 1874 time += base::TimeDelta::FromMilliseconds(10); | 1872 time += base::TimeDelta::FromMilliseconds(10); |
| 1875 Animate(time); | 1873 Animate(time); |
| 1876 VERIFY_AND_RESET_MOCKS(); | 1874 VERIFY_AND_RESET_MOCKS(); |
| 1877 | 1875 |
| 1878 // The next call to animate will no longer scroll vertically. | 1876 // The next call to animate will no longer scroll vertically. |
| 1879 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); | 1877 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); |
| 1880 EXPECT_CALL( | 1878 EXPECT_CALL( |
| 1881 mock_input_handler_, | 1879 mock_input_handler_, |
| 1882 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Eq(0)))) | 1880 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Eq(0)))) |
| 1883 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1881 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1884 time += base::TimeDelta::FromMilliseconds(10); | 1882 time += base::TimeDelta::FromMilliseconds(10); |
| 1885 Animate(time); | 1883 Animate(time); |
| 1886 VERIFY_AND_RESET_MOCKS(); | 1884 VERIFY_AND_RESET_MOCKS(); |
| 1887 | 1885 |
| 1888 // The next call will hit the right edge. | 1886 // The next call will hit the right edge. |
| 1889 overscroll.accumulated_root_overscroll = gfx::Vector2dF(100, 100); | 1887 overscroll.accumulated_root_overscroll = gfx::Vector2dF(100, 100); |
| 1890 overscroll.unused_scroll_delta = gfx::Vector2dF(100, 0); | 1888 overscroll.unused_scroll_delta = gfx::Vector2dF(100, 0); |
| 1891 EXPECT_CALL( | 1889 EXPECT_CALL( |
| 1892 mock_input_handler_, | 1890 mock_input_handler_, |
| 1893 ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0)))) | 1891 ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0)))) |
| 1894 .WillOnce(testing::Return(overscroll)); | 1892 .WillOnce(testing::Return(overscroll)); |
| 1895 EXPECT_CALL( | 1893 EXPECT_CALL( |
| 1896 mock_client_, | 1894 mock_client_, |
| 1897 DidOverscroll( | 1895 DidOverscroll(overscroll.accumulated_root_overscroll, |
| 1898 overscroll.accumulated_root_overscroll, | 1896 overscroll.unused_scroll_delta, |
| 1899 overscroll.unused_scroll_delta, | 1897 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)), |
| 1900 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)), | 1898 testing::_)); |
| 1901 testing::_)); | |
| 1902 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); | 1899 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); |
| 1903 time += base::TimeDelta::FromMilliseconds(10); | 1900 time += base::TimeDelta::FromMilliseconds(10); |
| 1904 Animate(time); | 1901 Animate(time); |
| 1905 VERIFY_AND_RESET_MOCKS(); | 1902 VERIFY_AND_RESET_MOCKS(); |
| 1906 | 1903 |
| 1907 // The next call to animate will no longer scroll horizontally or vertically, | 1904 // The next call to animate will no longer scroll horizontally or vertically, |
| 1908 // and the fling should be cancelled. | 1905 // and the fling should be cancelled. |
| 1909 EXPECT_SET_NEEDS_ANIMATE_INPUT(0); | 1906 EXPECT_SET_NEEDS_ANIMATE_INPUT(0); |
| 1910 EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0); | 1907 EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0); |
| 1911 time += base::TimeDelta::FromMilliseconds(10); | 1908 time += base::TimeDelta::FromMilliseconds(10); |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2787 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1), | 2784 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1), |
| 2788 base::Bucket(5, 1), base::Bucket(14, 1))); | 2785 base::Bucket(5, 1), base::Bucket(14, 1))); |
| 2789 } | 2786 } |
| 2790 | 2787 |
| 2791 | 2788 |
| 2792 INSTANTIATE_TEST_CASE_P(AnimateInput, | 2789 INSTANTIATE_TEST_CASE_P(AnimateInput, |
| 2793 InputHandlerProxyTest, | 2790 InputHandlerProxyTest, |
| 2794 testing::ValuesIn(test_types)); | 2791 testing::ValuesIn(test_types)); |
| 2795 } // namespace test | 2792 } // namespace test |
| 2796 } // namespace ui | 2793 } // namespace ui |
| OLD | NEW |