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