| 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 "third_party/WebKit/public/platform/WebDragData.h" | 19 #include "third_party/WebKit/public/platform/WebDragData.h" |
| 19 #include "third_party/WebKit/public/platform/WebInputEventResult.h" | 20 #include "third_party/WebKit/public/platform/WebInputEventResult.h" |
| 20 #include "third_party/WebKit/public/platform/WebPoint.h" | 21 #include "third_party/WebKit/public/platform/WebPoint.h" |
| 21 #include "third_party/WebKit/public/web/WebDragOperation.h" | 22 #include "third_party/WebKit/public/web/WebDragOperation.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 void Install(blink::WebFrame*); | 56 void Install(blink::WebFrame*); |
| 56 void SetDelegate(WebTestDelegate*); | 57 void SetDelegate(WebTestDelegate*); |
| 57 void SetWebView(blink::WebView*); | 58 void SetWebView(blink::WebView*); |
| 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 MouseDown(int button_number, int modifiers); | 64 void MouseDown(int button_number, int modifiers); |
| 64 void MouseUp(int button_number, int modifiers); | 65 void MouseUp(int button_number, int modifiers); |
| 66 void PointerDown(int button_number, int modifiers, |
| 67 blink::WebPointerProperties::PointerType, int pointerId); |
| 68 void PointerUp(int button_number, int modifiers, |
| 69 blink::WebPointerProperties::PointerType, int pointerId); |
| 65 void SetMouseButtonState(int button_number, int modifiers); | 70 void SetMouseButtonState(int button_number, int modifiers); |
| 66 | 71 |
| 67 void KeyDown(const std::string& code_str, | 72 void KeyDown(const std::string& code_str, |
| 68 int modifiers, | 73 int modifiers, |
| 69 KeyLocationCode location); | 74 KeyLocationCode location); |
| 70 | 75 |
| 71 void set_send_wheel_gestures(bool send_wheel_gestures) { | 76 void set_send_wheel_gestures(bool send_wheel_gestures) { |
| 72 send_wheel_gestures_ = send_wheel_gestures; | 77 send_wheel_gestures_ = send_wheel_gestures; |
| 73 } | 78 } |
| 74 | 79 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 MouseScrollType scroll_type, | 180 MouseScrollType scroll_type, |
| 176 blink::WebMouseWheelEvent* event, | 181 blink::WebMouseWheelEvent* event, |
| 177 bool* send_gestures); | 182 bool* send_gestures); |
| 178 void InitPointerProperties(gin::Arguments* args, | 183 void InitPointerProperties(gin::Arguments* args, |
| 179 blink::WebPointerProperties* e, | 184 blink::WebPointerProperties* e, |
| 180 float* radius_x, | 185 float* radius_x, |
| 181 float* radius_y); | 186 float* radius_y); |
| 182 | 187 |
| 183 void FinishDragAndDrop(const blink::WebMouseEvent&, blink::WebDragOperation); | 188 void FinishDragAndDrop(const blink::WebMouseEvent&, blink::WebDragOperation); |
| 184 | 189 |
| 185 void DoMouseUp(const blink::WebMouseEvent&); | 190 void DoDragAfterMouseUp(const blink::WebMouseEvent&); |
| 186 void DoMouseMove(const blink::WebMouseEvent&); | 191 void DoDragAfterMouseMove(const blink::WebMouseEvent&); |
| 187 void ReplaySavedEvents(); | 192 void ReplaySavedEvents(); |
| 188 blink::WebInputEventResult HandleInputEventOnViewOrPopup( | 193 blink::WebInputEventResult HandleInputEventOnViewOrPopup( |
| 189 const blink::WebInputEvent&); | 194 const blink::WebInputEvent&); |
| 190 | 195 |
| 191 void SendGesturesForMouseWheelEvent( | 196 void SendGesturesForMouseWheelEvent( |
| 192 const blink::WebMouseWheelEvent wheel_event); | 197 const blink::WebMouseWheelEvent wheel_event); |
| 193 | 198 |
| 194 double last_event_timestamp() { return last_event_timestamp_; } | 199 double last_event_timestamp() { return last_event_timestamp_; } |
| 195 | 200 |
| 196 bool force_layout_on_events() const { return force_layout_on_events_; } | 201 bool force_layout_on_events() const { return force_layout_on_events_; } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 bool touch_cancelable_; | 260 bool touch_cancelable_; |
| 256 std::vector<blink::WebTouchPoint> touch_points_; | 261 std::vector<blink::WebTouchPoint> touch_points_; |
| 257 | 262 |
| 258 scoped_ptr<blink::WebContextMenuData> last_context_menu_data_; | 263 scoped_ptr<blink::WebContextMenuData> last_context_menu_data_; |
| 259 | 264 |
| 260 blink::WebDragData current_drag_data_; | 265 blink::WebDragData current_drag_data_; |
| 261 | 266 |
| 262 // Location of the touch point that initiated a gesture. | 267 // Location of the touch point that initiated a gesture. |
| 263 blink::WebPoint current_gesture_location_; | 268 blink::WebPoint current_gesture_location_; |
| 264 | 269 |
| 265 // Last pressed mouse button (Left/Right/Middle or None). | |
| 266 static blink::WebMouseEvent::Button pressed_button_; | |
| 267 | 270 |
| 268 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to | 271 // Mouse-like pointer properties. |
| 269 // currently pressed buttons of mouse. | 272 struct PointerState { |
| 270 static int current_buttons_; | 273 // Last pressed button (Left/Right/Middle or None). |
| 274 blink::WebMouseEvent::Button pressed_button_; |
| 271 | 275 |
| 272 static int modifiers_; | 276 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to |
| 277 // currently pressed buttons of the pointer (e.g. pen or mouse). |
| 278 int current_buttons_; |
| 279 |
| 280 // Location of last mouseMoveTo event of this pointer. |
| 281 blink::WebPoint last_pos_; |
| 282 |
| 283 int modifiers_; |
| 284 |
| 285 PointerState() |
| 286 : pressed_button_(blink::WebMouseEvent::ButtonNone) |
| 287 , current_buttons_(0) |
| 288 , last_pos_(blink::WebPoint(0, 0)) |
| 289 , modifiers_(0) { } |
| 290 }; |
| 291 typedef std::unordered_map<int, PointerState> PointerStateMap; |
| 292 PointerStateMap current_pointer_state_; |
| 273 | 293 |
| 274 bool replaying_saved_events_; | 294 bool replaying_saved_events_; |
| 275 | 295 |
| 276 std::deque<SavedEvent> mouse_event_queue_; | 296 std::deque<SavedEvent> mouse_event_queue_; |
| 277 | 297 |
| 278 blink::WebDragOperationsMask current_drag_effects_allowed_; | 298 blink::WebDragOperationsMask current_drag_effects_allowed_; |
| 279 | 299 |
| 280 // Location of last mouseMoveTo event. | |
| 281 static blink::WebPoint last_mouse_pos_; | |
| 282 | |
| 283 // Time and place of the last mouse up event. | 300 // Time and place of the last mouse up event. |
| 284 double last_click_time_sec_; | 301 double last_click_time_sec_; |
| 285 blink::WebPoint last_click_pos_; | 302 blink::WebPoint last_click_pos_; |
| 286 | 303 |
| 287 // The last button number passed to mouseDown and mouseUp. | 304 // The last button number passed to mouseDown and mouseUp. |
| 288 // Used to determine whether the click count continues to increment or not. | 305 // Used to determine whether the click count continues to increment or not. |
| 289 static blink::WebMouseEvent::Button last_button_type_; | 306 static blink::WebMouseEvent::Button last_button_type_; |
| 290 | 307 |
| 291 blink::WebDragOperation current_drag_effect_; | 308 blink::WebDragOperation current_drag_effect_; |
| 292 | 309 |
| 293 uint32_t time_offset_ms_; | 310 uint32_t time_offset_ms_; |
| 294 int click_count_; | 311 int click_count_; |
| 295 // Timestamp (in seconds) of the last event that was dispatched | 312 // Timestamp (in seconds) of the last event that was dispatched |
| 296 double last_event_timestamp_; | 313 double last_event_timestamp_; |
| 297 | 314 |
| 298 base::WeakPtrFactory<EventSender> weak_factory_; | 315 base::WeakPtrFactory<EventSender> weak_factory_; |
| 299 | 316 |
| 300 DISALLOW_COPY_AND_ASSIGN(EventSender); | 317 DISALLOW_COPY_AND_ASSIGN(EventSender); |
| 301 }; | 318 }; |
| 302 | 319 |
| 303 } // namespace test_runner | 320 } // namespace test_runner |
| 304 | 321 |
| 305 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ | 322 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ |
| OLD | NEW |