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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 if (async) { | 681 if (async) { |
682 std::unique_ptr<ui::Event> pending_event = ui::Event::Clone(*event); | 682 std::unique_ptr<ui::Event> pending_event = ui::Event::Clone(*event); |
683 if (pending_events_.empty()) { | 683 if (pending_events_.empty()) { |
684 base::ThreadTaskRunnerHandle::Get()->PostTask( | 684 base::ThreadTaskRunnerHandle::Get()->PostTask( |
685 FROM_HERE, | 685 FROM_HERE, |
686 base::Bind(&EventGenerator::DispatchNextPendingEvent, | 686 base::Bind(&EventGenerator::DispatchNextPendingEvent, |
687 base::Unretained(this))); | 687 base::Unretained(this))); |
688 } | 688 } |
689 pending_events_.push_back(std::move(pending_event)); | 689 pending_events_.push_back(std::move(pending_event)); |
690 } else { | 690 } else { |
691 if (event->IsKeyEvent()) | |
692 delegate()->DispatchKeyEventToIME(current_target_, event->AsKeyEvent()); | |
693 MaybeDispatchToPointerWatchers(*event); | 691 MaybeDispatchToPointerWatchers(*event); |
694 if (!event->handled()) { | 692 if (!event->handled()) { |
695 ui::EventSource* event_source = | 693 ui::EventSource* event_source = |
696 delegate()->GetEventSource(current_target_); | 694 delegate()->GetEventSource(current_target_); |
697 ui::EventSourceTestApi event_source_test(event_source); | 695 ui::EventSourceTestApi event_source_test(event_source); |
698 ui::EventDispatchDetails details = | 696 ui::EventDispatchDetails details = |
699 event_source_test.SendEventToSink(event); | 697 event_source_test.SendEventToSink(event); |
700 CHECK(!details.dispatcher_destroyed); | 698 CHECK(!details.dispatcher_destroyed); |
701 } | 699 } |
702 } | 700 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 return default_delegate; | 742 return default_delegate; |
745 } | 743 } |
746 | 744 |
747 EventGeneratorDelegate* EventGenerator::delegate() { | 745 EventGeneratorDelegate* EventGenerator::delegate() { |
748 return const_cast<EventGeneratorDelegate*>( | 746 return const_cast<EventGeneratorDelegate*>( |
749 const_cast<const EventGenerator*>(this)->delegate()); | 747 const_cast<const EventGenerator*>(this)->delegate()); |
750 } | 748 } |
751 | 749 |
752 } // namespace test | 750 } // namespace test |
753 } // namespace ui | 751 } // namespace ui |
OLD | NEW |