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 |
11 using base::TimeDelta; | 11 using base::TimeDelta; |
12 using blink::WebGestureEvent; | 12 using blink::WebGestureEvent; |
13 using blink::WebInputEvent; | 13 using blink::WebInputEvent; |
14 using blink::WebMouseEvent; | 14 using blink::WebMouseEvent; |
15 using blink::WebMouseWheelEvent; | 15 using blink::WebMouseWheelEvent; |
16 using blink::WebTouchEvent; | 16 using blink::WebTouchEvent; |
17 using blink::WebTouchPoint; | 17 using blink::WebTouchPoint; |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 MockInputRouterClient::MockInputRouterClient() | 21 MockInputRouterClient::MockInputRouterClient() |
22 : input_router_(NULL), | 22 : input_router_(NULL), |
23 in_flight_event_count_(0), | 23 in_flight_event_count_(0), |
24 has_touch_handler_(false), | 24 has_touch_handler_(false), |
25 filter_state_(INPUT_EVENT_ACK_STATE_NOT_CONSUMED), | 25 filter_state_(INPUT_EVENT_ACK_STATE_NOT_CONSUMED), |
26 filter_input_event_called_(false), | 26 filter_input_event_called_(false), |
27 did_flush_called_(false), | 27 did_flush_called_count_(0), |
28 set_needs_flush_called_(false) {} | 28 set_needs_flush_called_(false) {} |
29 | 29 |
30 MockInputRouterClient::~MockInputRouterClient() {} | 30 MockInputRouterClient::~MockInputRouterClient() {} |
31 | 31 |
32 InputEventAckState MockInputRouterClient::FilterInputEvent( | 32 InputEventAckState MockInputRouterClient::FilterInputEvent( |
33 const WebInputEvent& input_event, | 33 const WebInputEvent& input_event, |
34 const ui::LatencyInfo& latency_info) { | 34 const ui::LatencyInfo& latency_info) { |
35 filter_input_event_called_ = true; | 35 filter_input_event_called_ = true; |
36 last_filter_event_.reset(new InputEvent(input_event, latency_info, false)); | 36 last_filter_event_.reset(new InputEvent(input_event, latency_info, false)); |
37 return filter_state_; | 37 return filter_state_; |
(...skipping 11 matching lines...) Expand all Loading... |
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 bool MockInputRouterClient::GetAndResetFilterEventCalled() { | 53 bool MockInputRouterClient::GetAndResetFilterEventCalled() { |
54 bool filter_input_event_called = filter_input_event_called_; | 54 bool filter_input_event_called = filter_input_event_called_; |
55 filter_input_event_called_ = false; | 55 filter_input_event_called_ = false; |
56 return filter_input_event_called; | 56 return filter_input_event_called; |
57 } | 57 } |
58 | 58 |
| 59 size_t MockInputRouterClient::GetAndResetDidFlushCount() { |
| 60 size_t did_flush_called_count = did_flush_called_count_; |
| 61 did_flush_called_count_ = 0; |
| 62 return did_flush_called_count; |
| 63 } |
| 64 |
59 OverscrollController* MockInputRouterClient::GetOverscrollController() const { | 65 OverscrollController* MockInputRouterClient::GetOverscrollController() const { |
60 return NULL; | 66 return NULL; |
61 } | 67 } |
62 | 68 |
63 void MockInputRouterClient::DidFlush() { | 69 void MockInputRouterClient::DidFlush() { |
64 did_flush_called_ = true; | 70 ++did_flush_called_count_; |
65 } | 71 } |
66 | 72 |
67 void MockInputRouterClient::SetNeedsFlush() { | 73 void MockInputRouterClient::SetNeedsFlush() { |
68 set_needs_flush_called_ = true; | 74 set_needs_flush_called_ = true; |
69 } | 75 } |
70 | 76 |
71 } // namespace content | 77 } // namespace content |
OLD | NEW |