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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // Creates an EventGenerator with the mouse/touch location | 29 // Creates an EventGenerator with the mouse/touch location |
30 // at |initial_location|. | 30 // at |initial_location|. |
31 EventGenerator(RootWindow* root_window, const gfx::Point& initial_location); | 31 EventGenerator(RootWindow* root_window, const gfx::Point& initial_location); |
32 | 32 |
33 // Creates an EventGenerator with the mouse/touch location | 33 // Creates an EventGenerator with the mouse/touch location |
34 // centered over |window|. | 34 // centered over |window|. |
35 EventGenerator(RootWindow* root_window, Window* window); | 35 EventGenerator(RootWindow* root_window, Window* window); |
36 | 36 |
37 virtual ~EventGenerator(); | 37 virtual ~EventGenerator(); |
38 | 38 |
| 39 // Explicitly sets the location used by mouse/touch events. This is set by the |
| 40 // various methods that take a location but can be manipulated directly, |
| 41 // typically for touch. |
| 42 void set_current_location(const gfx::Point& location) { |
| 43 current_location_ = location; |
| 44 } |
39 const gfx::Point& current_location() const { return current_location_; } | 45 const gfx::Point& current_location() const { return current_location_; } |
40 | 46 |
41 // Resets the event flags bitmask. | 47 // Resets the event flags bitmask. |
42 void set_flags(int flags) { flags_ = flags; } | 48 void set_flags(int flags) { flags_ = flags; } |
43 | 49 |
44 // Generates a left button press event. | 50 // Generates a left button press event. |
45 void PressLeftButton(); | 51 void PressLeftButton(); |
46 | 52 |
47 // Generates a left button release event. | 53 // Generates a left button release event. |
48 void ReleaseLeftButton(); | 54 void ReleaseLeftButton(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 void DragMouseBy(int dx, int dy) { | 89 void DragMouseBy(int dx, int dy) { |
84 DragMouseTo(current_location_.Add(gfx::Point(dx, dy))); | 90 DragMouseTo(current_location_.Add(gfx::Point(dx, dy))); |
85 } | 91 } |
86 | 92 |
87 // Generates events to move the mouse to the center of the window. | 93 // Generates events to move the mouse to the center of the window. |
88 void MoveMouseToCenterOf(Window* window); | 94 void MoveMouseToCenterOf(Window* window); |
89 | 95 |
90 // Generates a touch press event. | 96 // Generates a touch press event. |
91 void PressTouch(); | 97 void PressTouch(); |
92 | 98 |
| 99 // Generates a ET_TOUCH_MOVED event to |point|. |
| 100 void MoveTouch(const gfx::Point& point); |
| 101 |
93 // Generates a touch release event. | 102 // Generates a touch release event. |
94 void ReleaseTouch(); | 103 void ReleaseTouch(); |
95 | 104 |
96 // Generates press, move and release event to move touch | 105 // Generates press, move and release event to move touch |
97 // to be the given |point|. | 106 // to be the given |point|. |
98 void PressMoveAndReleaseTouchTo(const gfx::Point& point); | 107 void PressMoveAndReleaseTouchTo(const gfx::Point& point); |
99 | 108 |
100 void PressMoveAndReleaseTouchTo(int x, int y) { | 109 void PressMoveAndReleaseTouchTo(int x, int y) { |
101 PressMoveAndReleaseTouchTo(gfx::Point(x, y)); | 110 PressMoveAndReleaseTouchTo(gfx::Point(x, y)); |
102 } | 111 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 int flags_; | 161 int flags_; |
153 gfx::Point current_location_; | 162 gfx::Point current_location_; |
154 | 163 |
155 DISALLOW_COPY_AND_ASSIGN(EventGenerator); | 164 DISALLOW_COPY_AND_ASSIGN(EventGenerator); |
156 }; | 165 }; |
157 | 166 |
158 } // namespace test | 167 } // namespace test |
159 } // namespace aura | 168 } // namespace aura |
160 | 169 |
161 #endif // UI_AURA_TEST_EVENT_GENERATOR_H_ | 170 #endif // UI_AURA_TEST_EVENT_GENERATOR_H_ |
OLD | NEW |