| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 WebPoint global_point, | 113 WebPoint global_point, |
| 114 int modifiers) { | 114 int modifiers) { |
| 115 return CreateFling(base::TimeTicks(), | 115 return CreateFling(base::TimeTicks(), |
| 116 source_device, | 116 source_device, |
| 117 velocity, | 117 velocity, |
| 118 point, | 118 point, |
| 119 global_point, | 119 global_point, |
| 120 modifiers); | 120 modifiers); |
| 121 } | 121 } |
| 122 | 122 |
| 123 ScopedWebInputEvent CreateGestureScrollOrPinch(WebInputEvent::Type type, | 123 blink::WebScopedInputEvent CreateGestureScrollOrPinch(WebInputEvent::Type type, |
| 124 float deltaYOrScale = 0, | 124 float deltaYOrScale = 0, |
| 125 int x = 0, | 125 int x = 0, |
| 126 int y = 0) { | 126 int y = 0) { |
| 127 WebGestureEvent gesture(type, WebInputEvent::NoModifiers, | 127 WebGestureEvent gesture(type, WebInputEvent::NoModifiers, |
| 128 WebInputEvent::TimeStampForTesting); | 128 WebInputEvent::TimeStampForTesting); |
| 129 gesture.sourceDevice = blink::WebGestureDeviceTouchpad; | 129 gesture.sourceDevice = blink::WebGestureDeviceTouchpad; |
| 130 if (type == WebInputEvent::GestureScrollUpdate) { | 130 if (type == WebInputEvent::GestureScrollUpdate) { |
| 131 gesture.data.scrollUpdate.deltaY = deltaYOrScale; | 131 gesture.data.scrollUpdate.deltaY = deltaYOrScale; |
| 132 } else if (type == WebInputEvent::GesturePinchUpdate) { | 132 } else if (type == WebInputEvent::GesturePinchUpdate) { |
| 133 gesture.data.pinchUpdate.scale = deltaYOrScale; | 133 gesture.data.pinchUpdate.scale = deltaYOrScale; |
| 134 gesture.x = x; | 134 gesture.x = x; |
| 135 gesture.y = y; | 135 gesture.y = y; |
| 136 } | 136 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 264 |
| 265 void WillShutdown() override {} | 265 void WillShutdown() override {} |
| 266 | 266 |
| 267 MOCK_METHOD1(TransferActiveWheelFlingAnimation, | 267 MOCK_METHOD1(TransferActiveWheelFlingAnimation, |
| 268 void(const WebActiveWheelFlingParameters&)); | 268 void(const WebActiveWheelFlingParameters&)); |
| 269 | 269 |
| 270 MOCK_METHOD1(DispatchNonBlockingEventToMainThread_, | 270 MOCK_METHOD1(DispatchNonBlockingEventToMainThread_, |
| 271 void(const WebInputEvent&)); | 271 void(const WebInputEvent&)); |
| 272 | 272 |
| 273 void DispatchNonBlockingEventToMainThread( | 273 void DispatchNonBlockingEventToMainThread( |
| 274 ui::ScopedWebInputEvent event, | 274 blink::WebScopedInputEvent event, |
| 275 const ui::LatencyInfo& latency_info) override { | 275 const ui::LatencyInfo& latency_info) override { |
| 276 CHECK(event.get()); | 276 CHECK(event.get()); |
| 277 DispatchNonBlockingEventToMainThread_(*event.get()); | 277 DispatchNonBlockingEventToMainThread_(*event.get()); |
| 278 } | 278 } |
| 279 | 279 |
| 280 blink::WebGestureCurve* CreateFlingAnimationCurve( | 280 blink::WebGestureCurve* CreateFlingAnimationCurve( |
| 281 WebGestureDevice deviceSource, | 281 WebGestureDevice deviceSource, |
| 282 const WebFloatPoint& velocity, | 282 const WebFloatPoint& velocity, |
| 283 const WebSize& cumulative_scroll) override { | 283 const WebSize& cumulative_scroll) override { |
| 284 return new FakeWebGestureCurve( | 284 return new FakeWebGestureCurve( |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 LatencyInfo latency; | 497 LatencyInfo latency; |
| 498 input_handler_proxy_->HandleInputEventWithLatencyInfo( | 498 input_handler_proxy_->HandleInputEventWithLatencyInfo( |
| 499 CreateGestureScrollOrPinch(type, deltay_or_scale, x, y), latency, | 499 CreateGestureScrollOrPinch(type, deltay_or_scale, x, y), latency, |
| 500 base::Bind( | 500 base::Bind( |
| 501 &InputHandlerProxyEventQueueTest::DidHandleInputEventAndOverscroll, | 501 &InputHandlerProxyEventQueueTest::DidHandleInputEventAndOverscroll, |
| 502 weak_ptr_factory_.GetWeakPtr())); | 502 weak_ptr_factory_.GetWeakPtr())); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void DidHandleInputEventAndOverscroll( | 505 void DidHandleInputEventAndOverscroll( |
| 506 InputHandlerProxy::EventDisposition event_disposition, | 506 InputHandlerProxy::EventDisposition event_disposition, |
| 507 ui::ScopedWebInputEvent input_event, | 507 blink::WebScopedInputEvent input_event, |
| 508 const ui::LatencyInfo& latency_info, | 508 const ui::LatencyInfo& latency_info, |
| 509 std::unique_ptr<ui::DidOverscrollParams> overscroll_params) { | 509 std::unique_ptr<ui::DidOverscrollParams> overscroll_params) { |
| 510 event_disposition_recorder_.push_back(event_disposition); | 510 event_disposition_recorder_.push_back(event_disposition); |
| 511 } | 511 } |
| 512 | 512 |
| 513 std::deque<std::unique_ptr<EventWithCallback>>& event_queue() { | 513 std::deque<std::unique_ptr<EventWithCallback>>& event_queue() { |
| 514 return input_handler_proxy_->compositor_event_queue_->queue_; | 514 return input_handler_proxy_->compositor_event_queue_->queue_; |
| 515 } | 515 } |
| 516 | 516 |
| 517 void SetInputHandlerProxyTickClockForTesting( | 517 void SetInputHandlerProxyTickClockForTesting( |
| (...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3132 EXPECT_EQ(WebInputEvent::GesturePinchEnd, event_queue()[6]->event().type); | 3132 EXPECT_EQ(WebInputEvent::GesturePinchEnd, event_queue()[6]->event().type); |
| 3133 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); | 3133 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); |
| 3134 } | 3134 } |
| 3135 | 3135 |
| 3136 INSTANTIATE_TEST_CASE_P(AnimateInput, | 3136 INSTANTIATE_TEST_CASE_P(AnimateInput, |
| 3137 InputHandlerProxyTest, | 3137 InputHandlerProxyTest, |
| 3138 testing::ValuesIn(test_types)); | 3138 testing::ValuesIn(test_types)); |
| 3139 | 3139 |
| 3140 } // namespace test | 3140 } // namespace test |
| 3141 } // namespace ui | 3141 } // namespace ui |
| OLD | NEW |