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 CONTENT_SHELL_TEST_RUNNER_EVENT_SENDER_H_ |
6 #define COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ | 6 #define CONTENT_SHELL_TEST_RUNNER_EVENT_SENDER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <queue> | 11 #include <queue> |
12 #include <string> | 12 #include <string> |
13 #include <unordered_map> | 13 #include <unordered_map> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
(...skipping 21 matching lines...) Expand all Loading... |
38 | 38 |
39 namespace test_runner { | 39 namespace test_runner { |
40 | 40 |
41 class TestInterfaces; | 41 class TestInterfaces; |
42 class WebWidgetTestProxyBase; | 42 class WebWidgetTestProxyBase; |
43 class WebTestDelegate; | 43 class WebTestDelegate; |
44 | 44 |
45 // Key event location code introduced in DOM Level 3. | 45 // Key event location code introduced in DOM Level 3. |
46 // See also: http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents | 46 // See also: http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents |
47 enum KeyLocationCode { | 47 enum KeyLocationCode { |
48 DOMKeyLocationStandard = 0x00, | 48 DOMKeyLocationStandard = 0x00, |
49 DOMKeyLocationLeft = 0x01, | 49 DOMKeyLocationLeft = 0x01, |
50 DOMKeyLocationRight = 0x02, | 50 DOMKeyLocationRight = 0x02, |
51 DOMKeyLocationNumpad = 0x03 | 51 DOMKeyLocationNumpad = 0x03 |
52 }; | 52 }; |
53 | 53 |
54 class EventSender { | 54 class EventSender { |
55 public: | 55 public: |
56 explicit EventSender(WebWidgetTestProxyBase*); | 56 explicit EventSender(WebWidgetTestProxyBase*); |
57 virtual ~EventSender(); | 57 virtual ~EventSender(); |
58 | 58 |
59 void Reset(); | 59 void Reset(); |
60 void Install(blink::WebLocalFrame*); | 60 void Install(blink::WebLocalFrame*); |
61 | 61 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 int modifiers, | 173 int modifiers, |
174 KeyLocationCode location); | 174 KeyLocationCode location); |
175 | 175 |
176 double GetCurrentEventTimeSec(); | 176 double GetCurrentEventTimeSec(); |
177 | 177 |
178 void DoLeapForward(int milliseconds); | 178 void DoLeapForward(int milliseconds); |
179 | 179 |
180 uint32_t GetUniqueTouchEventId(gin::Arguments* args); | 180 uint32_t GetUniqueTouchEventId(gin::Arguments* args); |
181 void SendCurrentTouchEvent(blink::WebInputEvent::Type, gin::Arguments* args); | 181 void SendCurrentTouchEvent(blink::WebInputEvent::Type, gin::Arguments* args); |
182 | 182 |
183 void GestureEvent(blink::WebInputEvent::Type, | 183 void GestureEvent(blink::WebInputEvent::Type, gin::Arguments*); |
184 gin::Arguments*); | |
185 | 184 |
186 void UpdateClickCountForButton(blink::WebMouseEvent::Button); | 185 void UpdateClickCountForButton(blink::WebMouseEvent::Button); |
187 | 186 |
188 blink::WebMouseWheelEvent GetMouseWheelEvent(gin::Arguments* args, | 187 blink::WebMouseWheelEvent GetMouseWheelEvent(gin::Arguments* args, |
189 MouseScrollType scroll_type, | 188 MouseScrollType scroll_type, |
190 bool* send_gestures); | 189 bool* send_gestures); |
191 void InitPointerProperties(gin::Arguments* args, | 190 void InitPointerProperties(gin::Arguments* args, |
192 blink::WebPointerProperties* e, | 191 blink::WebPointerProperties* e, |
193 float* radius_x, | 192 float* radius_x, |
194 float* radius_y); | 193 float* radius_y); |
(...skipping 28 matching lines...) Expand all Loading... |
223 int wm_key_down() const { return wm_key_down_; } | 222 int wm_key_down() const { return wm_key_down_; } |
224 void set_wm_key_down(int key_down) { wm_key_down_ = key_down; } | 223 void set_wm_key_down(int key_down) { wm_key_down_ = key_down; } |
225 | 224 |
226 int wm_key_up() const { return wm_key_up_; } | 225 int wm_key_up() const { return wm_key_up_; } |
227 void set_wm_key_up(int key_up) { wm_key_up_ = key_up; } | 226 void set_wm_key_up(int key_up) { wm_key_up_ = key_up; } |
228 | 227 |
229 int wm_char() const { return wm_char_; } | 228 int wm_char() const { return wm_char_; } |
230 void set_wm_char(int wm_char) { wm_char_ = wm_char; } | 229 void set_wm_char(int wm_char) { wm_char_ = wm_char; } |
231 | 230 |
232 int wm_dead_char() const { return wm_dead_char_; } | 231 int wm_dead_char() const { return wm_dead_char_; } |
233 void set_wm_dead_char(int dead_char) { | 232 void set_wm_dead_char(int dead_char) { wm_dead_char_ = dead_char; } |
234 wm_dead_char_ = dead_char; | |
235 } | |
236 | 233 |
237 int wm_sys_key_down() const { return wm_sys_key_down_; } | 234 int wm_sys_key_down() const { return wm_sys_key_down_; } |
238 void set_wm_sys_key_down(int key_down) { wm_sys_key_down_ = key_down; } | 235 void set_wm_sys_key_down(int key_down) { wm_sys_key_down_ = key_down; } |
239 | 236 |
240 int wm_sys_key_up() const { return wm_sys_key_up_; } | 237 int wm_sys_key_up() const { return wm_sys_key_up_; } |
241 void set_wm_sys_key_up(int key_up) { wm_sys_key_up_ = key_up; } | 238 void set_wm_sys_key_up(int key_up) { wm_sys_key_up_ = key_up; } |
242 | 239 |
243 int wm_sys_char() const { return wm_sys_char_; } | 240 int wm_sys_char() const { return wm_sys_char_; } |
244 void set_wm_sys_char(int sys_char) { wm_sys_char_ = sys_char; } | 241 void set_wm_sys_char(int sys_char) { wm_sys_char_ = sys_char; } |
245 | 242 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 275 |
279 std::unique_ptr<blink::WebContextMenuData> last_context_menu_data_; | 276 std::unique_ptr<blink::WebContextMenuData> last_context_menu_data_; |
280 | 277 |
281 blink::WebDragData current_drag_data_; | 278 blink::WebDragData current_drag_data_; |
282 | 279 |
283 // Location of the touch point that initiated a gesture. | 280 // Location of the touch point that initiated a gesture. |
284 blink::WebPoint current_gesture_location_; | 281 blink::WebPoint current_gesture_location_; |
285 | 282 |
286 // Mouse-like pointer properties. | 283 // Mouse-like pointer properties. |
287 struct PointerState { | 284 struct PointerState { |
288 // Last pressed button (Left/Right/Middle or None). | 285 // Last pressed button (Left/Right/Middle or None). |
289 blink::WebMouseEvent::Button pressed_button_; | 286 blink::WebMouseEvent::Button pressed_button_; |
290 | 287 |
291 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to | 288 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to |
292 // currently pressed buttons of the pointer (e.g. pen or mouse). | 289 // currently pressed buttons of the pointer (e.g. pen or mouse). |
293 int current_buttons_; | 290 int current_buttons_; |
294 | 291 |
295 // Location of last mouseMoveTo event of this pointer. | 292 // Location of last mouseMoveTo event of this pointer. |
296 blink::WebPoint last_pos_; | 293 blink::WebPoint last_pos_; |
297 | 294 |
298 int modifiers_; | 295 int modifiers_; |
299 | 296 |
300 PointerState() | 297 PointerState() |
301 : pressed_button_(blink::WebMouseEvent::Button::NoButton) | 298 : pressed_button_(blink::WebMouseEvent::Button::NoButton), |
302 , current_buttons_(0) | 299 current_buttons_(0), |
303 , last_pos_(blink::WebPoint(0, 0)) | 300 last_pos_(blink::WebPoint(0, 0)), |
304 , modifiers_(0) { } | 301 modifiers_(0) {} |
305 }; | 302 }; |
306 typedef std::unordered_map<int, PointerState> PointerStateMap; | 303 typedef std::unordered_map<int, PointerState> PointerStateMap; |
307 PointerStateMap current_pointer_state_; | 304 PointerStateMap current_pointer_state_; |
308 | 305 |
309 bool replaying_saved_events_; | 306 bool replaying_saved_events_; |
310 | 307 |
311 std::deque<SavedEvent> mouse_event_queue_; | 308 std::deque<SavedEvent> mouse_event_queue_; |
312 | 309 |
313 blink::WebDragOperationsMask current_drag_effects_allowed_; | 310 blink::WebDragOperationsMask current_drag_effects_allowed_; |
314 | 311 |
(...skipping 12 matching lines...) Expand all Loading... |
327 // Timestamp (in seconds) of the last event that was dispatched | 324 // Timestamp (in seconds) of the last event that was dispatched |
328 double last_event_timestamp_; | 325 double last_event_timestamp_; |
329 | 326 |
330 base::WeakPtrFactory<EventSender> weak_factory_; | 327 base::WeakPtrFactory<EventSender> weak_factory_; |
331 | 328 |
332 DISALLOW_COPY_AND_ASSIGN(EventSender); | 329 DISALLOW_COPY_AND_ASSIGN(EventSender); |
333 }; | 330 }; |
334 | 331 |
335 } // namespace test_runner | 332 } // namespace test_runner |
336 | 333 |
337 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ | 334 #endif // CONTENT_SHELL_TEST_RUNNER_EVENT_SENDER_H_ |
OLD | NEW |