Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: content/browser/renderer_host/input/mock_input_router_client.cc

Issue 628763003: Support InputRouter recycling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 filter_state_(INPUT_EVENT_ACK_STATE_NOT_CONSUMED),
25 filter_state_(INPUT_EVENT_ACK_STATE_NOT_CONSUMED), 25 filter_input_event_called_(false),
26 filter_input_event_called_(false), 26 did_flush_called_count_(0) {
27 did_flush_called_count_(0), 27 }
28 set_needs_flush_called_(false) {}
29 28
30 MockInputRouterClient::~MockInputRouterClient() {} 29 MockInputRouterClient::~MockInputRouterClient() {}
31 30
32 InputEventAckState MockInputRouterClient::FilterInputEvent( 31 InputEventAckState MockInputRouterClient::FilterInputEvent(
33 const WebInputEvent& input_event, 32 const WebInputEvent& input_event,
34 const ui::LatencyInfo& latency_info) { 33 const ui::LatencyInfo& latency_info) {
35 filter_input_event_called_ = true; 34 filter_input_event_called_ = true;
36 last_filter_event_.reset(new InputEvent(input_event, latency_info, false)); 35 last_filter_event_.reset(new InputEvent(input_event, latency_info, false));
37 return filter_state_; 36 return filter_state_;
38 } 37 }
39 38
40 void MockInputRouterClient::IncrementInFlightEventCount() { 39 void MockInputRouterClient::IncrementInFlightEventCount() {
41 ++in_flight_event_count_; 40 ++in_flight_event_count_;
42 } 41 }
43 42
44 void MockInputRouterClient::DecrementInFlightEventCount() { 43 void MockInputRouterClient::DecrementInFlightEventCount() {
45 --in_flight_event_count_; 44 --in_flight_event_count_;
46 } 45 }
47 46
48 void MockInputRouterClient::OnHasTouchEventHandlers(
49 bool has_handlers) {
50 has_touch_handler_ = has_handlers;
51 }
52
53 void MockInputRouterClient::SetNeedsFlush() {
54 set_needs_flush_called_ = true;
55 }
56
57 void MockInputRouterClient::DidFlush() { 47 void MockInputRouterClient::DidFlush() {
58 ++did_flush_called_count_; 48 ++did_flush_called_count_;
59 } 49 }
60 50
61 void MockInputRouterClient::DidOverscroll(const DidOverscrollParams& params) { 51 void MockInputRouterClient::DidOverscroll(const DidOverscrollParams& params) {
62 overscroll_ = params; 52 overscroll_ = params;
63 } 53 }
64 54
65 bool MockInputRouterClient::GetAndResetFilterEventCalled() { 55 bool MockInputRouterClient::GetAndResetFilterEventCalled() {
66 bool filter_input_event_called = filter_input_event_called_; 56 bool filter_input_event_called = filter_input_event_called_;
67 filter_input_event_called_ = false; 57 filter_input_event_called_ = false;
68 return filter_input_event_called; 58 return filter_input_event_called;
69 } 59 }
70 60
71 size_t MockInputRouterClient::GetAndResetDidFlushCount() { 61 size_t MockInputRouterClient::GetAndResetDidFlushCount() {
72 size_t did_flush_called_count = did_flush_called_count_; 62 size_t did_flush_called_count = did_flush_called_count_;
73 did_flush_called_count_ = 0; 63 did_flush_called_count_ = 0;
74 return did_flush_called_count; 64 return did_flush_called_count;
75 } 65 }
76 66
77 DidOverscrollParams MockInputRouterClient::GetAndResetOverscroll() { 67 DidOverscrollParams MockInputRouterClient::GetAndResetOverscroll() {
78 DidOverscrollParams overscroll; 68 DidOverscrollParams overscroll;
79 std::swap(overscroll_, overscroll); 69 std::swap(overscroll_, overscroll);
80 return overscroll; 70 return overscroll;
81 } 71 }
82 72
83 } // namespace content 73 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698