| 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/browser/renderer_host/input/mock_input_router_client.h" | 5 #include "content/browser/renderer_host/input/mock_input_router_client.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/input/input_router.h" | 7 #include "content/browser/renderer_host/input/input_router.h" |
| 8 #include "content/common/input/input_event.h" | 8 #include "content/common/input/input_event.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 void MockInputRouterClient::OnHasTouchEventHandlers( | 48 void MockInputRouterClient::OnHasTouchEventHandlers( |
| 49 bool has_handlers) { | 49 bool has_handlers) { |
| 50 has_touch_handler_ = has_handlers; | 50 has_touch_handler_ = has_handlers; |
| 51 } | 51 } |
| 52 | 52 |
| 53 void MockInputRouterClient::DidFlush() { | 53 void MockInputRouterClient::DidFlush() { |
| 54 ++did_flush_called_count_; | 54 ++did_flush_called_count_; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void MockInputRouterClient::DidOverscroll(const DidOverscrollParams& params) { | 57 void MockInputRouterClient::DidOverscroll( |
| 58 const ui::DidOverscrollParams& params) { |
| 58 overscroll_ = params; | 59 overscroll_ = params; |
| 59 } | 60 } |
| 60 | 61 |
| 61 void MockInputRouterClient::DidStopFlinging() { | 62 void MockInputRouterClient::DidStopFlinging() { |
| 62 } | 63 } |
| 63 | 64 |
| 64 void MockInputRouterClient::ForwardGestureEventWithLatencyInfo( | 65 void MockInputRouterClient::ForwardGestureEventWithLatencyInfo( |
| 65 const blink::WebGestureEvent& gesture_event, | 66 const blink::WebGestureEvent& gesture_event, |
| 66 const ui::LatencyInfo& latency_info) { | 67 const ui::LatencyInfo& latency_info) { |
| 67 if (input_router_) | 68 if (input_router_) |
| 68 input_router_->SendGestureEvent( | 69 input_router_->SendGestureEvent( |
| 69 GestureEventWithLatencyInfo(gesture_event, latency_info)); | 70 GestureEventWithLatencyInfo(gesture_event, latency_info)); |
| 70 } | 71 } |
| 71 | 72 |
| 72 bool MockInputRouterClient::GetAndResetFilterEventCalled() { | 73 bool MockInputRouterClient::GetAndResetFilterEventCalled() { |
| 73 bool filter_input_event_called = filter_input_event_called_; | 74 bool filter_input_event_called = filter_input_event_called_; |
| 74 filter_input_event_called_ = false; | 75 filter_input_event_called_ = false; |
| 75 return filter_input_event_called; | 76 return filter_input_event_called; |
| 76 } | 77 } |
| 77 | 78 |
| 78 size_t MockInputRouterClient::GetAndResetDidFlushCount() { | 79 size_t MockInputRouterClient::GetAndResetDidFlushCount() { |
| 79 size_t did_flush_called_count = did_flush_called_count_; | 80 size_t did_flush_called_count = did_flush_called_count_; |
| 80 did_flush_called_count_ = 0; | 81 did_flush_called_count_ = 0; |
| 81 return did_flush_called_count; | 82 return did_flush_called_count; |
| 82 } | 83 } |
| 83 | 84 |
| 84 DidOverscrollParams MockInputRouterClient::GetAndResetOverscroll() { | 85 ui::DidOverscrollParams MockInputRouterClient::GetAndResetOverscroll() { |
| 85 DidOverscrollParams overscroll; | 86 ui::DidOverscrollParams overscroll; |
| 86 std::swap(overscroll_, overscroll); | 87 std::swap(overscroll_, overscroll); |
| 87 return overscroll; | 88 return overscroll; |
| 88 } | 89 } |
| 89 | 90 |
| 90 } // namespace content | 91 } // namespace content |
| OLD | NEW |