Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / browser / renderer_host / input / mock_input_ack_handler.h
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   ~MockInputAckHandler() override;
19
20   // InputAckHandler
21   void OnKeyboardEventAck(const NativeWebKeyboardEvent& event,
22                           InputEventAckState ack_result) override;
23   void OnWheelEventAck(const MouseWheelEventWithLatencyInfo& event,
24                        InputEventAckState ack_result) override;
25   void OnTouchEventAck(const TouchEventWithLatencyInfo& event,
26                        InputEventAckState ack_result) override;
27   void OnGestureEventAck(const GestureEventWithLatencyInfo& event,
28                          InputEventAckState ack_result) override;
29   void OnUnexpectedEventAck(UnexpectedEventAckType type) override;
30
31   size_t GetAndResetAckCount();
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     gesture_followup_event_ = event.Pass();
39   }
40
41   void set_followup_touch_event(scoped_ptr<TouchEventWithLatencyInfo> event) {
42     touch_followup_event_ = event.Pass();
43   }
44
45   bool unexpected_event_ack_called() const {
46     return unexpected_event_ack_called_;
47   }
48   InputEventAckState ack_state() const { return ack_state_; }
49
50   blink::WebInputEvent::Type ack_event_type() const { return ack_event_type_; }
51
52   const NativeWebKeyboardEvent& acked_keyboard_event() const {
53     return acked_key_event_;
54   }
55   const blink::WebMouseWheelEvent& acked_wheel_event() const {
56     return acked_wheel_event_;
57   }
58   const TouchEventWithLatencyInfo& acked_touch_event() const {
59     return acked_touch_event_;
60   }
61   const blink::WebGestureEvent& acked_gesture_event() const {
62     return acked_gesture_event_;
63   }
64
65  private:
66   void RecordAckCalled(blink::WebInputEvent::Type eventType,
67                        InputEventAckState ack_result);
68
69   InputRouter* input_router_;
70
71   size_t ack_count_;
72   bool unexpected_event_ack_called_;
73   blink::WebInputEvent::Type ack_event_type_;
74   InputEventAckState ack_state_;
75   NativeWebKeyboardEvent acked_key_event_;
76   blink::WebMouseWheelEvent acked_wheel_event_;
77   TouchEventWithLatencyInfo acked_touch_event_;
78   blink::WebGestureEvent acked_gesture_event_;
79
80   scoped_ptr<GestureEventWithLatencyInfo> gesture_followup_event_;
81   scoped_ptr<TouchEventWithLatencyInfo> touch_followup_event_;
82 };
83
84 }  // namespace content
85
86 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ACK_HANDLER_H_