| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/session/session_state_delegate.h" | 7 #include "ash/session/session_state_delegate.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
| 22 #include "ui/aura/test/event_generator.h" | 22 #include "ui/aura/test/event_generator.h" |
| 23 #include "ui/aura/test/test_window_delegate.h" | 23 #include "ui/aura/test/test_window_delegate.h" |
| 24 #include "ui/aura/test/test_windows.h" | 24 #include "ui/aura/test/test_windows.h" |
| 25 #include "ui/aura/window.h" | 25 #include "ui/aura/window.h" |
| 26 #include "ui/aura/window_event_dispatcher.h" | 26 #include "ui/aura/window_event_dispatcher.h" |
| 27 #include "ui/aura/window_tracker.h" | 27 #include "ui/aura/window_tracker.h" |
| 28 #include "ui/base/ime/dummy_text_input_client.h" | 28 #include "ui/base/ime/dummy_text_input_client.h" |
| 29 #include "ui/base/ime/input_method.h" | 29 #include "ui/base/ime/input_method.h" |
| 30 #include "ui/base/ime/text_input_client.h" | 30 #include "ui/base/ime/text_input_client.h" |
| 31 #include "ui/base/ime/text_input_focus_manager.h" |
| 32 #include "ui/base/ui_base_switches_util.h" |
| 31 #include "ui/events/test/test_event_handler.h" | 33 #include "ui/events/test/test_event_handler.h" |
| 32 #include "ui/keyboard/keyboard_controller_proxy.h" | 34 #include "ui/keyboard/keyboard_controller_proxy.h" |
| 33 #include "ui/keyboard/keyboard_switches.h" | 35 #include "ui/keyboard/keyboard_switches.h" |
| 34 #include "ui/keyboard/keyboard_util.h" | 36 #include "ui/keyboard/keyboard_util.h" |
| 35 #include "ui/views/controls/menu/menu_controller.h" | 37 #include "ui/views/controls/menu/menu_controller.h" |
| 36 #include "ui/views/widget/widget.h" | 38 #include "ui/views/widget/widget.h" |
| 37 #include "ui/views/widget/widget_delegate.h" | 39 #include "ui/views/widget/widget_delegate.h" |
| 38 | 40 |
| 39 using aura::Window; | 41 using aura::Window; |
| 40 using views::Widget; | 42 using views::Widget; |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 // Ensure that the visible area for scrolling the text caret excludes the | 800 // Ensure that the visible area for scrolling the text caret excludes the |
| 799 // region occluded by the on-screen keyboard. | 801 // region occluded by the on-screen keyboard. |
| 800 TEST_F(VirtualKeyboardRootWindowControllerTest, EnsureCaretInWorkArea) { | 802 TEST_F(VirtualKeyboardRootWindowControllerTest, EnsureCaretInWorkArea) { |
| 801 keyboard::KeyboardController* keyboard_controller = | 803 keyboard::KeyboardController* keyboard_controller = |
| 802 keyboard::KeyboardController::GetInstance(); | 804 keyboard::KeyboardController::GetInstance(); |
| 803 keyboard::KeyboardControllerProxy* proxy = keyboard_controller->proxy(); | 805 keyboard::KeyboardControllerProxy* proxy = keyboard_controller->proxy(); |
| 804 | 806 |
| 805 MockTextInputClient text_input_client; | 807 MockTextInputClient text_input_client; |
| 806 ui::InputMethod* input_method = proxy->GetInputMethod(); | 808 ui::InputMethod* input_method = proxy->GetInputMethod(); |
| 807 ASSERT_TRUE(input_method); | 809 ASSERT_TRUE(input_method); |
| 808 input_method->SetFocusedTextInputClient(&text_input_client); | 810 if (switches::IsTextInputFocusManagerEnabled()) { |
| 811 ui::TextInputFocusManager::GetInstance()->FocusTextInputClient( |
| 812 &text_input_client); |
| 813 } else { |
| 814 input_method->SetFocusedTextInputClient(&text_input_client); |
| 815 } |
| 809 | 816 |
| 810 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 817 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
| 811 aura::Window* keyboard_container = | 818 aura::Window* keyboard_container = |
| 812 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); | 819 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); |
| 813 ASSERT_TRUE(keyboard_container); | 820 ASSERT_TRUE(keyboard_container); |
| 814 keyboard_container->Show(); | 821 keyboard_container->Show(); |
| 815 | 822 |
| 816 const int keyboard_height = 100; | 823 const int keyboard_height = 100; |
| 817 aura::Window* keyboard_window =proxy->GetKeyboardWindow(); | 824 aura::Window* keyboard_window =proxy->GetKeyboardWindow(); |
| 818 keyboard_container->AddChild(keyboard_window); | 825 keyboard_container->AddChild(keyboard_window); |
| 819 keyboard_window->set_owned_by_parent(false); | 826 keyboard_window->set_owned_by_parent(false); |
| 820 keyboard_window->SetBounds(keyboard::KeyboardBoundsFromWindowBounds( | 827 keyboard_window->SetBounds(keyboard::KeyboardBoundsFromWindowBounds( |
| 821 keyboard_container->bounds(), keyboard_height)); | 828 keyboard_container->bounds(), keyboard_height)); |
| 822 | 829 |
| 823 proxy->EnsureCaretInWorkArea(); | 830 proxy->EnsureCaretInWorkArea(); |
| 824 ASSERT_EQ(keyboard_container->bounds().width(), | 831 ASSERT_EQ(keyboard_container->bounds().width(), |
| 825 text_input_client.visible_rect().width()); | 832 text_input_client.visible_rect().width()); |
| 826 ASSERT_EQ(keyboard_container->bounds().height() - keyboard_height, | 833 ASSERT_EQ(keyboard_container->bounds().height() - keyboard_height, |
| 827 text_input_client.visible_rect().height()); | 834 text_input_client.visible_rect().height()); |
| 835 |
| 836 if (switches::IsTextInputFocusManagerEnabled()) { |
| 837 ui::TextInputFocusManager::GetInstance()->BlurTextInputClient( |
| 838 &text_input_client); |
| 839 } else { |
| 840 input_method->SetFocusedTextInputClient(NULL); |
| 841 } |
| 828 } | 842 } |
| 829 | 843 |
| 830 } // namespace test | 844 } // namespace test |
| 831 } // namespace ash | 845 } // namespace ash |
| OLD | NEW |