OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ROUTER_CLIENT_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ROUTER_CLIENT_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/browser/renderer_host/input/input_router_client.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 class InputRouter; |
| 14 |
| 15 class MockInputRouterClient : public InputRouterClient { |
| 16 public: |
| 17 MockInputRouterClient(); |
| 18 virtual ~MockInputRouterClient(); |
| 19 |
| 20 // InputRouterClient |
| 21 virtual InputEventAckState FilterInputEvent( |
| 22 const WebKit::WebInputEvent& input_event, |
| 23 const ui::LatencyInfo& latency_info) OVERRIDE; |
| 24 virtual void IncrementInFlightEventCount() OVERRIDE; |
| 25 virtual void DecrementInFlightEventCount() OVERRIDE; |
| 26 virtual void OnHasTouchEventHandlers(bool has_handlers) OVERRIDE; |
| 27 virtual bool OnSendKeyboardEvent( |
| 28 const NativeWebKeyboardEvent& key_event, |
| 29 const ui::LatencyInfo& latency_info, |
| 30 bool* is_shortcut) OVERRIDE; |
| 31 virtual bool OnSendWheelEvent( |
| 32 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE; |
| 33 virtual bool OnSendMouseEvent( |
| 34 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE; |
| 35 virtual bool OnSendTouchEvent( |
| 36 const TouchEventWithLatencyInfo& touch_event) OVERRIDE; |
| 37 virtual bool OnSendGestureEvent( |
| 38 const GestureEventWithLatencyInfo& gesture_event) OVERRIDE; |
| 39 virtual bool OnSendMouseEventImmediately( |
| 40 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE; |
| 41 virtual bool OnSendTouchEventImmediately( |
| 42 const TouchEventWithLatencyInfo& touch_event) OVERRIDE; |
| 43 virtual bool OnSendGestureEventImmediately( |
| 44 const GestureEventWithLatencyInfo& gesture_event) OVERRIDE; |
| 45 virtual void DidFlush() OVERRIDE; |
| 46 virtual void SetNeedsFlush() OVERRIDE; |
| 47 |
| 48 void ExpectSendCalled(bool called); |
| 49 void ExpectSendImmediatelyCalled(bool called); |
| 50 void ExpectNeedsFlushCalled(bool called); |
| 51 void ExpectDidFlushCalled(bool called); |
| 52 |
| 53 void set_input_router(InputRouter* input_router) { |
| 54 input_router_ = input_router; |
| 55 } |
| 56 |
| 57 bool has_touch_handler() const { return has_touch_handler_; } |
| 58 void set_filter_state(InputEventAckState filter_state) { |
| 59 filter_state_ = filter_state; |
| 60 } |
| 61 int in_flight_event_count() const { |
| 62 return in_flight_event_count_; |
| 63 } |
| 64 void set_is_shortcut(bool is_shortcut) { |
| 65 is_shortcut_ = is_shortcut; |
| 66 } |
| 67 void set_allow_send_event(bool allow) { |
| 68 allow_send_event_ = allow; |
| 69 } |
| 70 const NativeWebKeyboardEvent& sent_key_event() { |
| 71 return sent_key_event_; |
| 72 } |
| 73 const MouseWheelEventWithLatencyInfo& sent_wheel_event() { |
| 74 return sent_wheel_event_; |
| 75 } |
| 76 const MouseEventWithLatencyInfo& sent_mouse_event() { |
| 77 return sent_mouse_event_; |
| 78 } |
| 79 const GestureEventWithLatencyInfo& sent_gesture_event() { |
| 80 return sent_gesture_event_; |
| 81 } |
| 82 const MouseEventWithLatencyInfo& immediately_sent_mouse_event() { |
| 83 return immediately_sent_mouse_event_; |
| 84 } |
| 85 const TouchEventWithLatencyInfo& immediately_sent_touch_event() { |
| 86 return immediately_sent_touch_event_; |
| 87 } |
| 88 const GestureEventWithLatencyInfo& immediately_sent_gesture_event() { |
| 89 return immediately_sent_gesture_event_; |
| 90 } |
| 91 |
| 92 bool did_flush_called() const { return did_flush_called_; } |
| 93 bool needs_flush_called() const { return set_needs_flush_called_; } |
| 94 void set_followup_touch_event(scoped_ptr<GestureEventWithLatencyInfo> event) { |
| 95 touch_followup_event_ = event.Pass(); |
| 96 } |
| 97 |
| 98 private: |
| 99 InputRouter* input_router_; |
| 100 int in_flight_event_count_; |
| 101 bool has_touch_handler_; |
| 102 |
| 103 InputEventAckState filter_state_; |
| 104 |
| 105 bool is_shortcut_; |
| 106 bool allow_send_event_; |
| 107 bool send_called_; |
| 108 NativeWebKeyboardEvent sent_key_event_; |
| 109 MouseWheelEventWithLatencyInfo sent_wheel_event_; |
| 110 MouseEventWithLatencyInfo sent_mouse_event_; |
| 111 TouchEventWithLatencyInfo sent_touch_event_; |
| 112 GestureEventWithLatencyInfo sent_gesture_event_; |
| 113 |
| 114 bool send_immediately_called_; |
| 115 MouseEventWithLatencyInfo immediately_sent_mouse_event_; |
| 116 TouchEventWithLatencyInfo immediately_sent_touch_event_; |
| 117 GestureEventWithLatencyInfo immediately_sent_gesture_event_; |
| 118 |
| 119 bool did_flush_called_; |
| 120 bool set_needs_flush_called_; |
| 121 scoped_ptr<GestureEventWithLatencyInfo> touch_followup_event_; |
| 122 }; |
| 123 |
| 124 } // namespace content |
| 125 |
| 126 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ROUTER_CLIENT_H_ |
OLD | NEW |