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_ACK_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ACK_HANDLER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/browser/renderer_host/input/input_ack_handler.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 class InputRouter; |
| 14 |
| 15 class MockInputAckHandler : public InputAckHandler { |
| 16 public: |
| 17 MockInputAckHandler(); |
| 18 virtual ~MockInputAckHandler(); |
| 19 |
| 20 // InputAckHandler |
| 21 virtual void OnKeyboardEventAck(const NativeWebKeyboardEvent& event, |
| 22 InputEventAckState ack_result) OVERRIDE; |
| 23 virtual void OnWheelEventAck(const WebKit::WebMouseWheelEvent& event, |
| 24 InputEventAckState ack_result) OVERRIDE; |
| 25 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, |
| 26 InputEventAckState ack_result) OVERRIDE; |
| 27 virtual void OnGestureEventAck(const WebKit::WebGestureEvent& event, |
| 28 InputEventAckState ack_result) OVERRIDE; |
| 29 virtual void OnUnexpectedEventAck(bool bad_message) OVERRIDE; |
| 30 |
| 31 void ExpectAckCalled(int times); |
| 32 |
| 33 void set_input_router(InputRouter* input_router) { |
| 34 input_router_ = input_router; |
| 35 } |
| 36 |
| 37 void set_followup_touch_event(scoped_ptr<GestureEventWithLatencyInfo> event) { |
| 38 touch_followup_event_ = event.Pass(); |
| 39 } |
| 40 |
| 41 bool unexpected_event_ack_called() const { |
| 42 return unexpected_event_ack_called_; |
| 43 } |
| 44 InputEventAckState ack_state() const { return ack_state_; } |
| 45 |
| 46 const NativeWebKeyboardEvent& acked_keyboard_event() const { |
| 47 return acked_key_event_; |
| 48 } |
| 49 const WebKit::WebMouseWheelEvent& acked_wheel_event() const { |
| 50 return acked_wheel_event_; |
| 51 } |
| 52 const TouchEventWithLatencyInfo& acked_touch_event() const { |
| 53 return acked_touch_event_; |
| 54 } |
| 55 const WebKit::WebGestureEvent& acked_gesture_event() const { |
| 56 return acked_gesture_event_; |
| 57 } |
| 58 |
| 59 private: |
| 60 void RecordAckCalled(InputEventAckState ack_result); |
| 61 |
| 62 InputRouter* input_router_; |
| 63 |
| 64 int ack_count_; |
| 65 bool unexpected_event_ack_called_; |
| 66 InputEventAckState ack_state_; |
| 67 NativeWebKeyboardEvent acked_key_event_; |
| 68 WebKit::WebMouseWheelEvent acked_wheel_event_; |
| 69 TouchEventWithLatencyInfo acked_touch_event_; |
| 70 WebKit::WebGestureEvent acked_gesture_event_; |
| 71 |
| 72 scoped_ptr<GestureEventWithLatencyInfo> touch_followup_event_; |
| 73 }; |
| 74 |
| 75 } // namespace content |
| 76 |
| 77 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ACK_HANDLER_H_ |
OLD | NEW |