| 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 "content/renderer/input/input_handler_proxy.h" | 5 #include "content/renderer/input/input_handler_proxy.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "cc/trees/swap_promise_monitor.h" | 9 #include "cc/trees/swap_promise_monitor.h" |
| 10 #include "content/common/input/did_overscroll_params.h" | 10 #include "content/common/input/did_overscroll_params.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 class MockInputHandler : public cc::InputHandler { | 75 class MockInputHandler : public cc::InputHandler { |
| 76 public: | 76 public: |
| 77 MockInputHandler() {} | 77 MockInputHandler() {} |
| 78 ~MockInputHandler() override {} | 78 ~MockInputHandler() override {} |
| 79 | 79 |
| 80 MOCK_METHOD0(PinchGestureBegin, void()); | 80 MOCK_METHOD0(PinchGestureBegin, void()); |
| 81 MOCK_METHOD2(PinchGestureUpdate, | 81 MOCK_METHOD2(PinchGestureUpdate, |
| 82 void(float magnify_delta, const gfx::Point& anchor)); | 82 void(float magnify_delta, const gfx::Point& anchor)); |
| 83 MOCK_METHOD0(PinchGestureEnd, void()); | 83 MOCK_METHOD0(PinchGestureEnd, void()); |
| 84 | 84 |
| 85 MOCK_METHOD0(SetNeedsAnimate, void()); | 85 MOCK_METHOD0(SetNeedsAnimateInput, void()); |
| 86 | 86 |
| 87 MOCK_METHOD2(ScrollBegin, | 87 MOCK_METHOD2(ScrollBegin, |
| 88 ScrollStatus(const gfx::Point& viewport_point, | 88 ScrollStatus(const gfx::Point& viewport_point, |
| 89 cc::InputHandler::ScrollInputType type)); | 89 cc::InputHandler::ScrollInputType type)); |
| 90 MOCK_METHOD2(ScrollAnimated, | 90 MOCK_METHOD2(ScrollAnimated, |
| 91 ScrollStatus(const gfx::Point& viewport_point, | 91 ScrollStatus(const gfx::Point& viewport_point, |
| 92 const gfx::Vector2dF& scroll_delta)); | 92 const gfx::Vector2dF& scroll_delta)); |
| 93 MOCK_METHOD2(ScrollBy, | 93 MOCK_METHOD2(ScrollBy, |
| 94 cc::InputHandlerScrollResult( | 94 cc::InputHandlerScrollResult( |
| 95 const gfx::Point& viewport_point, | 95 const gfx::Point& viewport_point, |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 244 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 245 gesture_.type = WebInputEvent::GestureScrollBegin; | 245 gesture_.type = WebInputEvent::GestureScrollBegin; |
| 246 gesture_.sourceDevice = source_device; | 246 gesture_.sourceDevice = source_device; |
| 247 EXPECT_EQ(expected_disposition_, | 247 EXPECT_EQ(expected_disposition_, |
| 248 input_handler_->HandleInputEvent(gesture_)); | 248 input_handler_->HandleInputEvent(gesture_)); |
| 249 | 249 |
| 250 VERIFY_AND_RESET_MOCKS(); | 250 VERIFY_AND_RESET_MOCKS(); |
| 251 | 251 |
| 252 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) | 252 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) |
| 253 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 253 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 254 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 254 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 255 | 255 |
| 256 gesture_ = | 256 gesture_ = |
| 257 CreateFling(timestamp, source_device, velocity, position, position, 0); | 257 CreateFling(timestamp, source_device, velocity, position, position, 0); |
| 258 EXPECT_EQ(expected_disposition_, | 258 EXPECT_EQ(expected_disposition_, |
| 259 input_handler_->HandleInputEvent(gesture_)); | 259 input_handler_->HandleInputEvent(gesture_)); |
| 260 | 260 |
| 261 VERIFY_AND_RESET_MOCKS(); | 261 VERIFY_AND_RESET_MOCKS(); |
| 262 } | 262 } |
| 263 | 263 |
| 264 void CancelFling(base::TimeTicks timestamp) { | 264 void CancelFling(base::TimeTicks timestamp) { |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 } | 546 } |
| 547 | 547 |
| 548 TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchpad) { | 548 TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchpad) { |
| 549 // We shouldn't send any events to the widget for this gesture. | 549 // We shouldn't send any events to the widget for this gesture. |
| 550 expected_disposition_ = InputHandlerProxy::DID_HANDLE; | 550 expected_disposition_ = InputHandlerProxy::DID_HANDLE; |
| 551 VERIFY_AND_RESET_MOCKS(); | 551 VERIFY_AND_RESET_MOCKS(); |
| 552 | 552 |
| 553 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 553 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 554 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 554 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 555 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 555 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 556 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 556 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 557 | 557 |
| 558 gesture_.type = WebInputEvent::GestureFlingStart; | 558 gesture_.type = WebInputEvent::GestureFlingStart; |
| 559 gesture_.data.flingStart.velocityX = 10; | 559 gesture_.data.flingStart.velocityX = 10; |
| 560 gesture_.sourceDevice = blink::WebGestureDeviceTouchpad; | 560 gesture_.sourceDevice = blink::WebGestureDeviceTouchpad; |
| 561 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 561 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 562 | 562 |
| 563 VERIFY_AND_RESET_MOCKS(); | 563 VERIFY_AND_RESET_MOCKS(); |
| 564 | 564 |
| 565 // Verify that a GestureFlingCancel during an animation cancels it. | 565 // Verify that a GestureFlingCancel during an animation cancels it. |
| 566 gesture_.type = WebInputEvent::GestureFlingCancel; | 566 gesture_.type = WebInputEvent::GestureFlingCancel; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 WebPoint fling_point = WebPoint(7, 13); | 626 WebPoint fling_point = WebPoint(7, 13); |
| 627 WebPoint fling_global_point = WebPoint(17, 23); | 627 WebPoint fling_global_point = WebPoint(17, 23); |
| 628 // Note that for trackpad, wheel events with the Control modifier are | 628 // Note that for trackpad, wheel events with the Control modifier are |
| 629 // special (reserved for zoom), so don't set that here. | 629 // special (reserved for zoom), so don't set that here. |
| 630 int modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey; | 630 int modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey; |
| 631 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad, | 631 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad, |
| 632 fling_delta, | 632 fling_delta, |
| 633 fling_point, | 633 fling_point, |
| 634 fling_global_point, | 634 fling_global_point, |
| 635 modifiers); | 635 modifiers); |
| 636 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 636 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 637 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 637 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 638 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 638 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 639 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 639 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 640 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 640 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 641 | 641 |
| 642 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 642 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 643 // The first animate call should let us pick up an animation start time, but | 643 // The first animate call should let us pick up an animation start time, but |
| 644 // we shouldn't actually move anywhere just yet. The first frame after the | 644 // we shouldn't actually move anywhere just yet. The first frame after the |
| 645 // fling start will typically include the last scroll from the gesture that | 645 // fling start will typically include the last scroll from the gesture that |
| 646 // lead to the scroll (either wheel or gesture scroll), so there should be no | 646 // lead to the scroll (either wheel or gesture scroll), so there should be no |
| 647 // visible hitch. | 647 // visible hitch. |
| 648 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 648 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 649 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 649 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 650 .Times(0); | 650 .Times(0); |
| 651 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); | 651 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); |
| 652 input_handler_->Animate(time); | 652 input_handler_->Animate(time); |
| 653 | 653 |
| 654 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 654 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 655 | 655 |
| 656 // The second call should start scrolling in the -X direction. | 656 // The second call should start scrolling in the -X direction. |
| 657 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 657 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 658 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 658 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 659 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 659 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 660 EXPECT_CALL(mock_input_handler_, | 660 EXPECT_CALL(mock_input_handler_, |
| 661 ScrollBy(testing::_, | 661 ScrollBy(testing::_, |
| 662 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) | 662 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) |
| 663 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 663 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 664 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 664 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 665 time += base::TimeDelta::FromMilliseconds(100); | 665 time += base::TimeDelta::FromMilliseconds(100); |
| 666 input_handler_->Animate(time); | 666 input_handler_->Animate(time); |
| 667 | 667 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 testing::Field(&WebSize::width, testing::Gt(0)))))); | 700 testing::Field(&WebSize::width, testing::Gt(0)))))); |
| 701 time += base::TimeDelta::FromMilliseconds(100); | 701 time += base::TimeDelta::FromMilliseconds(100); |
| 702 input_handler_->Animate(time); | 702 input_handler_->Animate(time); |
| 703 | 703 |
| 704 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 704 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 705 testing::Mock::VerifyAndClearExpectations(&mock_client_); | 705 testing::Mock::VerifyAndClearExpectations(&mock_client_); |
| 706 | 706 |
| 707 // Since we've aborted the fling, the next animation should be a no-op and | 707 // Since we've aborted the fling, the next animation should be a no-op and |
| 708 // should not result in another | 708 // should not result in another |
| 709 // frame being requested. | 709 // frame being requested. |
| 710 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()).Times(0); | 710 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()).Times(0); |
| 711 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 711 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 712 .Times(0); | 712 .Times(0); |
| 713 time += base::TimeDelta::FromMilliseconds(100); | 713 time += base::TimeDelta::FromMilliseconds(100); |
| 714 input_handler_->Animate(time); | 714 input_handler_->Animate(time); |
| 715 | 715 |
| 716 // Since we've transferred the fling to the main thread, we need to pass the | 716 // Since we've transferred the fling to the main thread, we need to pass the |
| 717 // next GestureFlingCancel to the main | 717 // next GestureFlingCancel to the main |
| 718 // thread as well. | 718 // thread as well. |
| 719 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; | 719 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; |
| 720 gesture_.type = WebInputEvent::GestureFlingCancel; | 720 gesture_.type = WebInputEvent::GestureFlingCancel; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 731 WebPoint fling_point = WebPoint(7, 13); | 731 WebPoint fling_point = WebPoint(7, 13); |
| 732 WebPoint fling_global_point = WebPoint(17, 23); | 732 WebPoint fling_global_point = WebPoint(17, 23); |
| 733 // Note that for trackpad, wheel events with the Control modifier are | 733 // Note that for trackpad, wheel events with the Control modifier are |
| 734 // special (reserved for zoom), so don't set that here. | 734 // special (reserved for zoom), so don't set that here. |
| 735 int modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey; | 735 int modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey; |
| 736 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad, | 736 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad, |
| 737 fling_delta, | 737 fling_delta, |
| 738 fling_point, | 738 fling_point, |
| 739 fling_global_point, | 739 fling_global_point, |
| 740 modifiers); | 740 modifiers); |
| 741 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 741 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 742 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 742 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 743 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 743 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 744 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 744 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 745 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 745 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 746 | 746 |
| 747 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 747 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 748 | 748 |
| 749 // Start the fling animation at time 10. This shouldn't actually scroll, just | 749 // Start the fling animation at time 10. This shouldn't actually scroll, just |
| 750 // establish a start time. | 750 // establish a start time. |
| 751 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 751 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 752 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 752 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 753 .Times(0); | 753 .Times(0); |
| 754 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); | 754 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); |
| 755 input_handler_->Animate(time); | 755 input_handler_->Animate(time); |
| 756 | 756 |
| 757 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 757 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 758 | 758 |
| 759 // The second call should start scrolling in the -X direction. | 759 // The second call should start scrolling in the -X direction. |
| 760 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 760 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 761 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 761 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 762 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 762 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 763 EXPECT_CALL(mock_input_handler_, | 763 EXPECT_CALL(mock_input_handler_, |
| 764 ScrollBy(testing::_, | 764 ScrollBy(testing::_, |
| 765 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) | 765 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) |
| 766 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 766 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 767 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 767 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 768 time += base::TimeDelta::FromMilliseconds(100); | 768 time += base::TimeDelta::FromMilliseconds(100); |
| 769 input_handler_->Animate(time); | 769 input_handler_->Animate(time); |
| 770 | 770 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 testing::Field(&WebSize::width, testing::Gt(0)))))); | 804 testing::Field(&WebSize::width, testing::Gt(0)))))); |
| 805 time += base::TimeDelta::FromMilliseconds(100); | 805 time += base::TimeDelta::FromMilliseconds(100); |
| 806 input_handler_->Animate(time); | 806 input_handler_->Animate(time); |
| 807 | 807 |
| 808 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 808 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 809 testing::Mock::VerifyAndClearExpectations(&mock_client_); | 809 testing::Mock::VerifyAndClearExpectations(&mock_client_); |
| 810 | 810 |
| 811 // Since we've aborted the fling, the next animation should be a no-op and | 811 // Since we've aborted the fling, the next animation should be a no-op and |
| 812 // should not result in another | 812 // should not result in another |
| 813 // frame being requested. | 813 // frame being requested. |
| 814 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()).Times(0); | 814 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()).Times(0); |
| 815 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 815 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 816 .Times(0); | 816 .Times(0); |
| 817 time += base::TimeDelta::FromMilliseconds(100); | 817 time += base::TimeDelta::FromMilliseconds(100); |
| 818 input_handler_->Animate(time); | 818 input_handler_->Animate(time); |
| 819 | 819 |
| 820 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 820 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 821 | 821 |
| 822 // Since we've transferred the fling to the main thread, we need to pass the | 822 // Since we've transferred the fling to the main thread, we need to pass the |
| 823 // next GestureFlingCancel to the main | 823 // next GestureFlingCancel to the main |
| 824 // thread as well. | 824 // thread as well. |
| 825 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; | 825 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; |
| 826 gesture_.type = WebInputEvent::GestureFlingCancel; | 826 gesture_.type = WebInputEvent::GestureFlingCancel; |
| 827 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 827 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 828 | 828 |
| 829 VERIFY_AND_RESET_MOCKS(); | 829 VERIFY_AND_RESET_MOCKS(); |
| 830 input_handler_->MainThreadHasStoppedFlinging(); | 830 input_handler_->MainThreadHasStoppedFlinging(); |
| 831 | 831 |
| 832 // Start a second gesture fling, this time in the +Y direction with no X. | 832 // Start a second gesture fling, this time in the +Y direction with no X. |
| 833 fling_delta = WebFloatPoint(0, -1000); | 833 fling_delta = WebFloatPoint(0, -1000); |
| 834 fling_point = WebPoint(95, 87); | 834 fling_point = WebPoint(95, 87); |
| 835 fling_global_point = WebPoint(32, 71); | 835 fling_global_point = WebPoint(32, 71); |
| 836 modifiers = WebInputEvent::AltKey; | 836 modifiers = WebInputEvent::AltKey; |
| 837 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad, | 837 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad, |
| 838 fling_delta, | 838 fling_delta, |
| 839 fling_point, | 839 fling_point, |
| 840 fling_global_point, | 840 fling_global_point, |
| 841 modifiers); | 841 modifiers); |
| 842 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 842 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 843 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 843 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 844 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 844 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 845 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 845 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 846 expected_disposition_ = InputHandlerProxy::DID_HANDLE; | 846 expected_disposition_ = InputHandlerProxy::DID_HANDLE; |
| 847 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 847 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 848 | 848 |
| 849 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 849 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 850 | 850 |
| 851 // Start the second fling animation at time 30. | 851 // Start the second fling animation at time 30. |
| 852 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 852 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 853 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 853 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 854 .Times(0); | 854 .Times(0); |
| 855 time = base::TimeTicks() + base::TimeDelta::FromSeconds(30); | 855 time = base::TimeTicks() + base::TimeDelta::FromSeconds(30); |
| 856 input_handler_->Animate(time); | 856 input_handler_->Animate(time); |
| 857 | 857 |
| 858 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 858 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 859 | 859 |
| 860 // Tick the second fling once normally. | 860 // Tick the second fling once normally. |
| 861 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 861 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 862 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 862 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 863 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 863 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 864 EXPECT_CALL(mock_input_handler_, | 864 EXPECT_CALL(mock_input_handler_, |
| 865 ScrollBy(testing::_, | 865 ScrollBy(testing::_, |
| 866 testing::Property(&gfx::Vector2dF::y, testing::Gt(0)))) | 866 testing::Property(&gfx::Vector2dF::y, testing::Gt(0)))) |
| 867 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 867 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 868 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 868 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 869 time += base::TimeDelta::FromMilliseconds(100); | 869 time += base::TimeDelta::FromMilliseconds(100); |
| 870 input_handler_->Animate(time); | 870 input_handler_->Animate(time); |
| 871 | 871 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 906 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 907 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 907 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 908 gesture_.type = WebInputEvent::GestureScrollBegin; | 908 gesture_.type = WebInputEvent::GestureScrollBegin; |
| 909 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; | 909 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; |
| 910 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 910 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 911 | 911 |
| 912 VERIFY_AND_RESET_MOCKS(); | 912 VERIFY_AND_RESET_MOCKS(); |
| 913 | 913 |
| 914 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) | 914 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) |
| 915 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 915 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 916 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 916 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 917 | 917 |
| 918 gesture_.type = WebInputEvent::GestureFlingStart; | 918 gesture_.type = WebInputEvent::GestureFlingStart; |
| 919 gesture_.data.flingStart.velocityX = 10; | 919 gesture_.data.flingStart.velocityX = 10; |
| 920 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; | 920 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; |
| 921 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 921 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 922 | 922 |
| 923 VERIFY_AND_RESET_MOCKS(); | 923 VERIFY_AND_RESET_MOCKS(); |
| 924 | 924 |
| 925 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 925 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 926 | 926 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 WebFloatPoint fling_delta = WebFloatPoint(100, 0); | 1012 WebFloatPoint fling_delta = WebFloatPoint(100, 0); |
| 1013 WebPoint fling_point = WebPoint(7, 13); | 1013 WebPoint fling_point = WebPoint(7, 13); |
| 1014 WebPoint fling_global_point = WebPoint(17, 23); | 1014 WebPoint fling_global_point = WebPoint(17, 23); |
| 1015 // Note that for touchscreen the control modifier is not special. | 1015 // Note that for touchscreen the control modifier is not special. |
| 1016 int modifiers = WebInputEvent::ControlKey; | 1016 int modifiers = WebInputEvent::ControlKey; |
| 1017 gesture_ = CreateFling(blink::WebGestureDeviceTouchscreen, | 1017 gesture_ = CreateFling(blink::WebGestureDeviceTouchscreen, |
| 1018 fling_delta, | 1018 fling_delta, |
| 1019 fling_point, | 1019 fling_point, |
| 1020 fling_global_point, | 1020 fling_global_point, |
| 1021 modifiers); | 1021 modifiers); |
| 1022 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1022 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1023 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) | 1023 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) |
| 1024 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 1024 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 1025 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1025 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1026 | 1026 |
| 1027 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1027 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1028 // The first animate call should let us pick up an animation start time, but | 1028 // The first animate call should let us pick up an animation start time, but |
| 1029 // we shouldn't actually move anywhere just yet. The first frame after the | 1029 // we shouldn't actually move anywhere just yet. The first frame after the |
| 1030 // fling start will typically include the last scroll from the gesture that | 1030 // fling start will typically include the last scroll from the gesture that |
| 1031 // lead to the scroll (either wheel or gesture scroll), so there should be no | 1031 // lead to the scroll (either wheel or gesture scroll), so there should be no |
| 1032 // visible hitch. | 1032 // visible hitch. |
| 1033 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1033 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1034 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); | 1034 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); |
| 1035 input_handler_->Animate(time); | 1035 input_handler_->Animate(time); |
| 1036 | 1036 |
| 1037 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1037 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1038 | 1038 |
| 1039 // The second call should start scrolling in the -X direction. | 1039 // The second call should start scrolling in the -X direction. |
| 1040 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1040 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1041 EXPECT_CALL(mock_input_handler_, | 1041 EXPECT_CALL(mock_input_handler_, |
| 1042 ScrollBy(testing::_, | 1042 ScrollBy(testing::_, |
| 1043 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) | 1043 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) |
| 1044 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1044 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1045 time += base::TimeDelta::FromMilliseconds(100); | 1045 time += base::TimeDelta::FromMilliseconds(100); |
| 1046 input_handler_->Animate(time); | 1046 input_handler_->Animate(time); |
| 1047 | 1047 |
| 1048 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1048 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1049 | 1049 |
| 1050 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 1050 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1073 WebFloatPoint fling_delta = WebFloatPoint(100, 0); | 1073 WebFloatPoint fling_delta = WebFloatPoint(100, 0); |
| 1074 WebPoint fling_point = WebPoint(7, 13); | 1074 WebPoint fling_point = WebPoint(7, 13); |
| 1075 WebPoint fling_global_point = WebPoint(17, 23); | 1075 WebPoint fling_global_point = WebPoint(17, 23); |
| 1076 int modifiers = WebInputEvent::ControlKey; | 1076 int modifiers = WebInputEvent::ControlKey; |
| 1077 gesture_ = CreateFling(time, | 1077 gesture_ = CreateFling(time, |
| 1078 blink::WebGestureDeviceTouchscreen, | 1078 blink::WebGestureDeviceTouchscreen, |
| 1079 fling_delta, | 1079 fling_delta, |
| 1080 fling_point, | 1080 fling_point, |
| 1081 fling_global_point, | 1081 fling_global_point, |
| 1082 modifiers); | 1082 modifiers); |
| 1083 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1083 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1084 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) | 1084 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) |
| 1085 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 1085 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 1086 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1086 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1087 | 1087 |
| 1088 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1088 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1089 // With a valid time stamp, the first animate call should skip start time | 1089 // With a valid time stamp, the first animate call should skip start time |
| 1090 // initialization and immediately begin scroll update production. This reduces | 1090 // initialization and immediately begin scroll update production. This reduces |
| 1091 // the likelihood of a hitch between the scroll preceding the fling and | 1091 // the likelihood of a hitch between the scroll preceding the fling and |
| 1092 // the first scroll generated by the fling. | 1092 // the first scroll generated by the fling. |
| 1093 // Scrolling should start in the -X direction. | 1093 // Scrolling should start in the -X direction. |
| 1094 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1094 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1095 EXPECT_CALL(mock_input_handler_, | 1095 EXPECT_CALL(mock_input_handler_, |
| 1096 ScrollBy(testing::_, | 1096 ScrollBy(testing::_, |
| 1097 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) | 1097 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) |
| 1098 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1098 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1099 time += dt; | 1099 time += dt; |
| 1100 input_handler_->Animate(time); | 1100 input_handler_->Animate(time); |
| 1101 | 1101 |
| 1102 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1102 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1103 | 1103 |
| 1104 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 1104 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1130 int modifiers = WebInputEvent::ControlKey; | 1130 int modifiers = WebInputEvent::ControlKey; |
| 1131 gesture_.timeStampSeconds = start_time_offset.InSecondsF(); | 1131 gesture_.timeStampSeconds = start_time_offset.InSecondsF(); |
| 1132 gesture_.data.flingStart.velocityX = fling_delta.x; | 1132 gesture_.data.flingStart.velocityX = fling_delta.x; |
| 1133 gesture_.data.flingStart.velocityY = fling_delta.y; | 1133 gesture_.data.flingStart.velocityY = fling_delta.y; |
| 1134 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; | 1134 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; |
| 1135 gesture_.x = fling_point.x; | 1135 gesture_.x = fling_point.x; |
| 1136 gesture_.y = fling_point.y; | 1136 gesture_.y = fling_point.y; |
| 1137 gesture_.globalX = fling_global_point.x; | 1137 gesture_.globalX = fling_global_point.x; |
| 1138 gesture_.globalY = fling_global_point.y; | 1138 gesture_.globalY = fling_global_point.y; |
| 1139 gesture_.modifiers = modifiers; | 1139 gesture_.modifiers = modifiers; |
| 1140 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1140 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1141 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) | 1141 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) |
| 1142 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 1142 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 1143 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1143 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1144 | 1144 |
| 1145 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1145 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1146 // Event though a time stamp was provided for the fling event, it will be | 1146 // Event though a time stamp was provided for the fling event, it will be |
| 1147 // ignored as its too far in the past relative to the first animate call's | 1147 // ignored as its too far in the past relative to the first animate call's |
| 1148 // timestamp. | 1148 // timestamp. |
| 1149 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1149 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1150 base::TimeTicks time = | 1150 base::TimeTicks time = |
| 1151 base::TimeTicks() + start_time_offset + base::TimeDelta::FromSeconds(1); | 1151 base::TimeTicks() + start_time_offset + base::TimeDelta::FromSeconds(1); |
| 1152 input_handler_->Animate(time); | 1152 input_handler_->Animate(time); |
| 1153 | 1153 |
| 1154 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1154 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1155 | 1155 |
| 1156 // Further animation ticks should update the fling as usual. | 1156 // Further animation ticks should update the fling as usual. |
| 1157 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1157 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1158 EXPECT_CALL(mock_input_handler_, | 1158 EXPECT_CALL(mock_input_handler_, |
| 1159 ScrollBy(testing::_, | 1159 ScrollBy(testing::_, |
| 1160 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) | 1160 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) |
| 1161 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1161 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1162 time += base::TimeDelta::FromMilliseconds(10); | 1162 time += base::TimeDelta::FromMilliseconds(10); |
| 1163 input_handler_->Animate(time); | 1163 input_handler_->Animate(time); |
| 1164 | 1164 |
| 1165 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1165 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1166 | 1166 |
| 1167 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 1167 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1192 // scrolling. | 1192 // scrolling. |
| 1193 WebFloatPoint fling_delta = WebFloatPoint(100, 0); | 1193 WebFloatPoint fling_delta = WebFloatPoint(100, 0); |
| 1194 WebPoint fling_point = WebPoint(7, 13); | 1194 WebPoint fling_point = WebPoint(7, 13); |
| 1195 WebPoint fling_global_point = WebPoint(17, 23); | 1195 WebPoint fling_global_point = WebPoint(17, 23); |
| 1196 int modifiers = WebInputEvent::ControlKey | WebInputEvent::AltKey; | 1196 int modifiers = WebInputEvent::ControlKey | WebInputEvent::AltKey; |
| 1197 gesture_ = CreateFling(blink::WebGestureDeviceTouchscreen, | 1197 gesture_ = CreateFling(blink::WebGestureDeviceTouchscreen, |
| 1198 fling_delta, | 1198 fling_delta, |
| 1199 fling_point, | 1199 fling_point, |
| 1200 fling_global_point, | 1200 fling_global_point, |
| 1201 modifiers); | 1201 modifiers); |
| 1202 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1202 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1203 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) | 1203 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) |
| 1204 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 1204 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 1205 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1205 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1206 | 1206 |
| 1207 // |gesture_scroll_on_impl_thread_| should still be true after | 1207 // |gesture_scroll_on_impl_thread_| should still be true after |
| 1208 // a GestureFlingStart is sent. | 1208 // a GestureFlingStart is sent. |
| 1209 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); | 1209 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); |
| 1210 | 1210 |
| 1211 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1211 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1212 // The first animate call should let us pick up an animation start time, but | 1212 // The first animate call should let us pick up an animation start time, but |
| 1213 // we shouldn't actually move anywhere just yet. The first frame after the | 1213 // we shouldn't actually move anywhere just yet. The first frame after the |
| 1214 // fling start will typically include the last scroll from the gesture that | 1214 // fling start will typically include the last scroll from the gesture that |
| 1215 // lead to the scroll (either wheel or gesture scroll), so there should be no | 1215 // lead to the scroll (either wheel or gesture scroll), so there should be no |
| 1216 // visible hitch. | 1216 // visible hitch. |
| 1217 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1217 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1218 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); | 1218 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); |
| 1219 input_handler_->Animate(time); | 1219 input_handler_->Animate(time); |
| 1220 | 1220 |
| 1221 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1221 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1222 | 1222 |
| 1223 // The second call should start scrolling in the -X direction. | 1223 // The second call should start scrolling in the -X direction. |
| 1224 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1224 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1225 EXPECT_CALL(mock_input_handler_, | 1225 EXPECT_CALL(mock_input_handler_, |
| 1226 ScrollBy(testing::_, | 1226 ScrollBy(testing::_, |
| 1227 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) | 1227 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) |
| 1228 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1228 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1229 time += base::TimeDelta::FromMilliseconds(100); | 1229 time += base::TimeDelta::FromMilliseconds(100); |
| 1230 input_handler_->Animate(time); | 1230 input_handler_->Animate(time); |
| 1231 | 1231 |
| 1232 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1232 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1233 | 1233 |
| 1234 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 1234 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1247 | 1247 |
| 1248 // On the fling start, we should schedule an animation but not actually start | 1248 // On the fling start, we should schedule an animation but not actually start |
| 1249 // scrolling. | 1249 // scrolling. |
| 1250 gesture_.type = WebInputEvent::GestureFlingStart; | 1250 gesture_.type = WebInputEvent::GestureFlingStart; |
| 1251 WebFloatPoint fling_delta = WebFloatPoint(100, 100); | 1251 WebFloatPoint fling_delta = WebFloatPoint(100, 100); |
| 1252 gesture_.data.flingStart.velocityX = fling_delta.x; | 1252 gesture_.data.flingStart.velocityX = fling_delta.x; |
| 1253 gesture_.data.flingStart.velocityY = fling_delta.y; | 1253 gesture_.data.flingStart.velocityY = fling_delta.y; |
| 1254 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 1254 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 1255 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 1255 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 1256 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 1256 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 1257 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1257 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1258 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1258 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1259 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1259 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1260 | 1260 |
| 1261 // The first animate doesn't cause any scrolling. | 1261 // The first animate doesn't cause any scrolling. |
| 1262 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1262 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1263 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); | 1263 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); |
| 1264 input_handler_->Animate(time); | 1264 input_handler_->Animate(time); |
| 1265 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1265 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1266 | 1266 |
| 1267 // The second animate starts scrolling in the positive X and Y directions. | 1267 // The second animate starts scrolling in the positive X and Y directions. |
| 1268 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 1268 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 1269 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 1269 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 1270 EXPECT_CALL(mock_input_handler_, | 1270 EXPECT_CALL(mock_input_handler_, |
| 1271 ScrollBy(testing::_, | 1271 ScrollBy(testing::_, |
| 1272 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)))) | 1272 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)))) |
| 1273 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1273 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1274 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 1274 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 1275 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1275 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1276 time += base::TimeDelta::FromMilliseconds(100); | 1276 time += base::TimeDelta::FromMilliseconds(100); |
| 1277 input_handler_->Animate(time); | 1277 input_handler_->Animate(time); |
| 1278 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1278 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1279 | 1279 |
| 1280 // The third animate overscrolls in the positive Y direction but scrolls | 1280 // The third animate overscrolls in the positive Y direction but scrolls |
| 1281 // somewhat. | 1281 // somewhat. |
| 1282 cc::InputHandlerScrollResult overscroll; | 1282 cc::InputHandlerScrollResult overscroll; |
| 1283 overscroll.did_scroll = true; | 1283 overscroll.did_scroll = true; |
| 1284 overscroll.did_overscroll_root = true; | 1284 overscroll.did_overscroll_root = true; |
| 1285 overscroll.accumulated_root_overscroll = gfx::Vector2dF(0, 100); | 1285 overscroll.accumulated_root_overscroll = gfx::Vector2dF(0, 100); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1296 testing::Field( | 1296 testing::Field( |
| 1297 &DidOverscrollParams::accumulated_overscroll, | 1297 &DidOverscrollParams::accumulated_overscroll, |
| 1298 testing::Eq(overscroll.accumulated_root_overscroll)), | 1298 testing::Eq(overscroll.accumulated_root_overscroll)), |
| 1299 testing::Field( | 1299 testing::Field( |
| 1300 &DidOverscrollParams::latest_overscroll_delta, | 1300 &DidOverscrollParams::latest_overscroll_delta, |
| 1301 testing::Eq(overscroll.unused_scroll_delta)), | 1301 testing::Eq(overscroll.unused_scroll_delta)), |
| 1302 testing::Field( | 1302 testing::Field( |
| 1303 &DidOverscrollParams::current_fling_velocity, | 1303 &DidOverscrollParams::current_fling_velocity, |
| 1304 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)))))); | 1304 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)))))); |
| 1305 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 1305 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 1306 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1306 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1307 time += base::TimeDelta::FromMilliseconds(100); | 1307 time += base::TimeDelta::FromMilliseconds(100); |
| 1308 input_handler_->Animate(time); | 1308 input_handler_->Animate(time); |
| 1309 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1309 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1310 | 1310 |
| 1311 // The next call to animate will no longer scroll vertically. | 1311 // The next call to animate will no longer scroll vertically. |
| 1312 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1312 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1313 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 1313 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 1314 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 1314 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 1315 EXPECT_CALL(mock_input_handler_, | 1315 EXPECT_CALL(mock_input_handler_, |
| 1316 ScrollBy(testing::_, | 1316 ScrollBy(testing::_, |
| 1317 testing::Property(&gfx::Vector2dF::y, testing::Eq(0)))) | 1317 testing::Property(&gfx::Vector2dF::y, testing::Eq(0)))) |
| 1318 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1318 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1319 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 1319 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 1320 time += base::TimeDelta::FromMilliseconds(100); | 1320 time += base::TimeDelta::FromMilliseconds(100); |
| 1321 input_handler_->Animate(time); | 1321 input_handler_->Animate(time); |
| 1322 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1322 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1343 WebFloatPoint fling_delta = WebFloatPoint(100, 0); | 1343 WebFloatPoint fling_delta = WebFloatPoint(100, 0); |
| 1344 WebPoint fling_point = WebPoint(7, 13); | 1344 WebPoint fling_point = WebPoint(7, 13); |
| 1345 WebPoint fling_global_point = WebPoint(17, 23); | 1345 WebPoint fling_global_point = WebPoint(17, 23); |
| 1346 int modifiers = WebInputEvent::ControlKey; | 1346 int modifiers = WebInputEvent::ControlKey; |
| 1347 gesture_ = CreateFling(time, | 1347 gesture_ = CreateFling(time, |
| 1348 blink::WebGestureDeviceTouchscreen, | 1348 blink::WebGestureDeviceTouchscreen, |
| 1349 fling_delta, | 1349 fling_delta, |
| 1350 fling_point, | 1350 fling_point, |
| 1351 fling_global_point, | 1351 fling_global_point, |
| 1352 modifiers); | 1352 modifiers); |
| 1353 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1353 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1354 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) | 1354 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) |
| 1355 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 1355 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 1356 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1356 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1357 | 1357 |
| 1358 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1358 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1359 // With an animation timestamp equivalent to the starting timestamp, the | 1359 // With an animation timestamp equivalent to the starting timestamp, the |
| 1360 // animation will simply be rescheduled. | 1360 // animation will simply be rescheduled. |
| 1361 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1361 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1362 input_handler_->Animate(time); | 1362 input_handler_->Animate(time); |
| 1363 | 1363 |
| 1364 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1364 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1365 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); | 1365 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); |
| 1366 | 1366 |
| 1367 // A small time delta should not stop the fling, even if the client | 1367 // A small time delta should not stop the fling, even if the client |
| 1368 // reports no scrolling. | 1368 // reports no scrolling. |
| 1369 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1369 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1370 EXPECT_CALL(mock_input_handler_, | 1370 EXPECT_CALL(mock_input_handler_, |
| 1371 ScrollBy(testing::_, | 1371 ScrollBy(testing::_, |
| 1372 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) | 1372 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) |
| 1373 .WillOnce(testing::Return(scroll_result_did_not_scroll_)); | 1373 .WillOnce(testing::Return(scroll_result_did_not_scroll_)); |
| 1374 time += base::TimeDelta::FromMicroseconds(5); | 1374 time += base::TimeDelta::FromMicroseconds(5); |
| 1375 input_handler_->Animate(time); | 1375 input_handler_->Animate(time); |
| 1376 | 1376 |
| 1377 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1377 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1378 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); | 1378 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); |
| 1379 | 1379 |
| 1380 // A time delta of zero should not stop the fling, and neither should it | 1380 // A time delta of zero should not stop the fling, and neither should it |
| 1381 // trigger scrolling on the client. | 1381 // trigger scrolling on the client. |
| 1382 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1382 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1383 input_handler_->Animate(time); | 1383 input_handler_->Animate(time); |
| 1384 | 1384 |
| 1385 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1385 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1386 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); | 1386 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); |
| 1387 | 1387 |
| 1388 // Lack of movement on the client, with a non-trivial scroll delta, should | 1388 // Lack of movement on the client, with a non-trivial scroll delta, should |
| 1389 // terminate the fling. | 1389 // terminate the fling. |
| 1390 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 1390 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 1391 EXPECT_CALL(mock_input_handler_, | 1391 EXPECT_CALL(mock_input_handler_, |
| 1392 ScrollBy(testing::_, | 1392 ScrollBy(testing::_, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1416 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1416 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1417 | 1417 |
| 1418 // On the fling start, we should schedule an animation but not actually start | 1418 // On the fling start, we should schedule an animation but not actually start |
| 1419 // scrolling. | 1419 // scrolling. |
| 1420 gesture_.type = WebInputEvent::GestureFlingStart; | 1420 gesture_.type = WebInputEvent::GestureFlingStart; |
| 1421 WebFloatPoint fling_delta = WebFloatPoint(100, 100); | 1421 WebFloatPoint fling_delta = WebFloatPoint(100, 100); |
| 1422 gesture_.data.flingStart.velocityX = fling_delta.x; | 1422 gesture_.data.flingStart.velocityX = fling_delta.x; |
| 1423 gesture_.data.flingStart.velocityY = fling_delta.y; | 1423 gesture_.data.flingStart.velocityY = fling_delta.y; |
| 1424 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) | 1424 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) |
| 1425 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 1425 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 1426 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1426 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1427 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1427 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1428 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1428 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1429 | 1429 |
| 1430 // The first animate doesn't cause any scrolling. | 1430 // The first animate doesn't cause any scrolling. |
| 1431 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1431 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1432 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); | 1432 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); |
| 1433 input_handler_->Animate(time); | 1433 input_handler_->Animate(time); |
| 1434 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1434 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1435 | 1435 |
| 1436 // The second animate starts scrolling in the positive X and Y directions. | 1436 // The second animate starts scrolling in the positive X and Y directions. |
| 1437 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1437 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1438 EXPECT_CALL(mock_input_handler_, | 1438 EXPECT_CALL(mock_input_handler_, |
| 1439 ScrollBy(testing::_, | 1439 ScrollBy(testing::_, |
| 1440 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)))) | 1440 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)))) |
| 1441 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1441 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1442 time += base::TimeDelta::FromMilliseconds(10); | 1442 time += base::TimeDelta::FromMilliseconds(10); |
| 1443 input_handler_->Animate(time); | 1443 input_handler_->Animate(time); |
| 1444 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1444 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1445 | 1445 |
| 1446 // The third animate hits the bottom content edge. | 1446 // The third animate hits the bottom content edge. |
| 1447 overscroll.accumulated_root_overscroll = gfx::Vector2dF(0, 100); | 1447 overscroll.accumulated_root_overscroll = gfx::Vector2dF(0, 100); |
| 1448 overscroll.unused_scroll_delta = gfx::Vector2dF(0, 100); | 1448 overscroll.unused_scroll_delta = gfx::Vector2dF(0, 100); |
| 1449 EXPECT_CALL(mock_input_handler_, | 1449 EXPECT_CALL(mock_input_handler_, |
| 1450 ScrollBy(testing::_, | 1450 ScrollBy(testing::_, |
| 1451 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)))) | 1451 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)))) |
| 1452 .WillOnce(testing::Return(overscroll)); | 1452 .WillOnce(testing::Return(overscroll)); |
| 1453 EXPECT_CALL( | 1453 EXPECT_CALL( |
| 1454 mock_client_, | 1454 mock_client_, |
| 1455 DidOverscroll(testing::AllOf( | 1455 DidOverscroll(testing::AllOf( |
| 1456 testing::Field( | 1456 testing::Field( |
| 1457 &DidOverscrollParams::accumulated_overscroll, | 1457 &DidOverscrollParams::accumulated_overscroll, |
| 1458 testing::Eq(overscroll.accumulated_root_overscroll)), | 1458 testing::Eq(overscroll.accumulated_root_overscroll)), |
| 1459 testing::Field( | 1459 testing::Field( |
| 1460 &DidOverscrollParams::latest_overscroll_delta, | 1460 &DidOverscrollParams::latest_overscroll_delta, |
| 1461 testing::Eq(overscroll.unused_scroll_delta)), | 1461 testing::Eq(overscroll.unused_scroll_delta)), |
| 1462 testing::Field( | 1462 testing::Field( |
| 1463 &DidOverscrollParams::current_fling_velocity, | 1463 &DidOverscrollParams::current_fling_velocity, |
| 1464 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)))))); | 1464 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)))))); |
| 1465 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1465 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1466 time += base::TimeDelta::FromMilliseconds(10); | 1466 time += base::TimeDelta::FromMilliseconds(10); |
| 1467 input_handler_->Animate(time); | 1467 input_handler_->Animate(time); |
| 1468 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1468 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1469 | 1469 |
| 1470 // The next call to animate will no longer scroll vertically. | 1470 // The next call to animate will no longer scroll vertically. |
| 1471 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1471 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1472 EXPECT_CALL(mock_input_handler_, | 1472 EXPECT_CALL(mock_input_handler_, |
| 1473 ScrollBy(testing::_, | 1473 ScrollBy(testing::_, |
| 1474 testing::Property(&gfx::Vector2dF::y, testing::Eq(0)))) | 1474 testing::Property(&gfx::Vector2dF::y, testing::Eq(0)))) |
| 1475 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1475 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1476 time += base::TimeDelta::FromMilliseconds(10); | 1476 time += base::TimeDelta::FromMilliseconds(10); |
| 1477 input_handler_->Animate(time); | 1477 input_handler_->Animate(time); |
| 1478 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1478 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1479 | 1479 |
| 1480 // The next call will hit the right edge. | 1480 // The next call will hit the right edge. |
| 1481 overscroll.accumulated_root_overscroll = gfx::Vector2dF(100, 100); | 1481 overscroll.accumulated_root_overscroll = gfx::Vector2dF(100, 100); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1496 testing::Field( | 1496 testing::Field( |
| 1497 &DidOverscrollParams::current_fling_velocity, | 1497 &DidOverscrollParams::current_fling_velocity, |
| 1498 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))))); | 1498 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))))); |
| 1499 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 1499 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 1500 time += base::TimeDelta::FromMilliseconds(10); | 1500 time += base::TimeDelta::FromMilliseconds(10); |
| 1501 input_handler_->Animate(time); | 1501 input_handler_->Animate(time); |
| 1502 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1502 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1503 | 1503 |
| 1504 // The next call to animate will no longer scroll horizontally or vertically, | 1504 // The next call to animate will no longer scroll horizontally or vertically, |
| 1505 // and the fling should be cancelled. | 1505 // and the fling should be cancelled. |
| 1506 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()).Times(0); | 1506 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()).Times(0); |
| 1507 EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0); | 1507 EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0); |
| 1508 time += base::TimeDelta::FromMilliseconds(10); | 1508 time += base::TimeDelta::FromMilliseconds(10); |
| 1509 input_handler_->Animate(time); | 1509 input_handler_->Animate(time); |
| 1510 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1510 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1511 EXPECT_FALSE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); | 1511 EXPECT_FALSE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); |
| 1512 } | 1512 } |
| 1513 | 1513 |
| 1514 TEST_F(InputHandlerProxyTest, MultiTouchPointHitTestNegative) { | 1514 TEST_F(InputHandlerProxyTest, MultiTouchPointHitTestNegative) { |
| 1515 // None of the three touch points fall in the touch region. So the event | 1515 // None of the three touch points fall in the touch region. So the event |
| 1516 // should be dropped. | 1516 // should be dropped. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1584 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); | 1584 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); |
| 1585 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1585 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1586 | 1586 |
| 1587 // On the fling start, animation should be scheduled, but no scrolling occurs. | 1587 // On the fling start, animation should be scheduled, but no scrolling occurs. |
| 1588 gesture_.type = WebInputEvent::GestureFlingStart; | 1588 gesture_.type = WebInputEvent::GestureFlingStart; |
| 1589 WebFloatPoint fling_delta = WebFloatPoint(100, 100); | 1589 WebFloatPoint fling_delta = WebFloatPoint(100, 100); |
| 1590 gesture_.data.flingStart.velocityX = fling_delta.x; | 1590 gesture_.data.flingStart.velocityX = fling_delta.x; |
| 1591 gesture_.data.flingStart.velocityY = fling_delta.y; | 1591 gesture_.data.flingStart.velocityY = fling_delta.y; |
| 1592 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) | 1592 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) |
| 1593 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 1593 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 1594 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1594 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1595 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1595 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1596 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); | 1596 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); |
| 1597 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1597 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1598 | 1598 |
| 1599 // Keyboard events received during a fling should cancel the active fling. | 1599 // Keyboard events received during a fling should cancel the active fling. |
| 1600 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 1600 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 1601 EXPECT_EQ(InputHandlerProxy::DID_NOT_HANDLE, | 1601 EXPECT_EQ(InputHandlerProxy::DID_NOT_HANDLE, |
| 1602 input_handler_->HandleInputEvent(key_event)); | 1602 input_handler_->HandleInputEvent(key_event)); |
| 1603 EXPECT_FALSE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); | 1603 EXPECT_FALSE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); |
| 1604 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1604 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 WebFloatPoint fling_delta = WebFloatPoint(100, 0); | 1636 WebFloatPoint fling_delta = WebFloatPoint(100, 0); |
| 1637 WebPoint fling_point = WebPoint(7, 13); | 1637 WebPoint fling_point = WebPoint(7, 13); |
| 1638 WebPoint fling_global_point = WebPoint(17, 23); | 1638 WebPoint fling_global_point = WebPoint(17, 23); |
| 1639 int modifiers = WebInputEvent::ControlKey; | 1639 int modifiers = WebInputEvent::ControlKey; |
| 1640 gesture_ = CreateFling(time, | 1640 gesture_ = CreateFling(time, |
| 1641 blink::WebGestureDeviceTouchscreen, | 1641 blink::WebGestureDeviceTouchscreen, |
| 1642 fling_delta, | 1642 fling_delta, |
| 1643 fling_point, | 1643 fling_point, |
| 1644 fling_global_point, | 1644 fling_global_point, |
| 1645 modifiers); | 1645 modifiers); |
| 1646 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1646 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1647 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) | 1647 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) |
| 1648 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 1648 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 1649 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1649 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1650 | 1650 |
| 1651 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1651 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1652 | 1652 |
| 1653 // If we get a negative time delta, that is, the Animation tick time happens | 1653 // If we get a negative time delta, that is, the Animation tick time happens |
| 1654 // before the fling's start time then we should *not* try scrolling and | 1654 // before the fling's start time then we should *not* try scrolling and |
| 1655 // instead reset the fling start time. | 1655 // instead reset the fling start time. |
| 1656 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1656 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1657 EXPECT_CALL(mock_input_handler_, | 1657 EXPECT_CALL(mock_input_handler_, |
| 1658 ScrollBy(testing::_, | 1658 ScrollBy(testing::_, |
| 1659 testing::_)).Times(0); | 1659 testing::_)).Times(0); |
| 1660 time -= base::TimeDelta::FromMilliseconds(5); | 1660 time -= base::TimeDelta::FromMilliseconds(5); |
| 1661 input_handler_->Animate(time); | 1661 input_handler_->Animate(time); |
| 1662 | 1662 |
| 1663 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1663 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1664 | 1664 |
| 1665 // The first call should have reset the start time so subsequent calls should | 1665 // The first call should have reset the start time so subsequent calls should |
| 1666 // generate scroll events. | 1666 // generate scroll events. |
| 1667 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1667 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1668 EXPECT_CALL(mock_input_handler_, | 1668 EXPECT_CALL(mock_input_handler_, |
| 1669 ScrollBy(testing::_, | 1669 ScrollBy(testing::_, |
| 1670 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) | 1670 testing::Property(&gfx::Vector2dF::x, testing::Lt(0)))) |
| 1671 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1671 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1672 | 1672 |
| 1673 input_handler_->Animate(time + base::TimeDelta::FromMilliseconds(1)); | 1673 input_handler_->Animate(time + base::TimeDelta::FromMilliseconds(1)); |
| 1674 | 1674 |
| 1675 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 1675 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 1676 | 1676 |
| 1677 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 1677 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1703 gesture_.timeStampSeconds = InSecondsF(time); | 1703 gesture_.timeStampSeconds = InSecondsF(time); |
| 1704 gesture_.type = WebInputEvent::GestureScrollBegin; | 1704 gesture_.type = WebInputEvent::GestureScrollBegin; |
| 1705 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1705 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1706 | 1706 |
| 1707 VERIFY_AND_RESET_MOCKS(); | 1707 VERIFY_AND_RESET_MOCKS(); |
| 1708 | 1708 |
| 1709 // Animate calls within the deferred cancellation window should continue. | 1709 // Animate calls within the deferred cancellation window should continue. |
| 1710 time += dt; | 1710 time += dt; |
| 1711 float expected_delta = | 1711 float expected_delta = |
| 1712 (time - last_animate_time).InSecondsF() * -fling_delta.x; | 1712 (time - last_animate_time).InSecondsF() * -fling_delta.x; |
| 1713 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1713 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1714 EXPECT_CALL(mock_input_handler_, | 1714 EXPECT_CALL(mock_input_handler_, |
| 1715 ScrollBy(testing::_, | 1715 ScrollBy(testing::_, |
| 1716 testing::Property(&gfx::Vector2dF::x, | 1716 testing::Property(&gfx::Vector2dF::x, |
| 1717 testing::Eq(expected_delta)))) | 1717 testing::Eq(expected_delta)))) |
| 1718 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1718 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1719 input_handler_->Animate(time); | 1719 input_handler_->Animate(time); |
| 1720 last_animate_time = time; | 1720 last_animate_time = time; |
| 1721 | 1721 |
| 1722 VERIFY_AND_RESET_MOCKS(); | 1722 VERIFY_AND_RESET_MOCKS(); |
| 1723 | 1723 |
| 1724 // GestureScrollUpdates in the same direction and at sufficient speed should | 1724 // GestureScrollUpdates in the same direction and at sufficient speed should |
| 1725 // be swallowed by the fling. | 1725 // be swallowed by the fling. |
| 1726 time += dt; | 1726 time += dt; |
| 1727 gesture_.timeStampSeconds = InSecondsF(time); | 1727 gesture_.timeStampSeconds = InSecondsF(time); |
| 1728 gesture_.type = WebInputEvent::GestureScrollUpdate; | 1728 gesture_.type = WebInputEvent::GestureScrollUpdate; |
| 1729 gesture_.data.scrollUpdate.deltaX = fling_delta.x; | 1729 gesture_.data.scrollUpdate.deltaX = fling_delta.x; |
| 1730 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1730 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1731 | 1731 |
| 1732 VERIFY_AND_RESET_MOCKS(); | 1732 VERIFY_AND_RESET_MOCKS(); |
| 1733 | 1733 |
| 1734 // Animate calls within the deferred cancellation window should continue. | 1734 // Animate calls within the deferred cancellation window should continue. |
| 1735 time += dt; | 1735 time += dt; |
| 1736 expected_delta = (time - last_animate_time).InSecondsF() * -fling_delta.x; | 1736 expected_delta = (time - last_animate_time).InSecondsF() * -fling_delta.x; |
| 1737 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1737 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1738 EXPECT_CALL(mock_input_handler_, | 1738 EXPECT_CALL(mock_input_handler_, |
| 1739 ScrollBy(testing::_, | 1739 ScrollBy(testing::_, |
| 1740 testing::Property(&gfx::Vector2dF::x, | 1740 testing::Property(&gfx::Vector2dF::x, |
| 1741 testing::Eq(expected_delta)))) | 1741 testing::Eq(expected_delta)))) |
| 1742 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1742 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1743 input_handler_->Animate(time); | 1743 input_handler_->Animate(time); |
| 1744 last_animate_time = time; | 1744 last_animate_time = time; |
| 1745 | 1745 |
| 1746 VERIFY_AND_RESET_MOCKS(); | 1746 VERIFY_AND_RESET_MOCKS(); |
| 1747 | 1747 |
| 1748 // GestureFlingStart in the same direction and at sufficient speed should | 1748 // GestureFlingStart in the same direction and at sufficient speed should |
| 1749 // boost the active fling. | 1749 // boost the active fling. |
| 1750 | 1750 |
| 1751 gesture_ = CreateFling(time, | 1751 gesture_ = CreateFling(time, |
| 1752 blink::WebGestureDeviceTouchscreen, | 1752 blink::WebGestureDeviceTouchscreen, |
| 1753 fling_delta, | 1753 fling_delta, |
| 1754 fling_point, | 1754 fling_point, |
| 1755 fling_point, | 1755 fling_point, |
| 1756 0); | 1756 0); |
| 1757 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1757 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1758 VERIFY_AND_RESET_MOCKS(); | 1758 VERIFY_AND_RESET_MOCKS(); |
| 1759 | 1759 |
| 1760 time += dt; | 1760 time += dt; |
| 1761 // Note we get *2x* as much delta because 2 flings have combined. | 1761 // Note we get *2x* as much delta because 2 flings have combined. |
| 1762 expected_delta = 2 * (time - last_animate_time).InSecondsF() * -fling_delta.x; | 1762 expected_delta = 2 * (time - last_animate_time).InSecondsF() * -fling_delta.x; |
| 1763 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1763 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1764 EXPECT_CALL(mock_input_handler_, | 1764 EXPECT_CALL(mock_input_handler_, |
| 1765 ScrollBy(testing::_, | 1765 ScrollBy(testing::_, |
| 1766 testing::Property(&gfx::Vector2dF::x, | 1766 testing::Property(&gfx::Vector2dF::x, |
| 1767 testing::Eq(expected_delta)))) | 1767 testing::Eq(expected_delta)))) |
| 1768 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1768 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1769 input_handler_->Animate(time); | 1769 input_handler_->Animate(time); |
| 1770 last_animate_time = time; | 1770 last_animate_time = time; |
| 1771 | 1771 |
| 1772 VERIFY_AND_RESET_MOCKS(); | 1772 VERIFY_AND_RESET_MOCKS(); |
| 1773 | 1773 |
| 1774 // Repeated GestureFlingStarts should accumulate. | 1774 // Repeated GestureFlingStarts should accumulate. |
| 1775 | 1775 |
| 1776 CancelFling(time); | 1776 CancelFling(time); |
| 1777 gesture_ = CreateFling(time, | 1777 gesture_ = CreateFling(time, |
| 1778 blink::WebGestureDeviceTouchscreen, | 1778 blink::WebGestureDeviceTouchscreen, |
| 1779 fling_delta, | 1779 fling_delta, |
| 1780 fling_point, | 1780 fling_point, |
| 1781 fling_point, | 1781 fling_point, |
| 1782 0); | 1782 0); |
| 1783 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1783 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1784 VERIFY_AND_RESET_MOCKS(); | 1784 VERIFY_AND_RESET_MOCKS(); |
| 1785 | 1785 |
| 1786 time += dt; | 1786 time += dt; |
| 1787 // Note we get *3x* as much delta because 3 flings have combined. | 1787 // Note we get *3x* as much delta because 3 flings have combined. |
| 1788 expected_delta = 3 * (time - last_animate_time).InSecondsF() * -fling_delta.x; | 1788 expected_delta = 3 * (time - last_animate_time).InSecondsF() * -fling_delta.x; |
| 1789 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1789 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1790 EXPECT_CALL(mock_input_handler_, | 1790 EXPECT_CALL(mock_input_handler_, |
| 1791 ScrollBy(testing::_, | 1791 ScrollBy(testing::_, |
| 1792 testing::Property(&gfx::Vector2dF::x, | 1792 testing::Property(&gfx::Vector2dF::x, |
| 1793 testing::Eq(expected_delta)))) | 1793 testing::Eq(expected_delta)))) |
| 1794 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1794 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1795 input_handler_->Animate(time); | 1795 input_handler_->Animate(time); |
| 1796 last_animate_time = time; | 1796 last_animate_time = time; |
| 1797 | 1797 |
| 1798 VERIFY_AND_RESET_MOCKS(); | 1798 VERIFY_AND_RESET_MOCKS(); |
| 1799 | 1799 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1905 fling_point, | 1905 fling_point, |
| 1906 0); | 1906 0); |
| 1907 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1907 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1908 | 1908 |
| 1909 VERIFY_AND_RESET_MOCKS(); | 1909 VERIFY_AND_RESET_MOCKS(); |
| 1910 | 1910 |
| 1911 // Note that the new fling delta uses the orthogonal, unboosted fling | 1911 // Note that the new fling delta uses the orthogonal, unboosted fling |
| 1912 // velocity. | 1912 // velocity. |
| 1913 time += dt; | 1913 time += dt; |
| 1914 float expected_delta = dt.InSecondsF() * -orthogonal_fling_delta.y; | 1914 float expected_delta = dt.InSecondsF() * -orthogonal_fling_delta.y; |
| 1915 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 1915 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 1916 EXPECT_CALL(mock_input_handler_, | 1916 EXPECT_CALL(mock_input_handler_, |
| 1917 ScrollBy(testing::_, | 1917 ScrollBy(testing::_, |
| 1918 testing::Property(&gfx::Vector2dF::y, | 1918 testing::Property(&gfx::Vector2dF::y, |
| 1919 testing::Eq(expected_delta)))) | 1919 testing::Eq(expected_delta)))) |
| 1920 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 1920 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 1921 input_handler_->Animate(time); | 1921 input_handler_->Animate(time); |
| 1922 | 1922 |
| 1923 VERIFY_AND_RESET_MOCKS(); | 1923 VERIFY_AND_RESET_MOCKS(); |
| 1924 } | 1924 } |
| 1925 | 1925 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1990 fling_point, | 1990 fling_point, |
| 1991 fling_point, | 1991 fling_point, |
| 1992 0); | 1992 0); |
| 1993 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 1993 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
| 1994 | 1994 |
| 1995 VERIFY_AND_RESET_MOCKS(); | 1995 VERIFY_AND_RESET_MOCKS(); |
| 1996 | 1996 |
| 1997 // Note that the new fling delta uses the *slow*, unboosted fling velocity. | 1997 // Note that the new fling delta uses the *slow*, unboosted fling velocity. |
| 1998 time += dt; | 1998 time += dt; |
| 1999 float expected_delta = dt.InSecondsF() * -small_fling_delta.x; | 1999 float expected_delta = dt.InSecondsF() * -small_fling_delta.x; |
| 2000 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 2000 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 2001 EXPECT_CALL(mock_input_handler_, | 2001 EXPECT_CALL(mock_input_handler_, |
| 2002 ScrollBy(testing::_, | 2002 ScrollBy(testing::_, |
| 2003 testing::Property(&gfx::Vector2dF::x, | 2003 testing::Property(&gfx::Vector2dF::x, |
| 2004 testing::Eq(expected_delta)))) | 2004 testing::Eq(expected_delta)))) |
| 2005 .WillOnce(testing::Return(scroll_result_did_scroll_)); | 2005 .WillOnce(testing::Return(scroll_result_did_scroll_)); |
| 2006 input_handler_->Animate(time); | 2006 input_handler_->Animate(time); |
| 2007 | 2007 |
| 2008 VERIFY_AND_RESET_MOCKS(); | 2008 VERIFY_AND_RESET_MOCKS(); |
| 2009 } | 2009 } |
| 2010 | 2010 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 TEST_F(InputHandlerProxyTest, DidReceiveInputEvent_ForFling) { | 2120 TEST_F(InputHandlerProxyTest, DidReceiveInputEvent_ForFling) { |
| 2121 testing::StrictMock< | 2121 testing::StrictMock< |
| 2122 MockInputHandlerProxyClientWithDidReceiveInputEvent> mock_client; | 2122 MockInputHandlerProxyClientWithDidReceiveInputEvent> mock_client; |
| 2123 input_handler_.reset( | 2123 input_handler_.reset( |
| 2124 new content::InputHandlerProxy(&mock_input_handler_, &mock_client)); | 2124 new content::InputHandlerProxy(&mock_input_handler_, &mock_client)); |
| 2125 | 2125 |
| 2126 gesture_.type = WebInputEvent::GestureFlingStart; | 2126 gesture_.type = WebInputEvent::GestureFlingStart; |
| 2127 WebFloatPoint fling_delta = WebFloatPoint(100, 100); | 2127 WebFloatPoint fling_delta = WebFloatPoint(100, 100); |
| 2128 gesture_.data.flingStart.velocityX = fling_delta.x; | 2128 gesture_.data.flingStart.velocityX = fling_delta.x; |
| 2129 gesture_.data.flingStart.velocityY = fling_delta.y; | 2129 gesture_.data.flingStart.velocityY = fling_delta.y; |
| 2130 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 2130 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 2131 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 2131 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 2132 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 2132 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 2133 EXPECT_CALL(mock_input_handler_, ScrollEnd()); | 2133 EXPECT_CALL(mock_input_handler_, ScrollEnd()); |
| 2134 EXPECT_CALL(mock_client, | 2134 EXPECT_CALL(mock_client, |
| 2135 DidReceiveInputEvent(Field(&WebInputEvent::type, | 2135 DidReceiveInputEvent(Field(&WebInputEvent::type, |
| 2136 WebInputEvent::GestureFlingStart))); | 2136 WebInputEvent::GestureFlingStart))); |
| 2137 EXPECT_EQ(InputHandlerProxy::DID_HANDLE, | 2137 EXPECT_EQ(InputHandlerProxy::DID_HANDLE, |
| 2138 input_handler_->HandleInputEvent(gesture_)); | 2138 input_handler_->HandleInputEvent(gesture_)); |
| 2139 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 2139 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 2140 testing::Mock::VerifyAndClearExpectations(&mock_client); | 2140 testing::Mock::VerifyAndClearExpectations(&mock_client); |
| 2141 | 2141 |
| 2142 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 2142 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()); |
| 2143 EXPECT_CALL(mock_client, DidAnimateForInput()); | 2143 EXPECT_CALL(mock_client, DidAnimateForInput()); |
| 2144 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); | 2144 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); |
| 2145 input_handler_->Animate(time); | 2145 input_handler_->Animate(time); |
| 2146 | 2146 |
| 2147 testing::Mock::VerifyAndClearExpectations(&mock_client); | 2147 testing::Mock::VerifyAndClearExpectations(&mock_client); |
| 2148 } | 2148 } |
| 2149 | 2149 |
| 2150 } // namespace | 2150 } // namespace |
| 2151 } // namespace content | 2151 } // namespace content |
| OLD | NEW |