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 "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/input/main_thread_scrolling_reason.h" | 9 #include "cc/input/main_thread_scrolling_reason.h" |
10 #include "cc/trees/swap_promise_monitor.h" | 10 #include "cc/trees/swap_promise_monitor.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 | 125 |
126 void BindToClient(cc::InputHandlerClient* client) override {} | 126 void BindToClient(cc::InputHandlerClient* client) override {} |
127 | 127 |
128 void MouseMoveAt(const gfx::Point& mouse_position) override {} | 128 void MouseMoveAt(const gfx::Point& mouse_position) override {} |
129 | 129 |
130 MOCK_CONST_METHOD2(IsCurrentlyScrollingLayerAt, | 130 MOCK_CONST_METHOD2(IsCurrentlyScrollingLayerAt, |
131 bool(const gfx::Point& point, | 131 bool(const gfx::Point& point, |
132 cc::InputHandler::ScrollInputType type)); | 132 cc::InputHandler::ScrollInputType type)); |
133 | 133 |
134 MOCK_METHOD1(HaveWheelEventHandlersAt, bool(const gfx::Point& point)); | 134 MOCK_CONST_METHOD0(HaveWheelEventHandlers, bool()); |
135 MOCK_METHOD1(DoTouchEventsBlockScrollAt, bool(const gfx::Point& point)); | 135 MOCK_METHOD1(DoTouchEventsBlockScrollAt, bool(const gfx::Point& point)); |
136 | 136 |
137 MOCK_METHOD0(RequestUpdateForSynchronousInputHandler, void()); | 137 MOCK_METHOD0(RequestUpdateForSynchronousInputHandler, void()); |
138 MOCK_METHOD1(SetSynchronousInputHandlerRootScrollOffset, | 138 MOCK_METHOD1(SetSynchronousInputHandlerRootScrollOffset, |
139 void(const gfx::ScrollOffset& root_offset)); | 139 void(const gfx::ScrollOffset& root_offset)); |
140 | 140 |
141 bool IsCurrentlyScrollingInnerViewport() const override { | 141 bool IsCurrentlyScrollingInnerViewport() const override { |
142 return is_scrolling_root_; | 142 return is_scrolling_root_; |
143 } | 143 } |
144 void set_is_scrolling_root(bool is) { is_scrolling_root_ = is; } | 144 void set_is_scrolling_root(bool is) { is_scrolling_root_ = is; } |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 618 |
619 VERIFY_AND_RESET_MOCKS(); | 619 VERIFY_AND_RESET_MOCKS(); |
620 } | 620 } |
621 | 621 |
622 TEST_P(InputHandlerProxyTest, GesturePinch) { | 622 TEST_P(InputHandlerProxyTest, GesturePinch) { |
623 // We shouldn't send any events to the widget for this gesture. | 623 // We shouldn't send any events to the widget for this gesture. |
624 expected_disposition_ = InputHandlerProxy::DID_HANDLE; | 624 expected_disposition_ = InputHandlerProxy::DID_HANDLE; |
625 VERIFY_AND_RESET_MOCKS(); | 625 VERIFY_AND_RESET_MOCKS(); |
626 | 626 |
627 gesture_.type = WebInputEvent::GesturePinchBegin; | 627 gesture_.type = WebInputEvent::GesturePinchBegin; |
628 EXPECT_CALL(mock_input_handler_, HaveWheelEventHandlersAt(testing::_)) | 628 EXPECT_CALL(mock_input_handler_, HaveWheelEventHandlers()) |
629 .WillOnce(testing::Return(false)); | 629 .WillOnce(testing::Return(false)); |
630 EXPECT_CALL(mock_input_handler_, PinchGestureBegin()); | 630 EXPECT_CALL(mock_input_handler_, PinchGestureBegin()); |
631 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 631 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
632 | 632 |
633 VERIFY_AND_RESET_MOCKS(); | 633 VERIFY_AND_RESET_MOCKS(); |
634 | 634 |
635 gesture_.type = WebInputEvent::GesturePinchUpdate; | 635 gesture_.type = WebInputEvent::GesturePinchUpdate; |
636 gesture_.data.pinchUpdate.scale = 1.5; | 636 gesture_.data.pinchUpdate.scale = 1.5; |
637 gesture_.x = 7; | 637 gesture_.x = 7; |
638 gesture_.y = 13; | 638 gesture_.y = 13; |
(...skipping 28 matching lines...) Expand all Loading... |
667 | 667 |
668 VERIFY_AND_RESET_MOCKS(); | 668 VERIFY_AND_RESET_MOCKS(); |
669 } | 669 } |
670 | 670 |
671 TEST_P(InputHandlerProxyTest, GesturePinchWithWheelHandler) { | 671 TEST_P(InputHandlerProxyTest, GesturePinchWithWheelHandler) { |
672 // We will send the synthetic wheel event to the widget. | 672 // We will send the synthetic wheel event to the widget. |
673 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; | 673 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; |
674 VERIFY_AND_RESET_MOCKS(); | 674 VERIFY_AND_RESET_MOCKS(); |
675 | 675 |
676 gesture_.type = WebInputEvent::GesturePinchBegin; | 676 gesture_.type = WebInputEvent::GesturePinchBegin; |
677 EXPECT_CALL(mock_input_handler_, HaveWheelEventHandlersAt(testing::_)) | 677 EXPECT_CALL(mock_input_handler_, HaveWheelEventHandlers()) |
678 .WillOnce(testing::Return(true)); | 678 .WillOnce(testing::Return(true)); |
679 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 679 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
680 | 680 |
681 VERIFY_AND_RESET_MOCKS(); | 681 VERIFY_AND_RESET_MOCKS(); |
682 | 682 |
683 gesture_.type = WebInputEvent::GesturePinchUpdate; | 683 gesture_.type = WebInputEvent::GesturePinchUpdate; |
684 gesture_.data.pinchUpdate.scale = 1.5; | 684 gesture_.data.pinchUpdate.scale = 1.5; |
685 gesture_.x = 7; | 685 gesture_.x = 7; |
686 gesture_.y = 13; | 686 gesture_.y = 13; |
687 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 687 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
(...skipping 28 matching lines...) Expand all Loading... |
716 gesture_.type = WebInputEvent::GestureScrollUpdate; | 716 gesture_.type = WebInputEvent::GestureScrollUpdate; |
717 gesture_.data.scrollUpdate.deltaY = 40; | 717 gesture_.data.scrollUpdate.deltaY = 40; |
718 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 718 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
719 | 719 |
720 // However, after the pinch gesture starts, they should go to the impl | 720 // However, after the pinch gesture starts, they should go to the impl |
721 // thread. | 721 // thread. |
722 expected_disposition_ = InputHandlerProxy::DID_HANDLE; | 722 expected_disposition_ = InputHandlerProxy::DID_HANDLE; |
723 VERIFY_AND_RESET_MOCKS(); | 723 VERIFY_AND_RESET_MOCKS(); |
724 | 724 |
725 gesture_.type = WebInputEvent::GesturePinchBegin; | 725 gesture_.type = WebInputEvent::GesturePinchBegin; |
726 EXPECT_CALL(mock_input_handler_, HaveWheelEventHandlersAt(testing::_)) | 726 EXPECT_CALL(mock_input_handler_, HaveWheelEventHandlers()) |
727 .WillOnce(testing::Return(false)); | 727 .WillOnce(testing::Return(false)); |
728 EXPECT_CALL(mock_input_handler_, PinchGestureBegin()); | 728 EXPECT_CALL(mock_input_handler_, PinchGestureBegin()); |
729 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 729 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
730 | 730 |
731 VERIFY_AND_RESET_MOCKS(); | 731 VERIFY_AND_RESET_MOCKS(); |
732 | 732 |
733 gesture_.type = WebInputEvent::GesturePinchUpdate; | 733 gesture_.type = WebInputEvent::GesturePinchUpdate; |
734 gesture_.data.pinchUpdate.scale = 1.5; | 734 gesture_.data.pinchUpdate.scale = 1.5; |
735 gesture_.x = 7; | 735 gesture_.x = 7; |
736 gesture_.y = 13; | 736 gesture_.y = 13; |
(...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2525 testing::Mock::VerifyAndClearExpectations(&mock_input_handler); | 2525 testing::Mock::VerifyAndClearExpectations(&mock_input_handler); |
2526 testing::Mock::VerifyAndClearExpectations(&mock_client); | 2526 testing::Mock::VerifyAndClearExpectations(&mock_client); |
2527 testing::Mock::VerifyAndClearExpectations(&mock_synchronous_input_handler); | 2527 testing::Mock::VerifyAndClearExpectations(&mock_synchronous_input_handler); |
2528 } | 2528 } |
2529 | 2529 |
2530 INSTANTIATE_TEST_CASE_P(AnimateInput, | 2530 INSTANTIATE_TEST_CASE_P(AnimateInput, |
2531 InputHandlerProxyTest, | 2531 InputHandlerProxyTest, |
2532 testing::ValuesIn(test_types)); | 2532 testing::ValuesIn(test_types)); |
2533 } // namespace test | 2533 } // namespace test |
2534 } // namespace ui | 2534 } // namespace ui |
OLD | NEW |