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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
744 aura::Window* keyboard_window = controller->proxy()->GetKeyboardWindow(); | 744 aura::Window* keyboard_window = controller->proxy()->GetKeyboardWindow(); |
745 keyboard_container->AddChild(keyboard_window); | 745 keyboard_container->AddChild(keyboard_window); |
746 keyboard_window->set_owned_by_parent(false); | 746 keyboard_window->set_owned_by_parent(false); |
747 keyboard_window->SetBounds(keyboard::KeyboardBoundsFromWindowBounds( | 747 keyboard_window->SetBounds(keyboard::KeyboardBoundsFromWindowBounds( |
748 keyboard_container->bounds(), 100)); | 748 keyboard_container->bounds(), 100)); |
749 keyboard_window->Show(); | 749 keyboard_window->Show(); |
750 | 750 |
751 gfx::Rect before = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); | 751 gfx::Rect before = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); |
752 | 752 |
753 // Notify keyboard bounds changing. | 753 // Notify keyboard bounds changing. |
754 controller->NotifyKeyboardBoundsChanging( | 754 controller->NotifyKeyboardBoundsChanging(keyboard_container->bounds()); |
755 controller->proxy()->GetKeyboardWindow()->bounds()); | |
756 | 755 |
757 if (!keyboard::IsKeyboardOverscrollEnabled()) { | 756 if (!keyboard::IsKeyboardOverscrollEnabled()) { |
758 gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); | 757 gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); |
759 EXPECT_LT(after, before); | 758 EXPECT_LT(after, before); |
760 } | 759 } |
761 | 760 |
762 // Mock a login user profile change to reinitialize the keyboard. | 761 // Mock a login user profile change to reinitialize the keyboard. |
763 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); | 762 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); |
764 EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before); | 763 EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before); |
765 } | 764 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
830 keyboard_container->Show(); | 829 keyboard_container->Show(); |
831 | 830 |
832 const int keyboard_height = 100; | 831 const int keyboard_height = 100; |
833 aura::Window* keyboard_window =proxy->GetKeyboardWindow(); | 832 aura::Window* keyboard_window =proxy->GetKeyboardWindow(); |
834 keyboard_container->AddChild(keyboard_window); | 833 keyboard_container->AddChild(keyboard_window); |
835 keyboard_window->set_owned_by_parent(false); | 834 keyboard_window->set_owned_by_parent(false); |
836 keyboard_window->SetBounds(keyboard::KeyboardBoundsFromWindowBounds( | 835 keyboard_window->SetBounds(keyboard::KeyboardBoundsFromWindowBounds( |
837 keyboard_container->bounds(), keyboard_height)); | 836 keyboard_container->bounds(), keyboard_height)); |
838 | 837 |
839 proxy->EnsureCaretInWorkArea(); | 838 proxy->EnsureCaretInWorkArea(); |
840 ASSERT_EQ(keyboard_container->bounds().width(), | 839 ASSERT_EQ(root_window->bounds().width(), |
841 text_input_client.visible_rect().width()); | 840 text_input_client.visible_rect().width()); |
842 ASSERT_EQ(keyboard_container->bounds().height() - keyboard_height, | 841 ASSERT_EQ(root_window->bounds().height() - keyboard_height, |
843 text_input_client.visible_rect().height()); | 842 text_input_client.visible_rect().height()); |
sadrul
2015/03/20 17:32:16
Not sure what this test is checking anymore. Can y
bshe
2015/03/27 16:29:16
I think it is still testing the visible_rect of te
| |
844 | 843 |
845 if (switches::IsTextInputFocusManagerEnabled()) { | 844 if (switches::IsTextInputFocusManagerEnabled()) { |
846 ui::TextInputFocusManager::GetInstance()->BlurTextInputClient( | 845 ui::TextInputFocusManager::GetInstance()->BlurTextInputClient( |
847 &text_input_client); | 846 &text_input_client); |
848 } else { | 847 } else { |
849 input_method->SetFocusedTextInputClient(NULL); | 848 input_method->SetFocusedTextInputClient(NULL); |
850 } | 849 } |
851 } | 850 } |
852 | 851 |
853 // Tests that the virtual keyboard does not block context menus. The virtual | 852 // Tests that the virtual keyboard does not block context menus. The virtual |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
945 #endif | 944 #endif |
946 | 945 |
947 // Tests that the virtual keyboard correctly resizes with a change to display | 946 // Tests that the virtual keyboard correctly resizes with a change to display |
948 // orientation. See crbug/417612. | 947 // orientation. See crbug/417612. |
949 TEST_F(VirtualKeyboardRootWindowControllerTest, MAYBE_DisplayRotation) { | 948 TEST_F(VirtualKeyboardRootWindowControllerTest, MAYBE_DisplayRotation) { |
950 UpdateDisplay("800x600"); | 949 UpdateDisplay("800x600"); |
951 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 950 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
952 aura::Window* keyboard_container = | 951 aura::Window* keyboard_container = |
953 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); | 952 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); |
954 ASSERT_TRUE(keyboard_container); | 953 ASSERT_TRUE(keyboard_container); |
954 keyboard::KeyboardController::GetInstance()->ShowKeyboard(false); | |
955 keyboard_container->Show(); | 955 keyboard_container->Show(); |
956 EXPECT_EQ("0,0 800x600", keyboard_container->bounds().ToString()); | 956 EXPECT_EQ("0,600 800x0", keyboard_container->bounds().ToString()); |
957 | 957 |
958 UpdateDisplay("600x800"); | 958 UpdateDisplay("600x800"); |
959 EXPECT_EQ("0,0 600x800", keyboard_container->bounds().ToString()); | 959 EXPECT_EQ("0,800 600x0", keyboard_container->bounds().ToString()); |
sadrul
2015/03/20 17:32:17
Why the change in this test?
bshe
2015/03/27 16:29:16
After a screen rotation, we want to make sure that
| |
960 } | 960 } |
961 | 961 |
962 } // namespace test | 962 } // namespace test |
963 } // namespace ash | 963 } // namespace ash |
OLD | NEW |