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 CONTENT_SHELL_RENDERER_TEST_RUNNER_EVENT_SENDER_H_ | 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_EVENT_SENDER_H_ |
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_EVENT_SENDER_H_ | 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_EVENT_SENDER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 12 matching lines...) Expand all Loading... |
23 namespace blink { | 23 namespace blink { |
24 class WebFrame; | 24 class WebFrame; |
25 class WebView; | 25 class WebView; |
26 struct WebContextMenuData; | 26 struct WebContextMenuData; |
27 } | 27 } |
28 | 28 |
29 namespace gin { | 29 namespace gin { |
30 class Arguments; | 30 class Arguments; |
31 } | 31 } |
32 | 32 |
33 namespace WebTestRunner { | |
34 class TestInterfaces; | |
35 class WebTestDelegate; | |
36 } | |
37 | |
38 namespace content { | 33 namespace content { |
39 | 34 |
| 35 class TestInterfaces; |
| 36 class WebTestDelegate; |
| 37 |
40 // Key event location code introduced in DOM Level 3. | 38 // Key event location code introduced in DOM Level 3. |
41 // See also: http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents | 39 // See also: http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents |
42 enum KeyLocationCode { | 40 enum KeyLocationCode { |
43 DOMKeyLocationStandard = 0x00, | 41 DOMKeyLocationStandard = 0x00, |
44 DOMKeyLocationLeft = 0x01, | 42 DOMKeyLocationLeft = 0x01, |
45 DOMKeyLocationRight = 0x02, | 43 DOMKeyLocationRight = 0x02, |
46 DOMKeyLocationNumpad = 0x03 | 44 DOMKeyLocationNumpad = 0x03 |
47 }; | 45 }; |
48 | 46 |
49 class EventSender : public base::SupportsWeakPtr<EventSender> { | 47 class EventSender : public base::SupportsWeakPtr<EventSender> { |
50 public: | 48 public: |
51 explicit EventSender(WebTestRunner::TestInterfaces*); | 49 explicit EventSender(TestInterfaces*); |
52 virtual ~EventSender(); | 50 virtual ~EventSender(); |
53 | 51 |
54 void Reset(); | 52 void Reset(); |
55 void Install(blink::WebFrame*); | 53 void Install(blink::WebFrame*); |
56 void SetDelegate(WebTestRunner::WebTestDelegate*); | 54 void SetDelegate(WebTestDelegate*); |
57 void SetWebView(blink::WebView*); | 55 void SetWebView(blink::WebView*); |
58 | 56 |
59 void SetContextMenuData(const blink::WebContextMenuData&); | 57 void SetContextMenuData(const blink::WebContextMenuData&); |
60 | 58 |
61 void DoDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask); | 59 void DoDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask); |
62 | 60 |
63 void MouseDown(int button_number, int modifiers); | 61 void MouseDown(int button_number, int modifiers); |
64 void MouseUp(int button_number, int modifiers); | 62 void MouseUp(int button_number, int modifiers); |
65 void KeyDown(const std::string& code_str, | 63 void KeyDown(const std::string& code_str, |
66 int modifiers, | 64 int modifiers, |
67 KeyLocationCode location); | 65 KeyLocationCode location); |
68 | 66 |
69 WebTestRunner::WebTaskList* taskList() { return &task_list_; } | 67 WebTaskList* taskList() { return &task_list_; } |
70 | 68 |
71 private: | 69 private: |
72 friend class EventSenderBindings; | 70 friend class EventSenderBindings; |
73 | 71 |
74 struct SavedEvent { | 72 struct SavedEvent { |
75 enum SavedEventType { | 73 enum SavedEventType { |
76 TYPE_UNSPECIFIED, | 74 TYPE_UNSPECIFIED, |
77 TYPE_MOUSE_UP, | 75 TYPE_MOUSE_UP, |
78 TYPE_MOUSE_MOVE, | 76 TYPE_MOUSE_MOVE, |
79 TYPE_LEAP_FORWARD | 77 TYPE_LEAP_FORWARD |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 int wm_key_down_; | 212 int wm_key_down_; |
215 int wm_key_up_; | 213 int wm_key_up_; |
216 int wm_char_; | 214 int wm_char_; |
217 int wm_dead_char_; | 215 int wm_dead_char_; |
218 int wm_sys_key_down_; | 216 int wm_sys_key_down_; |
219 int wm_sys_key_up_; | 217 int wm_sys_key_up_; |
220 int wm_sys_char_; | 218 int wm_sys_char_; |
221 int wm_sys_dead_char_; | 219 int wm_sys_dead_char_; |
222 #endif | 220 #endif |
223 | 221 |
224 WebTestRunner::WebTaskList task_list_; | 222 WebTaskList task_list_; |
225 | 223 |
226 WebTestRunner::TestInterfaces* interfaces_; | 224 TestInterfaces* interfaces_; |
227 WebTestRunner::WebTestDelegate* delegate_; | 225 WebTestDelegate* delegate_; |
228 blink::WebView* view_; | 226 blink::WebView* view_; |
229 | 227 |
230 bool force_layout_on_events_; | 228 bool force_layout_on_events_; |
231 | 229 |
232 // When set to true (the default value), we batch mouse move and mouse up | 230 // When set to true (the default value), we batch mouse move and mouse up |
233 // events so we can simulate drag & drop. | 231 // events so we can simulate drag & drop. |
234 bool is_drag_mode_; | 232 bool is_drag_mode_; |
235 | 233 |
236 int touch_modifiers_; | 234 int touch_modifiers_; |
237 bool touch_cancelable_; | 235 bool touch_cancelable_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 int click_count_; | 268 int click_count_; |
271 | 269 |
272 base::WeakPtrFactory<EventSender> weak_factory_; | 270 base::WeakPtrFactory<EventSender> weak_factory_; |
273 | 271 |
274 DISALLOW_COPY_AND_ASSIGN(EventSender); | 272 DISALLOW_COPY_AND_ASSIGN(EventSender); |
275 }; | 273 }; |
276 | 274 |
277 } // namespace content | 275 } // namespace content |
278 | 276 |
279 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_EVENT_SENDER_H_ | 277 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_EVENT_SENDER_H_ |
OLD | NEW |