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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 if (window_context) | 561 if (window_context) |
562 current_location_ = delegate()->CenterOfWindow(window_context); | 562 current_location_ = delegate()->CenterOfWindow(window_context); |
563 current_target_ = delegate()->GetTargetAt(current_location_); | 563 current_target_ = delegate()->GetTargetAt(current_location_); |
564 } | 564 } |
565 | 565 |
566 void EventGenerator::DispatchKeyEvent(bool is_press, | 566 void EventGenerator::DispatchKeyEvent(bool is_press, |
567 ui::KeyboardCode key_code, | 567 ui::KeyboardCode key_code, |
568 int flags) { | 568 int flags) { |
569 #if defined(OS_WIN) | 569 #if defined(OS_WIN) |
570 UINT key_press = WM_KEYDOWN; | 570 UINT key_press = WM_KEYDOWN; |
571 uint16 character = ui::GetCharacterFromKeyCode(key_code, flags); | 571 uint16 character = ui::DomCodeToUsLayoutCharacter( |
| 572 ui::UsLayoutKeyboardCodeToDomCode(key_code), flags); |
572 if (is_press && character) { | 573 if (is_press && character) { |
573 MSG native_event = { NULL, WM_KEYDOWN, key_code, 0 }; | 574 MSG native_event = { NULL, WM_KEYDOWN, key_code, 0 }; |
574 TestKeyEvent keyev(native_event, flags); | 575 TestKeyEvent keyev(native_event, flags); |
575 Dispatch(&keyev); | 576 Dispatch(&keyev); |
576 // On Windows, WM_KEYDOWN event is followed by WM_CHAR with a character | 577 // On Windows, WM_KEYDOWN event is followed by WM_CHAR with a character |
577 // if the key event cooresponds to a real character. | 578 // if the key event cooresponds to a real character. |
578 key_press = WM_CHAR; | 579 key_press = WM_CHAR; |
579 key_code = static_cast<ui::KeyboardCode>(character); | 580 key_code = static_cast<ui::KeyboardCode>(character); |
580 } | 581 } |
581 MSG native_event = | 582 MSG native_event = |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 return default_delegate; | 687 return default_delegate; |
687 } | 688 } |
688 | 689 |
689 EventGeneratorDelegate* EventGenerator::delegate() { | 690 EventGeneratorDelegate* EventGenerator::delegate() { |
690 return const_cast<EventGeneratorDelegate*>( | 691 return const_cast<EventGeneratorDelegate*>( |
691 const_cast<const EventGenerator*>(this)->delegate()); | 692 const_cast<const EventGenerator*>(this)->delegate()); |
692 } | 693 } |
693 | 694 |
694 } // namespace test | 695 } // namespace test |
695 } // namespace ui | 696 } // namespace ui |
OLD | NEW |