| 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 void EventGenerator::ReleaseKey(ui::KeyboardCode key_code, int flags) { | 536 void EventGenerator::ReleaseKey(ui::KeyboardCode key_code, int flags) { |
| 537 DispatchKeyEvent(false, key_code, flags); | 537 DispatchKeyEvent(false, key_code, flags); |
| 538 } | 538 } |
| 539 | 539 |
| 540 void EventGenerator::Dispatch(ui::Event* event) { | 540 void EventGenerator::Dispatch(ui::Event* event) { |
| 541 DoDispatchEvent(event, async_); | 541 DoDispatchEvent(event, async_); |
| 542 } | 542 } |
| 543 | 543 |
| 544 void EventGenerator::Init(gfx::NativeWindow root_window, | 544 void EventGenerator::Init(gfx::NativeWindow root_window, |
| 545 gfx::NativeWindow window_context) { | 545 gfx::NativeWindow window_context) { |
| 546 ui::SetEventTickClockForTesting(WrapUnique(new TestTickClock())); | 546 ui::SetEventTickClockForTesting(base::MakeUnique<TestTickClock>()); |
| 547 delegate()->SetContext(this, root_window, window_context); | 547 delegate()->SetContext(this, root_window, window_context); |
| 548 if (window_context) | 548 if (window_context) |
| 549 current_location_ = delegate()->CenterOfWindow(window_context); | 549 current_location_ = delegate()->CenterOfWindow(window_context); |
| 550 current_target_ = delegate()->GetTargetAt(current_location_); | 550 current_target_ = delegate()->GetTargetAt(current_location_); |
| 551 } | 551 } |
| 552 | 552 |
| 553 void EventGenerator::DispatchKeyEvent(bool is_press, | 553 void EventGenerator::DispatchKeyEvent(bool is_press, |
| 554 ui::KeyboardCode key_code, | 554 ui::KeyboardCode key_code, |
| 555 int flags) { | 555 int flags) { |
| 556 #if defined(OS_WIN) | 556 #if defined(OS_WIN) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 return default_delegate; | 667 return default_delegate; |
| 668 } | 668 } |
| 669 | 669 |
| 670 EventGeneratorDelegate* EventGenerator::delegate() { | 670 EventGeneratorDelegate* EventGenerator::delegate() { |
| 671 return const_cast<EventGeneratorDelegate*>( | 671 return const_cast<EventGeneratorDelegate*>( |
| 672 const_cast<const EventGenerator*>(this)->delegate()); | 672 const_cast<const EventGenerator*>(this)->delegate()); |
| 673 } | 673 } |
| 674 | 674 |
| 675 } // namespace test | 675 } // namespace test |
| 676 } // namespace ui | 676 } // namespace ui |
| OLD | NEW |