OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "ui/base/keycodes/keyboard_codes.h" | 10 #include "ui/base/keycodes/keyboard_codes.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 void PressMoveAndReleaseTouchBy(int x, int y) { | 88 void PressMoveAndReleaseTouchBy(int x, int y) { |
89 PressMoveAndReleaseTouchTo(current_location_.Add(gfx::Point(x, y))); | 89 PressMoveAndReleaseTouchTo(current_location_.Add(gfx::Point(x, y))); |
90 } | 90 } |
91 | 91 |
92 // Generates press, move and release events to move touch | 92 // Generates press, move and release events to move touch |
93 // to the center of the window. | 93 // to the center of the window. |
94 void PressMoveAndReleaseTouchToCenterOf(Window* window); | 94 void PressMoveAndReleaseTouchToCenterOf(Window* window); |
95 | 95 |
96 // Generates a key press event. On platforms except Windows and X11, a key | 96 // Generates a key press event. On platforms except Windows and X11, a key |
97 // event without native_event() is generated. | 97 // event without native_event() is generated. Note that ui::EF_ flags should |
| 98 // be passed as |flags|, not the native ones like 'ShiftMask' in <X11/X.h>. |
98 // TODO(yusukes): Support native_event() on all platforms. | 99 // TODO(yusukes): Support native_event() on all platforms. |
99 void PressKey(ui::KeyboardCode key_code, int flags); | 100 void PressKey(ui::KeyboardCode key_code, int flags); |
100 | 101 |
101 // Generates a key release event. On platforms except Windows and X11, a key | 102 // Generates a key release event. On platforms except Windows and X11, a key |
102 // event without native_event() is generated. | 103 // event without native_event() is generated. Note that ui::EF_ flags should |
| 104 // be passed as |flags|, not the native ones like 'ShiftMask' in <X11/X.h>. |
103 // TODO(yusukes): Support native_event() on all platforms. | 105 // TODO(yusukes): Support native_event() on all platforms. |
104 void ReleaseKey(ui::KeyboardCode key_code, int flags); | 106 void ReleaseKey(ui::KeyboardCode key_code, int flags); |
105 | 107 |
106 private: | 108 private: |
107 // Dispatch the |event| to the RootWindow. | 109 // Dispatch the |event| to the RootWindow. |
108 void Dispatch(Event& event); | 110 void Dispatch(Event& event); |
109 // Dispatch a key event to the RootWindow. | 111 // Dispatch a key event to the RootWindow. |
110 void DispatchKeyEvent(bool is_press, ui::KeyboardCode key_code, int flags); | 112 void DispatchKeyEvent(bool is_press, ui::KeyboardCode key_code, int flags); |
111 | 113 |
112 int flags_; | 114 int flags_; |
113 gfx::Point current_location_; | 115 gfx::Point current_location_; |
114 | 116 |
115 DISALLOW_COPY_AND_ASSIGN(EventGenerator); | 117 DISALLOW_COPY_AND_ASSIGN(EventGenerator); |
116 }; | 118 }; |
117 | 119 |
118 } // namespace test | 120 } // namespace test |
119 } // namespace aura | 121 } // namespace aura |
120 | 122 |
121 #endif // UI_AURA_TEST_EVENT_GENERATOR_H_ | 123 #endif // UI_AURA_TEST_EVENT_GENERATOR_H_ |
OLD | NEW |