OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_AURA_TEST_EVENT_GENERATOR_H_ | 5 #ifndef UI_AURA_TEST_EVENT_GENERATOR_H_ |
6 #define UI_AURA_TEST_EVENT_GENERATOR_H_ | 6 #define UI_AURA_TEST_EVENT_GENERATOR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ui/base/keycodes/keyboard_codes.h" | 9 #include "ui/base/keycodes/keyboard_codes.h" |
10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class TimeDelta; | 13 class TimeDelta; |
14 } | 14 } |
15 | 15 |
| 16 namespace ui { |
| 17 class Event; |
| 18 } |
| 19 |
16 namespace aura { | 20 namespace aura { |
17 class Event; | |
18 class RootWindow; | 21 class RootWindow; |
19 class Window; | 22 class Window; |
20 | 23 |
21 namespace test { | 24 namespace test { |
22 | 25 |
23 // EventGenerator is a tool that generates and dispatch events. | 26 // EventGenerator is a tool that generates and dispatch events. |
24 class EventGenerator { | 27 class EventGenerator { |
25 public: | 28 public: |
26 // Creates an EventGenerator with the mouse/touch location (0,0). | 29 // Creates an EventGenerator with the mouse/touch location (0,0). |
27 explicit EventGenerator(RootWindow* root_window); | 30 explicit EventGenerator(RootWindow* root_window); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // TODO(yusukes): Support native_event() on all platforms. | 161 // TODO(yusukes): Support native_event() on all platforms. |
159 void PressKey(ui::KeyboardCode key_code, int flags); | 162 void PressKey(ui::KeyboardCode key_code, int flags); |
160 | 163 |
161 // Generates a key release event. On platforms except Windows and X11, a key | 164 // Generates a key release event. On platforms except Windows and X11, a key |
162 // event without native_event() is generated. Note that ui::EF_ flags should | 165 // event without native_event() is generated. Note that ui::EF_ flags should |
163 // be passed as |flags|, not the native ones like 'ShiftMask' in <X11/X.h>. | 166 // be passed as |flags|, not the native ones like 'ShiftMask' in <X11/X.h>. |
164 // TODO(yusukes): Support native_event() on all platforms. | 167 // TODO(yusukes): Support native_event() on all platforms. |
165 void ReleaseKey(ui::KeyboardCode key_code, int flags); | 168 void ReleaseKey(ui::KeyboardCode key_code, int flags); |
166 | 169 |
167 // Dispatch the |event| to the RootWindow. | 170 // Dispatch the |event| to the RootWindow. |
168 void Dispatch(Event& event); | 171 void Dispatch(ui::Event& event); |
169 | 172 |
170 private: | 173 private: |
171 // Dispatch a key event to the RootWindow. | 174 // Dispatch a key event to the RootWindow. |
172 void DispatchKeyEvent(bool is_press, ui::KeyboardCode key_code, int flags); | 175 void DispatchKeyEvent(bool is_press, ui::KeyboardCode key_code, int flags); |
173 | 176 |
174 RootWindow* root_window_; | 177 RootWindow* root_window_; |
175 int flags_; | 178 int flags_; |
176 gfx::Point current_location_; | 179 gfx::Point current_location_; |
177 | 180 |
178 DISALLOW_COPY_AND_ASSIGN(EventGenerator); | 181 DISALLOW_COPY_AND_ASSIGN(EventGenerator); |
179 }; | 182 }; |
180 | 183 |
181 } // namespace test | 184 } // namespace test |
182 } // namespace aura | 185 } // namespace aura |
183 | 186 |
184 #endif // UI_AURA_TEST_EVENT_GENERATOR_H_ | 187 #endif // UI_AURA_TEST_EVENT_GENERATOR_H_ |
OLD | NEW |