Chromium Code Reviews| 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; | |
| 
 
aelias_OOO_until_Jul13
2013/08/13 06:11:51
These two Increment/Decrement methods seem to only
 
jdduke (slow)
2013/08/13 15:29:48
? This is how the client can determine if the rend
 
 | |
| 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 OnKeyboardEventAck(const NativeWebKeyboardEvent& event, | |
| 46 InputEventAckState ack_result) OVERRIDE; | |
| 47 virtual void OnWheelEventAck(const WebKit::WebMouseWheelEvent& event, | |
| 48 InputEventAckState ack_result) OVERRIDE; | |
| 49 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, | |
| 50 InputEventAckState ack_result) OVERRIDE; | |
| 51 virtual void OnGestureEventAck(const WebKit::WebGestureEvent& event, | |
| 52 InputEventAckState ack_result) OVERRIDE; | |
| 53 virtual void OnUnexpectedEventAck(bool bad_message) OVERRIDE; | |
| 
 
aelias_OOO_until_Jul13
2013/08/13 06:11:51
Looks like this is also only for testing, please d
 
jdduke (slow)
2013/08/13 15:29:48
I tried to restrict this patch as much as possible
 
 | |
| 54 virtual void DidFlush() OVERRIDE; | |
| 
 
aelias_OOO_until_Jul13
2013/08/13 06:11:51
Looks like this is also only for testing, please d
 
jdduke (slow)
2013/08/13 15:29:48
See comment above.
 
 | |
| 55 virtual void SetNeedsFlush() OVERRIDE; | |
| 56 | |
| 57 void ExpectSendCalled(bool called); | |
| 58 void ExpectSendImmediatelyCalled(bool called); | |
| 59 void ExpectAckCalled(int times); | |
| 60 void ExpectNeedsFlushCalled(bool called); | |
| 61 void ExpectDidFlushCalled(bool called); | |
| 62 | |
| 63 void set_input_router(InputRouter* input_router) { | |
| 64 input_router_ = input_router; | |
| 65 } | |
| 66 | |
| 67 bool has_touch_handler() const { return has_touch_handler_; } | |
| 68 InputEventAckState ack_state() const { return ack_state_; } | |
| 69 void set_filter_state(InputEventAckState filter_state) { | |
| 70 filter_state_ = filter_state; | |
| 71 } | |
| 72 int in_flight_event_count() const { | |
| 73 return in_flight_event_count_; | |
| 74 } | |
| 75 bool unexpected_event_ack_called() const { | |
| 76 return unexpected_event_ack_called_; | |
| 77 } | |
| 78 const NativeWebKeyboardEvent& acked_keyboard_event() { | |
| 79 return acked_key_event_; | |
| 80 } | |
| 81 const WebKit::WebMouseWheelEvent& acked_wheel_event() { | |
| 82 return acked_wheel_event_; | |
| 83 } | |
| 84 const TouchEventWithLatencyInfo& acked_touch_event() { | |
| 85 return acked_touch_event_; | |
| 86 } | |
| 87 const WebKit::WebGestureEvent& acked_gesture_event() { | |
| 88 return acked_gesture_event_; | |
| 89 } | |
| 90 void set_is_shortcut(bool is_shortcut) { | |
| 91 is_shortcut_ = is_shortcut; | |
| 92 } | |
| 93 void set_allow_send_event(bool allow) { | |
| 94 allow_send_event_ = allow; | |
| 95 } | |
| 96 const NativeWebKeyboardEvent& sent_key_event() { | |
| 97 return sent_key_event_; | |
| 98 } | |
| 99 const MouseWheelEventWithLatencyInfo& sent_wheel_event() { | |
| 100 return sent_wheel_event_; | |
| 101 } | |
| 102 const MouseEventWithLatencyInfo& sent_mouse_event() { | |
| 103 return sent_mouse_event_; | |
| 104 } | |
| 105 const GestureEventWithLatencyInfo& sent_gesture_event() { | |
| 106 return sent_gesture_event_; | |
| 107 } | |
| 108 const MouseEventWithLatencyInfo& immediately_sent_mouse_event() { | |
| 109 return immediately_sent_mouse_event_; | |
| 110 } | |
| 111 const TouchEventWithLatencyInfo& immediately_sent_touch_event() { | |
| 112 return immediately_sent_touch_event_; | |
| 113 } | |
| 114 const GestureEventWithLatencyInfo& immediately_sent_gesture_event() { | |
| 115 return immediately_sent_gesture_event_; | |
| 116 } | |
| 117 | |
| 118 void set_sync_flush(bool sync_flush) { sync_flush_ = sync_flush; } | |
| 119 bool did_flush_called() const { return did_flush_called_; } | |
| 120 bool needs_flush_called() const { return set_needs_flush_called_; } | |
| 121 void set_followup_touch_event(scoped_ptr<GestureEventWithLatencyInfo> event) { | |
| 122 touch_followup_event_ = event.Pass(); | |
| 123 } | |
| 124 | |
| 125 private: | |
| 126 void RecordAckCalled(InputEventAckState ack_result); | |
| 127 | |
| 128 InputRouter* input_router_; | |
| 129 int in_flight_event_count_; | |
| 130 bool has_touch_handler_; | |
| 131 | |
| 132 int ack_count_; | |
| 133 bool unexpected_event_ack_called_; | |
| 134 InputEventAckState ack_state_; | |
| 135 InputEventAckState filter_state_; | |
| 136 NativeWebKeyboardEvent acked_key_event_; | |
| 137 WebKit::WebMouseWheelEvent acked_wheel_event_; | |
| 138 TouchEventWithLatencyInfo acked_touch_event_; | |
| 139 WebKit::WebGestureEvent acked_gesture_event_; | |
| 140 | |
| 141 bool is_shortcut_; | |
| 142 bool allow_send_event_; | |
| 143 bool send_called_; | |
| 144 NativeWebKeyboardEvent sent_key_event_; | |
| 145 MouseWheelEventWithLatencyInfo sent_wheel_event_; | |
| 146 MouseEventWithLatencyInfo sent_mouse_event_; | |
| 147 TouchEventWithLatencyInfo sent_touch_event_; | |
| 148 GestureEventWithLatencyInfo sent_gesture_event_; | |
| 149 | |
| 150 bool send_immediately_called_; | |
| 151 MouseEventWithLatencyInfo immediately_sent_mouse_event_; | |
| 152 TouchEventWithLatencyInfo immediately_sent_touch_event_; | |
| 153 GestureEventWithLatencyInfo immediately_sent_gesture_event_; | |
| 154 | |
| 155 bool sync_flush_; | |
| 156 bool did_flush_called_; | |
| 157 bool set_needs_flush_called_; | |
| 158 scoped_ptr<GestureEventWithLatencyInfo> touch_followup_event_; | |
| 159 }; | |
| 160 | |
| 161 } // namespace content | |
| 162 | |
| 163 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ROUTER_CLIENT_H_ | |
| OLD | NEW |