blob: 4753a151350d15f4e2be5b98140c3be388ab0768 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ACK_HANDLER_H_
#define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ACK_HANDLER_H_
#include <stddef.h>
#include <utility>
#include "base/memory/scoped_ptr.h"
#include "content/browser/renderer_host/input/input_ack_handler.h"
namespace content {
class InputRouter;
class MockInputAckHandler : public InputAckHandler {
public:
MockInputAckHandler();
~MockInputAckHandler() override;
// InputAckHandler
void OnKeyboardEventAck(const NativeWebKeyboardEventWithLatencyInfo& event,
InputEventAckState ack_result) override;
void OnMouseEventAck(const MouseEventWithLatencyInfo& event,
InputEventAckState ack_result) override;
void OnWheelEventAck(const MouseWheelEventWithLatencyInfo& event,
InputEventAckState ack_result) override;
void OnTouchEventAck(const TouchEventWithLatencyInfo& event,
InputEventAckState ack_result) override;
void OnGestureEventAck(const GestureEventWithLatencyInfo& event,
InputEventAckState ack_result) override;
void OnUnexpectedEventAck(UnexpectedEventAckType type) override;
size_t GetAndResetAckCount();
void set_input_router(InputRouter* input_router) {
input_router_ = input_router;
}
void set_followup_touch_event(scoped_ptr<GestureEventWithLatencyInfo> event) {
gesture_followup_event_ = std::move(event);
}
void set_followup_touch_event(scoped_ptr<TouchEventWithLatencyInfo> event) {
touch_followup_event_ = std::move(event);
}
bool unexpected_event_ack_called() const {
return unexpected_event_ack_called_;
}
InputEventAckState ack_state() const { return ack_state_; }
blink::WebInputEvent::Type ack_event_type() const { return ack_event_type_; }
const NativeWebKeyboardEvent& acked_keyboard_event() const {
return acked_key_event_;
}
const blink::WebMouseWheelEvent& acked_wheel_event() const {
return acked_wheel_event_;
}
const TouchEventWithLatencyInfo& acked_touch_event() const {
return acked_touch_event_;
}
const blink::WebGestureEvent& acked_gesture_event() const {
return acked_gesture_event_;
}
private:
void RecordAckCalled(blink::WebInputEvent::Type eventType,
InputEventAckState ack_result);
InputRouter* input_router_;
size_t ack_count_;
bool unexpected_event_ack_called_;
blink::WebInputEvent::Type ack_event_type_;
InputEventAckState ack_state_;
NativeWebKeyboardEvent acked_key_event_;
blink::WebMouseWheelEvent acked_wheel_event_;
TouchEventWithLatencyInfo acked_touch_event_;
blink::WebGestureEvent acked_gesture_event_;
blink::WebMouseEvent acked_mouse_event_;
scoped_ptr<GestureEventWithLatencyInfo> gesture_followup_event_;
scoped_ptr<TouchEventWithLatencyInfo> touch_followup_event_;
};
} // namespace content
#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ACK_HANDLER_H_
|