OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ |
6 #define COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ | 6 #define COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 void MouseDown(int button_number, int modifiers); | 64 void MouseDown(int button_number, int modifiers); |
65 void MouseUp(int button_number, int modifiers); | 65 void MouseUp(int button_number, int modifiers); |
66 void SetMouseButtonState(int button_number, int modifiers); | 66 void SetMouseButtonState(int button_number, int modifiers); |
67 | 67 |
68 void KeyDown(const std::string& code_str, | 68 void KeyDown(const std::string& code_str, |
69 int modifiers, | 69 int modifiers, |
70 KeyLocationCode location); | 70 KeyLocationCode location); |
71 | 71 |
72 WebTaskList* mutable_task_list() { return &task_list_; } | 72 WebTaskList* mutable_task_list() { return &task_list_; } |
73 | 73 |
| 74 void set_send_wheel_gestures(bool send_wheel_gestures) { |
| 75 send_wheel_gestures_ = send_wheel_gestures; |
| 76 } |
| 77 |
74 private: | 78 private: |
75 friend class EventSenderBindings; | 79 friend class EventSenderBindings; |
76 | 80 |
77 struct SavedEvent { | 81 struct SavedEvent { |
78 enum SavedEventType { | 82 enum SavedEventType { |
79 TYPE_UNSPECIFIED, | 83 TYPE_UNSPECIFIED, |
80 TYPE_MOUSE_UP, | 84 TYPE_MOUSE_UP, |
81 TYPE_MOUSE_MOVE, | 85 TYPE_MOUSE_MOVE, |
82 TYPE_LEAP_FORWARD | 86 TYPE_LEAP_FORWARD |
83 }; | 87 }; |
84 | 88 |
85 SavedEvent(); | 89 SavedEvent(); |
86 | 90 |
87 SavedEventType type; | 91 SavedEventType type; |
88 blink::WebMouseEvent::Button button_type; // For MouseUp. | 92 blink::WebMouseEvent::Button button_type; // For MouseUp. |
89 blink::WebPoint pos; // For MouseMove. | 93 blink::WebPoint pos; // For MouseMove. |
90 int milliseconds; // For LeapForward. | 94 int milliseconds; // For LeapForward. |
91 int modifiers; | 95 int modifiers; |
92 }; | 96 }; |
93 | 97 |
| 98 enum class MouseScrollType { PIXEL, TICK }; |
| 99 |
94 void EnableDOMUIEventLogging(); | 100 void EnableDOMUIEventLogging(); |
95 void FireKeyboardEventsToElement(); | 101 void FireKeyboardEventsToElement(); |
96 void ClearKillRing(); | 102 void ClearKillRing(); |
97 | 103 |
98 std::vector<std::string> ContextClick(); | 104 std::vector<std::string> ContextClick(); |
99 | 105 |
100 void TextZoomIn(); | 106 void TextZoomIn(); |
101 void TextZoomOut(); | 107 void TextZoomOut(); |
102 | 108 |
103 void ZoomPageIn(); | 109 void ZoomPageIn(); |
(...skipping 24 matching lines...) Expand all Loading... |
128 void TouchMoveCausingScrollIfUncanceled(); | 134 void TouchMoveCausingScrollIfUncanceled(); |
129 void TouchCancel(); | 135 void TouchCancel(); |
130 void TouchEnd(); | 136 void TouchEnd(); |
131 | 137 |
132 void LeapForward(int milliseconds); | 138 void LeapForward(int milliseconds); |
133 | 139 |
134 void BeginDragWithFiles(const std::vector<std::string>& files); | 140 void BeginDragWithFiles(const std::vector<std::string>& files); |
135 | 141 |
136 void AddTouchPoint(float x, float y, gin::Arguments* args); | 142 void AddTouchPoint(float x, float y, gin::Arguments* args); |
137 | 143 |
138 void MouseDragBegin(); | |
139 void MouseDragEnd(); | |
140 | |
141 void GestureScrollBegin(gin::Arguments* args); | 144 void GestureScrollBegin(gin::Arguments* args); |
142 void GestureScrollEnd(gin::Arguments* args); | 145 void GestureScrollEnd(gin::Arguments* args); |
143 void GestureScrollUpdate(gin::Arguments* args); | 146 void GestureScrollUpdate(gin::Arguments* args); |
144 void GesturePinchBegin(gin::Arguments* args); | 147 void GesturePinchBegin(gin::Arguments* args); |
145 void GesturePinchEnd(gin::Arguments* args); | 148 void GesturePinchEnd(gin::Arguments* args); |
146 void GesturePinchUpdate(gin::Arguments* args); | 149 void GesturePinchUpdate(gin::Arguments* args); |
147 void GestureTap(gin::Arguments* args); | 150 void GestureTap(gin::Arguments* args); |
148 void GestureTapDown(gin::Arguments* args); | 151 void GestureTapDown(gin::Arguments* args); |
149 void GestureShowPress(gin::Arguments* args); | 152 void GestureShowPress(gin::Arguments* args); |
150 void GestureTapCancel(gin::Arguments* args); | 153 void GestureTapCancel(gin::Arguments* args); |
151 void GestureLongPress(gin::Arguments* args); | 154 void GestureLongPress(gin::Arguments* args); |
152 void GestureLongTap(gin::Arguments* args); | 155 void GestureLongTap(gin::Arguments* args); |
153 void GestureTwoFingerTap(gin::Arguments* args); | 156 void GestureTwoFingerTap(gin::Arguments* args); |
154 | 157 |
155 void ContinuousMouseScrollBy(gin::Arguments* args); | 158 void MouseScrollBy(gin::Arguments* args, MouseScrollType scroll_type); |
156 void MouseMoveTo(gin::Arguments* args); | 159 void MouseMoveTo(gin::Arguments* args); |
157 void MouseLeave(); | 160 void MouseLeave(); |
158 void TrackpadScrollBegin(); | |
159 void TrackpadScroll(gin::Arguments* args); | |
160 void TrackpadScrollEnd(); | |
161 void MouseScrollBy(gin::Arguments* args); | |
162 void ScheduleAsynchronousClick(int button_number, int modifiers); | 161 void ScheduleAsynchronousClick(int button_number, int modifiers); |
163 void ScheduleAsynchronousKeyDown(const std::string& code_str, | 162 void ScheduleAsynchronousKeyDown(const std::string& code_str, |
164 int modifiers, | 163 int modifiers, |
165 KeyLocationCode location); | 164 KeyLocationCode location); |
166 | 165 |
167 double GetCurrentEventTimeSec(); | 166 double GetCurrentEventTimeSec(); |
168 | 167 |
169 void DoLeapForward(int milliseconds); | 168 void DoLeapForward(int milliseconds); |
170 | 169 |
171 void SendCurrentTouchEvent(blink::WebInputEvent::Type, bool); | 170 void SendCurrentTouchEvent(blink::WebInputEvent::Type, bool); |
172 | 171 |
173 void GestureEvent(blink::WebInputEvent::Type, | 172 void GestureEvent(blink::WebInputEvent::Type, |
174 gin::Arguments*); | 173 gin::Arguments*); |
175 | 174 |
176 void UpdateClickCountForButton(blink::WebMouseEvent::Button); | 175 void UpdateClickCountForButton(blink::WebMouseEvent::Button); |
177 | 176 |
178 void InitMouseWheelEvent(gin::Arguments* args, | 177 void InitMouseWheelEvent(gin::Arguments* args, |
179 bool continuous, | 178 MouseScrollType scroll_type, |
180 blink::WebMouseWheelEvent* event); | 179 blink::WebMouseWheelEvent* event, |
| 180 bool* send_gestures); |
181 void InitPointerProperties(gin::Arguments* args, | 181 void InitPointerProperties(gin::Arguments* args, |
182 blink::WebPointerProperties* e, | 182 blink::WebPointerProperties* e, |
183 float* radius_x, | 183 float* radius_x, |
184 float* radius_y); | 184 float* radius_y); |
185 | 185 |
186 void FinishDragAndDrop(const blink::WebMouseEvent&, blink::WebDragOperation); | 186 void FinishDragAndDrop(const blink::WebMouseEvent&, blink::WebDragOperation); |
187 | 187 |
188 void DoMouseUp(const blink::WebMouseEvent&); | 188 void DoMouseUp(const blink::WebMouseEvent&); |
189 void DoMouseMove(const blink::WebMouseEvent&); | 189 void DoMouseMove(const blink::WebMouseEvent&); |
190 void ReplaySavedEvents(); | 190 void ReplaySavedEvents(); |
191 blink::WebInputEventResult HandleInputEventOnViewOrPopup( | 191 blink::WebInputEventResult HandleInputEventOnViewOrPopup( |
192 const blink::WebInputEvent&); | 192 const blink::WebInputEvent&); |
193 | 193 |
| 194 void SendGesturesForMouseWheelEvent( |
| 195 const blink::WebMouseWheelEvent wheel_event); |
| 196 |
194 double last_event_timestamp() { return last_event_timestamp_; } | 197 double last_event_timestamp() { return last_event_timestamp_; } |
195 | 198 |
196 bool force_layout_on_events() const { return force_layout_on_events_; } | 199 bool force_layout_on_events() const { return force_layout_on_events_; } |
197 void set_force_layout_on_events(bool force) { | 200 void set_force_layout_on_events(bool force) { |
198 force_layout_on_events_ = force; | 201 force_layout_on_events_ = force; |
199 } | 202 } |
200 | 203 |
201 bool is_drag_mode() const { return is_drag_mode_; } | 204 bool is_drag_mode() const { return is_drag_mode_; } |
202 void set_is_drag_mode(bool drag_mode) { is_drag_mode_ = drag_mode; } | 205 void set_is_drag_mode(bool drag_mode) { is_drag_mode_ = drag_mode; } |
203 | 206 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 int wm_sys_char_; | 242 int wm_sys_char_; |
240 int wm_sys_dead_char_; | 243 int wm_sys_dead_char_; |
241 #endif | 244 #endif |
242 | 245 |
243 WebTaskList task_list_; | 246 WebTaskList task_list_; |
244 | 247 |
245 TestInterfaces* interfaces_; | 248 TestInterfaces* interfaces_; |
246 WebTestDelegate* delegate_; | 249 WebTestDelegate* delegate_; |
247 blink::WebView* view_; | 250 blink::WebView* view_; |
248 | 251 |
| 252 bool send_wheel_gestures_; |
249 bool force_layout_on_events_; | 253 bool force_layout_on_events_; |
250 | 254 |
251 // When set to true (the default value), we batch mouse move and mouse up | 255 // When set to true (the default value), we batch mouse move and mouse up |
252 // events so we can simulate drag & drop. | 256 // events so we can simulate drag & drop. |
253 bool is_drag_mode_; | 257 bool is_drag_mode_; |
254 | 258 |
255 int touch_modifiers_; | 259 int touch_modifiers_; |
256 bool touch_cancelable_; | 260 bool touch_cancelable_; |
257 std::vector<blink::WebTouchPoint> touch_points_; | 261 std::vector<blink::WebTouchPoint> touch_points_; |
258 | 262 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 double last_event_timestamp_; | 301 double last_event_timestamp_; |
298 | 302 |
299 base::WeakPtrFactory<EventSender> weak_factory_; | 303 base::WeakPtrFactory<EventSender> weak_factory_; |
300 | 304 |
301 DISALLOW_COPY_AND_ASSIGN(EventSender); | 305 DISALLOW_COPY_AND_ASSIGN(EventSender); |
302 }; | 306 }; |
303 | 307 |
304 } // namespace test_runner | 308 } // namespace test_runner |
305 | 309 |
306 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ | 310 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ |
OLD | NEW |