| 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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 | 585 |
| 586 void EventGenerator::Init(gfx::NativeWindow root_window, | 586 void EventGenerator::Init(gfx::NativeWindow root_window, |
| 587 gfx::NativeWindow window_context) { | 587 gfx::NativeWindow window_context) { |
| 588 ui::SetEventTickClockForTesting(base::MakeUnique<TestTickClock>()); | 588 ui::SetEventTickClockForTesting(base::MakeUnique<TestTickClock>()); |
| 589 delegate()->SetContext(this, root_window, window_context); | 589 delegate()->SetContext(this, root_window, window_context); |
| 590 if (window_context) | 590 if (window_context) |
| 591 current_location_ = delegate()->CenterOfWindow(window_context); | 591 current_location_ = delegate()->CenterOfWindow(window_context); |
| 592 current_target_ = delegate()->GetTargetAt(current_location_); | 592 current_target_ = delegate()->GetTargetAt(current_location_); |
| 593 touch_pointer_details_ = | 593 touch_pointer_details_ = |
| 594 PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1.0, 1.0, | 594 PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1.0, 1.0, |
| 595 std::numeric_limits<float>::quiet_NaN(), 0.0, 0.0); | 595 std::numeric_limits<float>::quiet_NaN(), 0.0, 0.0, 0.0, 0); |
| 596 } | 596 } |
| 597 | 597 |
| 598 void EventGenerator::DispatchKeyEvent(bool is_press, | 598 void EventGenerator::DispatchKeyEvent(bool is_press, |
| 599 ui::KeyboardCode key_code, | 599 ui::KeyboardCode key_code, |
| 600 int flags) { | 600 int flags) { |
| 601 #if defined(OS_WIN) | 601 #if defined(OS_WIN) |
| 602 UINT key_press = WM_KEYDOWN; | 602 UINT key_press = WM_KEYDOWN; |
| 603 uint16_t character = ui::DomCodeToUsLayoutCharacter( | 603 uint16_t character = ui::DomCodeToUsLayoutCharacter( |
| 604 ui::UsLayoutKeyboardCodeToDomCode(key_code), flags); | 604 ui::UsLayoutKeyboardCodeToDomCode(key_code), flags); |
| 605 if (is_press && character) { | 605 if (is_press && character) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 return default_delegate; | 717 return default_delegate; |
| 718 } | 718 } |
| 719 | 719 |
| 720 EventGeneratorDelegate* EventGenerator::delegate() { | 720 EventGeneratorDelegate* EventGenerator::delegate() { |
| 721 return const_cast<EventGeneratorDelegate*>( | 721 return const_cast<EventGeneratorDelegate*>( |
| 722 const_cast<const EventGenerator*>(this)->delegate()); | 722 const_cast<const EventGenerator*>(this)->delegate()); |
| 723 } | 723 } |
| 724 | 724 |
| 725 } // namespace test | 725 } // namespace test |
| 726 } // namespace ui | 726 } // namespace ui |
| OLD | NEW |