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

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

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 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ROUTER_CLIENT_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ROUTER_CLIENT_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ROUTER_CLIENT_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ROUTER_CLIENT_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/renderer_host/input/input_router_client.h" 9 #include "content/browser/renderer_host/input/input_router_client.h"
10 #include "content/common/input/did_overscroll_params.h" 10 #include "content/common/input/did_overscroll_params.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 class InputEvent; 14 class InputEvent;
15 class InputRouter; 15 class InputRouter;
16 16
17 class MockInputRouterClient : public InputRouterClient { 17 class MockInputRouterClient : public InputRouterClient {
18 public: 18 public:
19 MockInputRouterClient(); 19 MockInputRouterClient();
20 virtual ~MockInputRouterClient(); 20 virtual ~MockInputRouterClient();
21 21
22 // InputRouterClient 22 // InputRouterClient
23 virtual InputEventAckState FilterInputEvent( 23 virtual InputEventAckState FilterInputEvent(
24 const blink::WebInputEvent& input_event, 24 const blink::WebInputEvent& input_event,
25 const ui::LatencyInfo& latency_info) override; 25 const ui::LatencyInfo& latency_info) override;
26 virtual void IncrementInFlightEventCount() override; 26 virtual void IncrementInFlightEventCount() override;
27 virtual void DecrementInFlightEventCount() override; 27 virtual void DecrementInFlightEventCount() override;
28 virtual void OnHasTouchEventHandlers(bool has_handlers) override;
29 virtual void SetNeedsFlush() override;
30 virtual void DidFlush() override; 28 virtual void DidFlush() override;
31 virtual void DidOverscroll(const DidOverscrollParams& params) override; 29 virtual void DidOverscroll(const DidOverscrollParams& params) override;
32 30
33 bool GetAndResetFilterEventCalled(); 31 bool GetAndResetFilterEventCalled();
34 size_t GetAndResetDidFlushCount(); 32 size_t GetAndResetDidFlushCount();
35 DidOverscrollParams GetAndResetOverscroll(); 33 DidOverscrollParams GetAndResetOverscroll();
36 34
37 void set_input_router(InputRouter* input_router) { 35 void set_input_router(InputRouter* input_router) {
38 input_router_ = input_router; 36 input_router_ = input_router;
39 } 37 }
40 38
41 bool has_touch_handler() const { return has_touch_handler_; }
42 void set_filter_state(InputEventAckState filter_state) { 39 void set_filter_state(InputEventAckState filter_state) {
43 filter_state_ = filter_state; 40 filter_state_ = filter_state;
44 } 41 }
45 int in_flight_event_count() const { 42 int in_flight_event_count() const {
46 return in_flight_event_count_; 43 return in_flight_event_count_;
47 } 44 }
48 void set_allow_send_event(bool allow) { 45 void set_allow_send_event(bool allow) {
49 filter_state_ = INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; 46 filter_state_ = INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
50 } 47 }
51 48
52 private: 49 private:
53 InputRouter* input_router_; 50 InputRouter* input_router_;
54 int in_flight_event_count_; 51 int in_flight_event_count_;
55 bool has_touch_handler_;
56 52
57 InputEventAckState filter_state_; 53 InputEventAckState filter_state_;
58 54
59 bool filter_input_event_called_; 55 bool filter_input_event_called_;
60 scoped_ptr<InputEvent> last_filter_event_; 56 scoped_ptr<InputEvent> last_filter_event_;
61 57
62 size_t did_flush_called_count_; 58 size_t did_flush_called_count_;
63 bool set_needs_flush_called_;
64 59
65 DidOverscrollParams overscroll_; 60 DidOverscrollParams overscroll_;
66 }; 61 };
67 62
68 } // namespace content 63 } // namespace content
69 64
70 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ROUTER_CLIENT_H_ 65 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ROUTER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698