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 #include "ui/aura/test/event_generator.h" | 5 #include "ui/aura/test/event_generator.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "ui/aura/event.h" | 8 #include "ui/aura/event.h" |
9 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
10 | 10 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 void EventGenerator::MoveMouseToCenterOf(Window* window) { | 131 void EventGenerator::MoveMouseToCenterOf(Window* window) { |
132 MoveMouseTo(CenterOfWindowInRootWindowCoordinate(root_window_, window)); | 132 MoveMouseTo(CenterOfWindowInRootWindowCoordinate(root_window_, window)); |
133 } | 133 } |
134 | 134 |
135 void EventGenerator::PressTouch() { | 135 void EventGenerator::PressTouch() { |
136 TestTouchEvent touchev(ui::ET_TOUCH_PRESSED, current_location_, flags_); | 136 TestTouchEvent touchev(ui::ET_TOUCH_PRESSED, current_location_, flags_); |
137 Dispatch(touchev); | 137 Dispatch(touchev); |
138 } | 138 } |
139 | 139 |
| 140 void EventGenerator::MoveTouch(const gfx::Point& point) { |
| 141 TestTouchEvent touchev(ui::ET_TOUCH_MOVED, point, flags_); |
| 142 Dispatch(touchev); |
| 143 |
| 144 current_location_ = point; |
| 145 } |
| 146 |
140 void EventGenerator::ReleaseTouch() { | 147 void EventGenerator::ReleaseTouch() { |
141 TestTouchEvent touchev(ui::ET_TOUCH_RELEASED, current_location_, flags_); | 148 TestTouchEvent touchev(ui::ET_TOUCH_RELEASED, current_location_, flags_); |
142 Dispatch(touchev); | 149 Dispatch(touchev); |
143 } | 150 } |
144 | 151 |
145 void EventGenerator::PressMoveAndReleaseTouchTo(const gfx::Point& point) { | 152 void EventGenerator::PressMoveAndReleaseTouchTo(const gfx::Point& point) { |
146 PressTouch(); | 153 PressTouch(); |
147 | 154 MoveTouch(point); |
148 TestTouchEvent touchev(ui::ET_TOUCH_MOVED, point, flags_); | |
149 Dispatch(touchev); | |
150 | |
151 current_location_ = point; | |
152 | |
153 ReleaseTouch(); | 155 ReleaseTouch(); |
154 } | 156 } |
155 | 157 |
156 void EventGenerator::PressMoveAndReleaseTouchToCenterOf(Window* window) { | 158 void EventGenerator::PressMoveAndReleaseTouchToCenterOf(Window* window) { |
157 PressMoveAndReleaseTouchTo(CenterOfWindowInRootWindowCoordinate(root_window_, | 159 PressMoveAndReleaseTouchTo(CenterOfWindowInRootWindowCoordinate(root_window_, |
158 window)); | 160 window)); |
159 } | 161 } |
160 | 162 |
161 void EventGenerator::GestureTapAt(const gfx::Point& location) { | 163 void EventGenerator::GestureTapAt(const gfx::Point& location) { |
162 const int kTouchId = 2; | 164 const int kTouchId = 2; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 TestKeyEvent keyev(native_event.get(), flags); | 259 TestKeyEvent keyev(native_event.get(), flags); |
258 #else | 260 #else |
259 KeyEvent keyev(type, key_code, flags); | 261 KeyEvent keyev(type, key_code, flags); |
260 #endif // USE_X11 | 262 #endif // USE_X11 |
261 #endif // OS_WIN | 263 #endif // OS_WIN |
262 Dispatch(keyev); | 264 Dispatch(keyev); |
263 } | 265 } |
264 | 266 |
265 } // namespace test | 267 } // namespace test |
266 } // namespace aura | 268 } // namespace aura |
OLD | NEW |