| 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 |
| 270 // Last pressed mouse button (Left/Right/Middle or None). | |
| 271 static blink::WebMouseEvent::Button pressed_button_; | |
| 272 | 277 |
| 273 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to | 278 // Mouse-like pointer properties. |
| 274 // currently pressed buttons of mouse. | 279 struct PointerState { |
| 275 static int current_buttons_; | 280 // Last pressed button (Left/Right/Middle or None). |
| 281 blink::WebMouseEvent::Button pressed_button_; |
| 276 | 282 |
| 277 static int modifiers_; | 283 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to |
| 284 // currently pressed buttons of the pointer (e.g. pen or mouse). |
| 285 int current_buttons_; |
| 286 |
| 287 // Location of last mouseMoveTo event of this pointer. |
| 288 blink::WebPoint last_pos_; |
| 289 |
| 290 int modifiers_; |
| 291 |
| 292 PointerState() |
| 293 : pressed_button_(blink::WebMouseEvent::ButtonNone) |
| 294 , current_buttons_(0) |
| 295 , last_pos_(blink::WebPoint(0, 0)) |
| 296 , modifiers_(0) { } |
| 297 }; |
| 298 typedef std::unordered_map<int, PointerState> PointerStateMap; |
| 299 PointerStateMap current_pointer_state_; |
| 278 | 300 |
| 279 bool replaying_saved_events_; | 301 bool replaying_saved_events_; |
| 280 | 302 |
| 281 std::deque<SavedEvent> mouse_event_queue_; | 303 std::deque<SavedEvent> mouse_event_queue_; |
| 282 | 304 |
| 283 blink::WebDragOperationsMask current_drag_effects_allowed_; | 305 blink::WebDragOperationsMask current_drag_effects_allowed_; |
| 284 | 306 |
| 285 // Location of last mouseMoveTo event. | |
| 286 static blink::WebPoint last_mouse_pos_; | |
| 287 | |
| 288 // Time and place of the last mouse up event. | 307 // Time and place of the last mouse up event. |
| 289 double last_click_time_sec_; | 308 double last_click_time_sec_; |
| 290 blink::WebPoint last_click_pos_; | 309 blink::WebPoint last_click_pos_; |
| 291 | 310 |
| 292 // The last button number passed to mouseDown and mouseUp. | 311 // The last button number passed to mouseDown and mouseUp. |
| 293 // Used to determine whether the click count continues to increment or not. | 312 // Used to determine whether the click count continues to increment or not. |
| 294 static blink::WebMouseEvent::Button last_button_type_; | 313 static blink::WebMouseEvent::Button last_button_type_; |
| 295 | 314 |
| 296 blink::WebDragOperation current_drag_effect_; | 315 blink::WebDragOperation current_drag_effect_; |
| 297 | 316 |
| 298 uint32_t time_offset_ms_; | 317 uint32_t time_offset_ms_; |
| 299 int click_count_; | 318 int click_count_; |
| 300 // Timestamp (in seconds) of the last event that was dispatched | 319 // Timestamp (in seconds) of the last event that was dispatched |
| 301 double last_event_timestamp_; | 320 double last_event_timestamp_; |
| 302 | 321 |
| 303 base::WeakPtrFactory<EventSender> weak_factory_; | 322 base::WeakPtrFactory<EventSender> weak_factory_; |
| 304 | 323 |
| 305 DISALLOW_COPY_AND_ASSIGN(EventSender); | 324 DISALLOW_COPY_AND_ASSIGN(EventSender); |
| 306 }; | 325 }; |
| 307 | 326 |
| 308 } // namespace test_runner | 327 } // namespace test_runner |
| 309 | 328 |
| 310 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ | 329 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ |
| OLD | NEW |