| OLD | NEW |
| 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 #include "ui/events/test/event_generator.h" | 5 #include "ui/events/test/event_generator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 void EventGenerator::PressMoveAndReleaseTouchTo(const gfx::Point& point) { | 290 void EventGenerator::PressMoveAndReleaseTouchTo(const gfx::Point& point) { |
| 291 PressTouch(); | 291 PressTouch(); |
| 292 MoveTouch(point); | 292 MoveTouch(point); |
| 293 ReleaseTouch(); | 293 ReleaseTouch(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 void EventGenerator::PressMoveAndReleaseTouchToCenterOf(EventTarget* window) { | 296 void EventGenerator::PressMoveAndReleaseTouchToCenterOf(EventTarget* window) { |
| 297 PressMoveAndReleaseTouchTo(CenterOfWindow(window)); | 297 PressMoveAndReleaseTouchTo(CenterOfWindow(window)); |
| 298 } | 298 } |
| 299 | 299 |
| 300 void EventGenerator::GestureEdgeSwipe() { | |
| 301 GestureEventDetails details(ET_GESTURE_WIN8_EDGE_SWIPE); | |
| 302 details.set_device_type(GestureDeviceType::DEVICE_TOUCHSCREEN); | |
| 303 GestureEvent gesture(0, 0, 0, ui::EventTimeForNow(), details); | |
| 304 Dispatch(&gesture); | |
| 305 } | |
| 306 | |
| 307 void EventGenerator::GestureTapAt(const gfx::Point& location) { | 300 void EventGenerator::GestureTapAt(const gfx::Point& location) { |
| 308 const int kTouchId = 2; | 301 const int kTouchId = 2; |
| 309 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, kTouchId, | 302 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, kTouchId, |
| 310 ui::EventTimeForNow()); | 303 ui::EventTimeForNow()); |
| 311 Dispatch(&press); | 304 Dispatch(&press); |
| 312 | 305 |
| 313 ui::TouchEvent release( | 306 ui::TouchEvent release( |
| 314 ui::ET_TOUCH_RELEASED, location, kTouchId, | 307 ui::ET_TOUCH_RELEASED, location, kTouchId, |
| 315 press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); | 308 press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); |
| 316 Dispatch(&release); | 309 Dispatch(&release); |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 return default_delegate; | 667 return default_delegate; |
| 675 } | 668 } |
| 676 | 669 |
| 677 EventGeneratorDelegate* EventGenerator::delegate() { | 670 EventGeneratorDelegate* EventGenerator::delegate() { |
| 678 return const_cast<EventGeneratorDelegate*>( | 671 return const_cast<EventGeneratorDelegate*>( |
| 679 const_cast<const EventGenerator*>(this)->delegate()); | 672 const_cast<const EventGenerator*>(this)->delegate()); |
| 680 } | 673 } |
| 681 | 674 |
| 682 } // namespace test | 675 } // namespace test |
| 683 } // namespace ui | 676 } // namespace ui |
| OLD | NEW |