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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 954 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
955 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); | 955 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
956 | 956 |
957 gesture_.type = WebInputEvent::GestureScrollBegin; | 957 gesture_.type = WebInputEvent::GestureScrollBegin; |
958 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; | 958 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; |
959 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 959 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
960 | 960 |
961 expected_disposition_ = InputHandlerProxy::DROP_EVENT; | 961 expected_disposition_ = InputHandlerProxy::DROP_EVENT; |
962 VERIFY_AND_RESET_MOCKS(); | 962 VERIFY_AND_RESET_MOCKS(); |
963 | 963 |
| 964 // Flings ignored by the InputHandler should be dropped, signalling the end |
| 965 // of the touch scroll sequence. |
964 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) | 966 EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) |
965 .WillOnce(testing::Return(cc::InputHandler::SCROLL_IGNORED)); | 967 .WillOnce(testing::Return(cc::InputHandler::SCROLL_IGNORED)); |
966 | 968 |
967 gesture_.type = WebInputEvent::GestureFlingStart; | 969 gesture_.type = WebInputEvent::GestureFlingStart; |
968 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; | 970 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; |
969 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 971 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
970 | 972 |
971 VERIFY_AND_RESET_MOCKS(); | 973 VERIFY_AND_RESET_MOCKS(); |
972 | 974 |
973 // Even if we didn't start a fling ourselves, we still need to send the cancel | 975 // Subsequent scrolls should behave normally, even without an intervening |
974 // event to the widget. | 976 // GestureFlingCancel, as the original GestureFlingStart was dropped. |
975 gesture_.type = WebInputEvent::GestureFlingCancel; | 977 expected_disposition_ = InputHandlerProxy::DID_HANDLE; |
| 978 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
| 979 .WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED)); |
| 980 gesture_.type = WebInputEvent::GestureScrollBegin; |
976 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; | 981 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; |
977 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); | 982 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); |
978 } | 983 } |
979 | 984 |
980 TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchscreen) { | 985 TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchscreen) { |
981 // We shouldn't send any events to the widget for this gesture. | 986 // We shouldn't send any events to the widget for this gesture. |
982 expected_disposition_ = InputHandlerProxy::DID_HANDLE; | 987 expected_disposition_ = InputHandlerProxy::DID_HANDLE; |
983 VERIFY_AND_RESET_MOCKS(); | 988 VERIFY_AND_RESET_MOCKS(); |
984 | 989 |
985 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) | 990 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); | 2131 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); |
2127 EXPECT_CALL(mock_client, DidAnimateForInput()); | 2132 EXPECT_CALL(mock_client, DidAnimateForInput()); |
2128 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); | 2133 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); |
2129 input_handler_->Animate(time); | 2134 input_handler_->Animate(time); |
2130 | 2135 |
2131 testing::Mock::VerifyAndClearExpectations(&mock_client); | 2136 testing::Mock::VerifyAndClearExpectations(&mock_client); |
2132 } | 2137 } |
2133 | 2138 |
2134 } // namespace | 2139 } // namespace |
2135 } // namespace content | 2140 } // namespace content |
OLD | NEW |