| 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 ui::ScrollEvent fling_start(ui::ET_SCROLL_FLING_START, | 543 ui::ScrollEvent fling_start(ui::ET_SCROLL_FLING_START, |
| 544 start, | 544 start, |
| 545 timestamp, | 545 timestamp, |
| 546 0, | 546 0, |
| 547 offsets[steps - 1].x(), offsets[steps - 1].y(), | 547 offsets[steps - 1].x(), offsets[steps - 1].y(), |
| 548 offsets[steps - 1].x(), offsets[steps - 1].y(), | 548 offsets[steps - 1].x(), offsets[steps - 1].y(), |
| 549 num_fingers); | 549 num_fingers); |
| 550 Dispatch(&fling_start); | 550 Dispatch(&fling_start); |
| 551 } | 551 } |
| 552 | 552 |
| 553 void EventGenerator::GenerateTrackpadRest() { |
| 554 int num_fingers = 2; |
| 555 ui::ScrollEvent scroll(ui::ET_SCROLL, current_location_, |
| 556 ui::EventTimeForNow(), 0, 0, 0, 0, 0, num_fingers, |
| 557 EventMomentumPhase::MAY_BEGIN); |
| 558 Dispatch(&scroll); |
| 559 } |
| 560 |
| 561 void EventGenerator::CancelTrackpadRest() { |
| 562 int num_fingers = 2; |
| 563 ui::ScrollEvent scroll(ui::ET_SCROLL, current_location_, |
| 564 ui::EventTimeForNow(), 0, 0, 0, 0, 0, num_fingers, |
| 565 EventMomentumPhase::END); |
| 566 Dispatch(&scroll); |
| 567 } |
| 568 |
| 553 void EventGenerator::PressKey(ui::KeyboardCode key_code, int flags) { | 569 void EventGenerator::PressKey(ui::KeyboardCode key_code, int flags) { |
| 554 DispatchKeyEvent(true, key_code, flags); | 570 DispatchKeyEvent(true, key_code, flags); |
| 555 } | 571 } |
| 556 | 572 |
| 557 void EventGenerator::ReleaseKey(ui::KeyboardCode key_code, int flags) { | 573 void EventGenerator::ReleaseKey(ui::KeyboardCode key_code, int flags) { |
| 558 DispatchKeyEvent(false, key_code, flags); | 574 DispatchKeyEvent(false, key_code, flags); |
| 559 } | 575 } |
| 560 | 576 |
| 561 void EventGenerator::Dispatch(ui::Event* event) { | 577 void EventGenerator::Dispatch(ui::Event* event) { |
| 562 DoDispatchEvent(event, async_); | 578 DoDispatchEvent(event, async_); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 return default_delegate; | 707 return default_delegate; |
| 692 } | 708 } |
| 693 | 709 |
| 694 EventGeneratorDelegate* EventGenerator::delegate() { | 710 EventGeneratorDelegate* EventGenerator::delegate() { |
| 695 return const_cast<EventGeneratorDelegate*>( | 711 return const_cast<EventGeneratorDelegate*>( |
| 696 const_cast<const EventGenerator*>(this)->delegate()); | 712 const_cast<const EventGenerator*>(this)->delegate()); |
| 697 } | 713 } |
| 698 | 714 |
| 699 } // namespace test | 715 } // namespace test |
| 700 } // namespace ui | 716 } // namespace ui |
| OLD | NEW |