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 <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" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "third_party/WebKit/public/platform/WebDragData.h" | 19 #include "third_party/WebKit/public/platform/WebDragData.h" |
20 #include "third_party/WebKit/public/platform/WebDragOperation.h" | 20 #include "third_party/WebKit/public/platform/WebDragOperation.h" |
21 #include "third_party/WebKit/public/platform/WebInputEventResult.h" | 21 #include "third_party/WebKit/public/platform/WebInputEventResult.h" |
22 #include "third_party/WebKit/public/platform/WebPoint.h" | 22 #include "third_party/WebKit/public/platform/WebPoint.h" |
23 #include "third_party/WebKit/public/web/WebInputEvent.h" | 23 #include "third_party/WebKit/public/web/WebInputEvent.h" |
24 #include "third_party/WebKit/public/web/WebTouchPoint.h" | 24 #include "third_party/WebKit/public/web/WebTouchPoint.h" |
25 | 25 |
26 namespace blink { | 26 namespace blink { |
27 class WebLocalFrame; | 27 class WebLocalFrame; |
28 class WebView; | 28 class WebView; |
| 29 class WebWidget; |
29 struct WebContextMenuData; | 30 struct WebContextMenuData; |
30 } | 31 } |
31 | 32 |
32 namespace gin { | 33 namespace gin { |
33 class Arguments; | 34 class Arguments; |
34 } | 35 } |
35 | 36 |
36 namespace test_runner { | 37 namespace test_runner { |
37 | 38 |
38 class TestInterfaces; | 39 class TestInterfaces; |
| 40 class WebFrameTestProxyBase; |
39 class WebTestDelegate; | 41 class WebTestDelegate; |
40 class WebTestProxyBase; | |
41 | 42 |
42 // Key event location code introduced in DOM Level 3. | 43 // Key event location code introduced in DOM Level 3. |
43 // See also: http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents | 44 // See also: http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents |
44 enum KeyLocationCode { | 45 enum KeyLocationCode { |
45 DOMKeyLocationStandard = 0x00, | 46 DOMKeyLocationStandard = 0x00, |
46 DOMKeyLocationLeft = 0x01, | 47 DOMKeyLocationLeft = 0x01, |
47 DOMKeyLocationRight = 0x02, | 48 DOMKeyLocationRight = 0x02, |
48 DOMKeyLocationNumpad = 0x03 | 49 DOMKeyLocationNumpad = 0x03 |
49 }; | 50 }; |
50 | 51 |
51 class EventSender { | 52 class EventSender { |
52 public: | 53 public: |
53 explicit EventSender(WebTestProxyBase*); | 54 explicit EventSender(WebFrameTestProxyBase*); |
54 virtual ~EventSender(); | 55 virtual ~EventSender(); |
55 | 56 |
56 void Reset(); | 57 void Reset(); |
57 void Install(blink::WebLocalFrame*); | 58 void Install(blink::WebLocalFrame*); |
58 | 59 |
59 void SetContextMenuData(const blink::WebContextMenuData&); | 60 void SetContextMenuData(const blink::WebContextMenuData&); |
60 | 61 |
61 void DoDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask); | 62 void DoDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask); |
62 | 63 |
63 void set_send_wheel_gestures(bool send_wheel_gestures) { | 64 void set_send_wheel_gestures(bool send_wheel_gestures) { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 int wm_key_down_; | 243 int wm_key_down_; |
243 int wm_key_up_; | 244 int wm_key_up_; |
244 int wm_char_; | 245 int wm_char_; |
245 int wm_dead_char_; | 246 int wm_dead_char_; |
246 int wm_sys_key_down_; | 247 int wm_sys_key_down_; |
247 int wm_sys_key_up_; | 248 int wm_sys_key_up_; |
248 int wm_sys_char_; | 249 int wm_sys_char_; |
249 int wm_sys_dead_char_; | 250 int wm_sys_dead_char_; |
250 #endif | 251 #endif |
251 | 252 |
252 WebTestProxyBase* web_test_proxy_base_; | 253 WebFrameTestProxyBase* web_frame_test_proxy_base_; |
253 TestInterfaces* interfaces(); | 254 TestInterfaces* interfaces(); |
254 WebTestDelegate* delegate(); | 255 WebTestDelegate* delegate(); |
255 const blink::WebView* view() const; | 256 const blink::WebView* view() const; |
256 blink::WebView* view(); | 257 blink::WebView* view(); |
| 258 blink::WebWidget* widget(); |
257 | 259 |
258 bool send_wheel_gestures_; | 260 bool send_wheel_gestures_; |
259 bool force_layout_on_events_; | 261 bool force_layout_on_events_; |
260 | 262 |
261 // When set to true (the default value), we batch mouse move and mouse up | 263 // When set to true (the default value), we batch mouse move and mouse up |
262 // events so we can simulate drag & drop. | 264 // events so we can simulate drag & drop. |
263 bool is_drag_mode_; | 265 bool is_drag_mode_; |
264 | 266 |
265 int touch_modifiers_; | 267 int touch_modifiers_; |
266 bool touch_cancelable_; | 268 bool touch_cancelable_; |
267 std::vector<blink::WebTouchPoint> touch_points_; | 269 std::vector<blink::WebTouchPoint> touch_points_; |
268 | 270 |
269 std::unique_ptr<blink::WebContextMenuData> last_context_menu_data_; | 271 std::unique_ptr<blink::WebContextMenuData> last_context_menu_data_; |
270 | 272 |
271 blink::WebDragData current_drag_data_; | 273 blink::WebDragData current_drag_data_; |
272 | 274 |
273 // Location of the touch point that initiated a gesture. | 275 // Location of the touch point that initiated a gesture. |
274 blink::WebPoint current_gesture_location_; | 276 blink::WebPoint current_gesture_location_; |
275 | 277 |
276 | |
277 // Mouse-like pointer properties. | 278 // Mouse-like pointer properties. |
278 struct PointerState { | 279 struct PointerState { |
279 // Last pressed button (Left/Right/Middle or None). | 280 // Last pressed button (Left/Right/Middle or None). |
280 blink::WebMouseEvent::Button pressed_button_; | 281 blink::WebMouseEvent::Button pressed_button_; |
281 | 282 |
282 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to | 283 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to |
283 // currently pressed buttons of the pointer (e.g. pen or mouse). | 284 // currently pressed buttons of the pointer (e.g. pen or mouse). |
284 int current_buttons_; | 285 int current_buttons_; |
285 | 286 |
286 // Location of last mouseMoveTo event of this pointer. | 287 // Location of last mouseMoveTo event of this pointer. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 double last_event_timestamp_; | 320 double last_event_timestamp_; |
320 | 321 |
321 base::WeakPtrFactory<EventSender> weak_factory_; | 322 base::WeakPtrFactory<EventSender> weak_factory_; |
322 | 323 |
323 DISALLOW_COPY_AND_ASSIGN(EventSender); | 324 DISALLOW_COPY_AND_ASSIGN(EventSender); |
324 }; | 325 }; |
325 | 326 |
326 } // namespace test_runner | 327 } // namespace test_runner |
327 | 328 |
328 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ | 329 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ |
OLD | NEW |