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

Side by Side Diff: ui/events/blink/input_handler_proxy_unittest.cc

Issue 1639363002: Move have_wheel_event_handlers to WebLayerTreeView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove blank line Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/blink/input_handler_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
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
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
OLDNEW
« no previous file with comments | « ui/events/blink/input_handler_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698