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> |
11 #include <string> | 11 #include <string> |
| 12 #include <unordered_map> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
18 #include "components/test_runner/web_task.h" | 19 #include "components/test_runner/web_task.h" |
19 #include "third_party/WebKit/public/platform/WebDragData.h" | 20 #include "third_party/WebKit/public/platform/WebDragData.h" |
20 #include "third_party/WebKit/public/platform/WebInputEventResult.h" | 21 #include "third_party/WebKit/public/platform/WebInputEventResult.h" |
21 #include "third_party/WebKit/public/platform/WebPoint.h" | 22 #include "third_party/WebKit/public/platform/WebPoint.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 55 |
55 void Reset(); | 56 void Reset(); |
56 void Install(blink::WebFrame*); | 57 void Install(blink::WebFrame*); |
57 void SetDelegate(WebTestDelegate*); | 58 void SetDelegate(WebTestDelegate*); |
58 void SetWebView(blink::WebView*); | 59 void SetWebView(blink::WebView*); |
59 | 60 |
60 void SetContextMenuData(const blink::WebContextMenuData&); | 61 void SetContextMenuData(const blink::WebContextMenuData&); |
61 | 62 |
62 void DoDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask); | 63 void DoDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask); |
63 | 64 |
64 void MouseDown(int button_number, int modifiers); | 65 void MouseDown(int button_number, int modifiers, |
65 void MouseUp(int button_number, int modifiers); | 66 blink::WebPointerProperties::PointerType = |
| 67 blink::WebPointerProperties::PointerType::Mouse, |
| 68 int pointerId = 0); |
| 69 void MouseUp(int button_number, int modifiers, |
| 70 blink::WebPointerProperties::PointerType = |
| 71 blink::WebPointerProperties::PointerType::Mouse, |
| 72 int pointerId = 0); |
66 void SetMouseButtonState(int button_number, int modifiers); | 73 void SetMouseButtonState(int button_number, int modifiers); |
67 | 74 |
68 void KeyDown(const std::string& code_str, | 75 void KeyDown(const std::string& code_str, |
69 int modifiers, | 76 int modifiers, |
70 KeyLocationCode location); | 77 KeyLocationCode location); |
71 | 78 |
72 WebTaskList* mutable_task_list() { return &task_list_; } | 79 WebTaskList* mutable_task_list() { return &task_list_; } |
73 | 80 |
74 void set_send_wheel_gestures(bool send_wheel_gestures) { | 81 void set_send_wheel_gestures(bool send_wheel_gestures) { |
75 send_wheel_gestures_ = send_wheel_gestures; | 82 send_wheel_gestures_ = send_wheel_gestures; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 bool touch_cancelable_; | 267 bool touch_cancelable_; |
261 std::vector<blink::WebTouchPoint> touch_points_; | 268 std::vector<blink::WebTouchPoint> touch_points_; |
262 | 269 |
263 scoped_ptr<blink::WebContextMenuData> last_context_menu_data_; | 270 scoped_ptr<blink::WebContextMenuData> last_context_menu_data_; |
264 | 271 |
265 blink::WebDragData current_drag_data_; | 272 blink::WebDragData current_drag_data_; |
266 | 273 |
267 // Location of the touch point that initiated a gesture. | 274 // Location of the touch point that initiated a gesture. |
268 blink::WebPoint current_gesture_location_; | 275 blink::WebPoint current_gesture_location_; |
269 | 276 |
| 277 |
| 278 // Pen pointer properties. |
| 279 struct PenProperties { |
| 280 blink::WebMouseEvent::Button pressed_button_; |
| 281 int current_buttons_; |
| 282 int modifiers_; |
| 283 blink::WebPoint last_pos_; |
| 284 PenProperties() |
| 285 : pressed_button_(blink::WebMouseEvent::ButtonNone) |
| 286 , current_buttons_(0) |
| 287 , modifiers_(0) |
| 288 , last_pos_(blink::WebPoint(0, 0)) { } |
| 289 }; |
| 290 typedef std::unordered_map<int, PenProperties> PenStateMap; |
| 291 PenStateMap current_pen_state_; |
| 292 |
270 // Last pressed mouse button (Left/Right/Middle or None). | 293 // Last pressed mouse button (Left/Right/Middle or None). |
271 static blink::WebMouseEvent::Button pressed_button_; | 294 static blink::WebMouseEvent::Button pressed_button_; |
272 | 295 |
273 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to | 296 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to |
274 // currently pressed buttons of mouse. | 297 // currently pressed buttons of mouse. |
275 static int current_buttons_; | 298 static int current_buttons_; |
276 | 299 |
277 static int modifiers_; | 300 static int modifiers_; |
278 | 301 |
279 bool replaying_saved_events_; | 302 bool replaying_saved_events_; |
(...skipping 21 matching lines...) Expand all Loading... |
301 double last_event_timestamp_; | 324 double last_event_timestamp_; |
302 | 325 |
303 base::WeakPtrFactory<EventSender> weak_factory_; | 326 base::WeakPtrFactory<EventSender> weak_factory_; |
304 | 327 |
305 DISALLOW_COPY_AND_ASSIGN(EventSender); | 328 DISALLOW_COPY_AND_ASSIGN(EventSender); |
306 }; | 329 }; |
307 | 330 |
308 } // namespace test_runner | 331 } // namespace test_runner |
309 | 332 |
310 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ | 333 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ |
OLD | NEW |