| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/events/blink/input_handler_proxy.h" | 5 #include "ui/events/blink/input_handler_proxy.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 WebPoint global_point, | 115 WebPoint global_point, |
| 116 int modifiers) { | 116 int modifiers) { |
| 117 return CreateFling(base::TimeTicks(), | 117 return CreateFling(base::TimeTicks(), |
| 118 source_device, | 118 source_device, |
| 119 velocity, | 119 velocity, |
| 120 point, | 120 point, |
| 121 global_point, | 121 global_point, |
| 122 modifiers); | 122 modifiers); |
| 123 } | 123 } |
| 124 | 124 |
| 125 blink::WebScopedInputEvent CreateGestureScrollOrPinch(WebInputEvent::Type type, | 125 WebScopedInputEvent CreateGestureScrollOrPinch(WebInputEvent::Type type, |
| 126 float deltaYOrScale = 0, | 126 float deltaYOrScale = 0, |
| 127 int x = 0, | 127 int x = 0, |
| 128 int y = 0) { | 128 int y = 0) { |
| 129 WebGestureEvent gesture(type, WebInputEvent::NoModifiers, | 129 WebGestureEvent gesture(type, WebInputEvent::NoModifiers, |
| 130 WebInputEvent::TimeStampForTesting); | 130 WebInputEvent::TimeStampForTesting); |
| 131 gesture.sourceDevice = blink::WebGestureDeviceTouchpad; | 131 gesture.sourceDevice = blink::WebGestureDeviceTouchpad; |
| 132 if (type == WebInputEvent::GestureScrollUpdate) { | 132 if (type == WebInputEvent::GestureScrollUpdate) { |
| 133 gesture.data.scrollUpdate.deltaY = deltaYOrScale; | 133 gesture.data.scrollUpdate.deltaY = deltaYOrScale; |
| 134 } else if (type == WebInputEvent::GesturePinchUpdate) { | 134 } else if (type == WebInputEvent::GesturePinchUpdate) { |
| 135 gesture.data.pinchUpdate.scale = deltaYOrScale; | 135 gesture.data.pinchUpdate.scale = deltaYOrScale; |
| 136 gesture.x = x; | 136 gesture.x = x; |
| 137 gesture.y = y; | 137 gesture.y = y; |
| 138 } | 138 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 266 |
| 267 void WillShutdown() override {} | 267 void WillShutdown() override {} |
| 268 | 268 |
| 269 MOCK_METHOD1(TransferActiveWheelFlingAnimation, | 269 MOCK_METHOD1(TransferActiveWheelFlingAnimation, |
| 270 void(const WebActiveWheelFlingParameters&)); | 270 void(const WebActiveWheelFlingParameters&)); |
| 271 | 271 |
| 272 MOCK_METHOD1(DispatchNonBlockingEventToMainThread_, | 272 MOCK_METHOD1(DispatchNonBlockingEventToMainThread_, |
| 273 void(const WebInputEvent&)); | 273 void(const WebInputEvent&)); |
| 274 | 274 |
| 275 void DispatchNonBlockingEventToMainThread( | 275 void DispatchNonBlockingEventToMainThread( |
| 276 blink::WebScopedInputEvent event, | 276 WebScopedInputEvent event, |
| 277 const ui::LatencyInfo& latency_info) override { | 277 const ui::LatencyInfo& latency_info) override { |
| 278 CHECK(event.get()); | 278 CHECK(event.get()); |
| 279 DispatchNonBlockingEventToMainThread_(*event.get()); | 279 DispatchNonBlockingEventToMainThread_(*event.get()); |
| 280 } | 280 } |
| 281 | 281 |
| 282 blink::WebGestureCurve* CreateFlingAnimationCurve( | 282 blink::WebGestureCurve* CreateFlingAnimationCurve( |
| 283 WebGestureDevice deviceSource, | 283 WebGestureDevice deviceSource, |
| 284 const WebFloatPoint& velocity, | 284 const WebFloatPoint& velocity, |
| 285 const WebSize& cumulative_scroll) override { | 285 const WebSize& cumulative_scroll) override { |
| 286 return new FakeWebGestureCurve( | 286 return new FakeWebGestureCurve( |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 LatencyInfo latency; | 503 LatencyInfo latency; |
| 504 input_handler_proxy_->HandleInputEventWithLatencyInfo( | 504 input_handler_proxy_->HandleInputEventWithLatencyInfo( |
| 505 CreateGestureScrollOrPinch(type, deltay_or_scale, x, y), latency, | 505 CreateGestureScrollOrPinch(type, deltay_or_scale, x, y), latency, |
| 506 base::Bind( | 506 base::Bind( |
| 507 &InputHandlerProxyEventQueueTest::DidHandleInputEventAndOverscroll, | 507 &InputHandlerProxyEventQueueTest::DidHandleInputEventAndOverscroll, |
| 508 weak_ptr_factory_.GetWeakPtr())); | 508 weak_ptr_factory_.GetWeakPtr())); |
| 509 } | 509 } |
| 510 | 510 |
| 511 void DidHandleInputEventAndOverscroll( | 511 void DidHandleInputEventAndOverscroll( |
| 512 InputHandlerProxy::EventDisposition event_disposition, | 512 InputHandlerProxy::EventDisposition event_disposition, |
| 513 blink::WebScopedInputEvent input_event, | 513 WebScopedInputEvent input_event, |
| 514 const ui::LatencyInfo& latency_info, | 514 const ui::LatencyInfo& latency_info, |
| 515 std::unique_ptr<ui::DidOverscrollParams> overscroll_params) { | 515 std::unique_ptr<ui::DidOverscrollParams> overscroll_params) { |
| 516 event_disposition_recorder_.push_back(event_disposition); | 516 event_disposition_recorder_.push_back(event_disposition); |
| 517 } | 517 } |
| 518 | 518 |
| 519 std::deque<std::unique_ptr<EventWithCallback>>& event_queue() { | 519 std::deque<std::unique_ptr<EventWithCallback>>& event_queue() { |
| 520 return input_handler_proxy_->compositor_event_queue_->queue_; | 520 return input_handler_proxy_->compositor_event_queue_->queue_; |
| 521 } | 521 } |
| 522 | 522 |
| 523 void SetInputHandlerProxyTickClockForTesting( | 523 void SetInputHandlerProxyTickClockForTesting( |
| (...skipping 2896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3420 EXPECT_EQ(WebInputEvent::GesturePinchEnd, event_queue()[6]->event().type()); | 3420 EXPECT_EQ(WebInputEvent::GesturePinchEnd, event_queue()[6]->event().type()); |
| 3421 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 3421 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 3422 } | 3422 } |
| 3423 | 3423 |
| 3424 INSTANTIATE_TEST_CASE_P(AnimateInput, | 3424 INSTANTIATE_TEST_CASE_P(AnimateInput, |
| 3425 InputHandlerProxyTest, | 3425 InputHandlerProxyTest, |
| 3426 testing::ValuesIn(test_types)); | 3426 testing::ValuesIn(test_types)); |
| 3427 | 3427 |
| 3428 } // namespace test | 3428 } // namespace test |
| 3429 } // namespace ui | 3429 } // namespace ui |
| OLD | NEW |