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.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ACK_HANDLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ACK_HANDLER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/renderer_host/input/input_ack_handler.h"
15 class MockInputAckHandler
: public InputAckHandler
{
17 MockInputAckHandler();
18 ~MockInputAckHandler() override
;
21 void OnKeyboardEventAck(const NativeWebKeyboardEventWithLatencyInfo
& event
,
22 InputEventAckState ack_result
) override
;
23 void OnMouseEventAck(const MouseEventWithLatencyInfo
& event
,
24 InputEventAckState ack_result
) override
;
25 void OnWheelEventAck(const MouseWheelEventWithLatencyInfo
& event
,
26 InputEventAckState ack_result
) override
;
27 void OnTouchEventAck(const TouchEventWithLatencyInfo
& event
,
28 InputEventAckState ack_result
) override
;
29 void OnGestureEventAck(const GestureEventWithLatencyInfo
& event
,
30 InputEventAckState ack_result
) override
;
31 void OnUnexpectedEventAck(UnexpectedEventAckType type
) override
;
33 size_t GetAndResetAckCount();
35 void set_input_router(InputRouter
* input_router
) {
36 input_router_
= input_router
;
39 void set_followup_touch_event(scoped_ptr
<GestureEventWithLatencyInfo
> event
) {
40 gesture_followup_event_
= event
.Pass();
43 void set_followup_touch_event(scoped_ptr
<TouchEventWithLatencyInfo
> event
) {
44 touch_followup_event_
= event
.Pass();
47 bool unexpected_event_ack_called() const {
48 return unexpected_event_ack_called_
;
50 InputEventAckState
ack_state() const { return ack_state_
; }
52 blink::WebInputEvent::Type
ack_event_type() const { return ack_event_type_
; }
54 const NativeWebKeyboardEvent
& acked_keyboard_event() const {
55 return acked_key_event_
;
57 const blink::WebMouseWheelEvent
& acked_wheel_event() const {
58 return acked_wheel_event_
;
60 const TouchEventWithLatencyInfo
& acked_touch_event() const {
61 return acked_touch_event_
;
63 const blink::WebGestureEvent
& acked_gesture_event() const {
64 return acked_gesture_event_
;
68 void RecordAckCalled(blink::WebInputEvent::Type eventType
,
69 InputEventAckState ack_result
);
71 InputRouter
* input_router_
;
74 bool unexpected_event_ack_called_
;
75 blink::WebInputEvent::Type ack_event_type_
;
76 InputEventAckState ack_state_
;
77 NativeWebKeyboardEvent acked_key_event_
;
78 blink::WebMouseWheelEvent acked_wheel_event_
;
79 TouchEventWithLatencyInfo acked_touch_event_
;
80 blink::WebGestureEvent acked_gesture_event_
;
81 blink::WebMouseEvent acked_mouse_event_
;
83 scoped_ptr
<GestureEventWithLatencyInfo
> gesture_followup_event_
;
84 scoped_ptr
<TouchEventWithLatencyInfo
> touch_followup_event_
;
87 } // namespace content
89 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ACK_HANDLER_H_