Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: components/test_runner/event_sender.h

Issue 1897363003: Use correct WebView from EventSender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed initial state of EventSender. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <unordered_map>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.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 WebFrame; 27 class WebLocalFrame;
28 class WebView; 28 class WebView;
29 struct WebContextMenuData; 29 struct WebContextMenuData;
30 } 30 }
31 31
32 namespace gin { 32 namespace gin {
33 class Arguments; 33 class Arguments;
34 } 34 }
35 35
36 namespace test_runner { 36 namespace test_runner {
37 37
38 class TestInterfaces; 38 class TestInterfaces;
39 class WebTestDelegate; 39 class WebTestDelegate;
40 class WebTestProxyBase;
40 41
41 // Key event location code introduced in DOM Level 3. 42 // Key event location code introduced in DOM Level 3.
42 // See also: http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents 43 // See also: http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents
43 enum KeyLocationCode { 44 enum KeyLocationCode {
44 DOMKeyLocationStandard = 0x00, 45 DOMKeyLocationStandard = 0x00,
45 DOMKeyLocationLeft = 0x01, 46 DOMKeyLocationLeft = 0x01,
46 DOMKeyLocationRight = 0x02, 47 DOMKeyLocationRight = 0x02,
47 DOMKeyLocationNumpad = 0x03 48 DOMKeyLocationNumpad = 0x03
48 }; 49 };
49 50
50 class EventSender : public base::SupportsWeakPtr<EventSender> { 51 class EventSender {
51 public: 52 public:
52 explicit EventSender(TestInterfaces*); 53 explicit EventSender(WebTestProxyBase*);
53 virtual ~EventSender(); 54 virtual ~EventSender();
54 55
55 void Reset(); 56 void Reset();
56 void Install(blink::WebFrame*); 57 void Install(blink::WebLocalFrame*);
57 void SetDelegate(WebTestDelegate*);
58 void SetWebView(blink::WebView*);
59 58
60 void SetContextMenuData(const blink::WebContextMenuData&); 59 void SetContextMenuData(const blink::WebContextMenuData&);
61 60
62 void DoDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask); 61 void DoDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask);
63 62
63 void set_send_wheel_gestures(bool send_wheel_gestures) {
64 send_wheel_gestures_ = send_wheel_gestures;
65 }
66
67 private:
68 friend class EventSenderBindings;
69
64 void MouseDown(int button_number, int modifiers); 70 void MouseDown(int button_number, int modifiers);
65 void MouseUp(int button_number, int modifiers); 71 void MouseUp(int button_number, int modifiers);
66 void PointerDown(int button_number, 72 void PointerDown(int button_number,
67 int modifiers, 73 int modifiers,
68 blink::WebPointerProperties::PointerType, 74 blink::WebPointerProperties::PointerType,
69 int pointerId); 75 int pointerId);
70 void PointerUp(int button_number, 76 void PointerUp(int button_number,
71 int modifiers, 77 int modifiers,
72 blink::WebPointerProperties::PointerType, 78 blink::WebPointerProperties::PointerType,
73 int pointerId); 79 int pointerId);
74 void SetMouseButtonState(int button_number, int modifiers); 80 void SetMouseButtonState(int button_number, int modifiers);
75 81
76 void KeyDown(const std::string& code_str, 82 void KeyDown(const std::string& code_str,
77 int modifiers, 83 int modifiers,
78 KeyLocationCode location); 84 KeyLocationCode location);
79 85
80 void set_send_wheel_gestures(bool send_wheel_gestures) {
81 send_wheel_gestures_ = send_wheel_gestures;
82 }
83
84 private:
85 friend class EventSenderBindings;
86
87 struct SavedEvent { 86 struct SavedEvent {
88 enum SavedEventType { 87 enum SavedEventType {
89 TYPE_UNSPECIFIED, 88 TYPE_UNSPECIFIED,
90 TYPE_MOUSE_UP, 89 TYPE_MOUSE_UP,
91 TYPE_MOUSE_MOVE, 90 TYPE_MOUSE_MOVE,
92 TYPE_LEAP_FORWARD 91 TYPE_LEAP_FORWARD
93 }; 92 };
94 93
95 SavedEvent(); 94 SavedEvent();
96 95
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 int wm_key_down_; 241 int wm_key_down_;
243 int wm_key_up_; 242 int wm_key_up_;
244 int wm_char_; 243 int wm_char_;
245 int wm_dead_char_; 244 int wm_dead_char_;
246 int wm_sys_key_down_; 245 int wm_sys_key_down_;
247 int wm_sys_key_up_; 246 int wm_sys_key_up_;
248 int wm_sys_char_; 247 int wm_sys_char_;
249 int wm_sys_dead_char_; 248 int wm_sys_dead_char_;
250 #endif 249 #endif
251 250
252 TestInterfaces* interfaces_; 251 WebTestProxyBase* web_test_proxy_base_;
253 WebTestDelegate* delegate_; 252 TestInterfaces* interfaces();
254 blink::WebView* view_; 253 WebTestDelegate* delegate();
254 const blink::WebView* view() const;
255 blink::WebView* view();
255 256
256 bool send_wheel_gestures_; 257 bool send_wheel_gestures_;
257 bool force_layout_on_events_; 258 bool force_layout_on_events_;
258 259
259 // When set to true (the default value), we batch mouse move and mouse up 260 // When set to true (the default value), we batch mouse move and mouse up
260 // events so we can simulate drag & drop. 261 // events so we can simulate drag & drop.
261 bool is_drag_mode_; 262 bool is_drag_mode_;
262 263
263 int touch_modifiers_; 264 int touch_modifiers_;
264 bool touch_cancelable_; 265 bool touch_cancelable_;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 double last_event_timestamp_; 318 double last_event_timestamp_;
318 319
319 base::WeakPtrFactory<EventSender> weak_factory_; 320 base::WeakPtrFactory<EventSender> weak_factory_;
320 321
321 DISALLOW_COPY_AND_ASSIGN(EventSender); 322 DISALLOW_COPY_AND_ASSIGN(EventSender);
322 }; 323 };
323 324
324 } // namespace test_runner 325 } // namespace test_runner
325 326
326 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ 327 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_
OLDNEW
« no previous file with comments | « no previous file | components/test_runner/event_sender.cc » ('j') | components/test_runner/event_sender.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698