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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| 11 #include "ash/common/session/session_controller.h" |
11 #include "ash/common/session/session_state_delegate.h" | 12 #include "ash/common/session/session_state_delegate.h" |
12 #include "ash/common/system/tray/system_tray_delegate.h" | 13 #include "ash/common/system/tray/system_tray_delegate.h" |
13 #include "ash/common/wm/system_modal_container_layout_manager.h" | 14 #include "ash/common/wm/system_modal_container_layout_manager.h" |
14 #include "ash/common/wm/window_state.h" | 15 #include "ash/common/wm/window_state.h" |
15 #include "ash/common/wm_lookup.h" | 16 #include "ash/common/wm_lookup.h" |
16 #include "ash/common/wm_root_window_controller.h" | 17 #include "ash/common/wm_root_window_controller.h" |
17 #include "ash/common/wm_shell.h" | 18 #include "ash/common/wm_shell.h" |
18 #include "ash/common/wm_window.h" | 19 #include "ash/common/wm_window.h" |
19 #include "ash/public/cpp/shell_window_ids.h" | 20 #include "ash/public/cpp/shell_window_ids.h" |
| 21 #include "ash/public/interfaces/session_controller.mojom.h" |
20 #include "ash/shell.h" | 22 #include "ash/shell.h" |
21 #include "ash/test/ash_md_test_base.h" | 23 #include "ash/test/ash_md_test_base.h" |
22 #include "ash/test/ash_test_base.h" | 24 #include "ash/test/ash_test_base.h" |
23 #include "ash/wm/window_properties.h" | 25 #include "ash/wm/window_properties.h" |
24 #include "ash/wm/window_state_aura.h" | 26 #include "ash/wm/window_state_aura.h" |
25 #include "ash/wm/window_util.h" | 27 #include "ash/wm/window_util.h" |
26 #include "base/command_line.h" | 28 #include "base/command_line.h" |
27 #include "ui/aura/client/focus_change_observer.h" | 29 #include "ui/aura/client/focus_change_observer.h" |
28 #include "ui/aura/client/focus_client.h" | 30 #include "ui/aura/client/focus_client.h" |
29 #include "ui/aura/client/window_parenting_client.h" | 31 #include "ui/aura/client/window_parenting_client.h" |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 // GetWindowContainer(). | 970 // GetWindowContainer(). |
969 TEST_F(VirtualKeyboardRootWindowControllerTest, | 971 TEST_F(VirtualKeyboardRootWindowControllerTest, |
970 DeleteOldContainerOnVirtualKeyboardInit) { | 972 DeleteOldContainerOnVirtualKeyboardInit) { |
971 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 973 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
972 aura::Window* keyboard_container = | 974 aura::Window* keyboard_container = |
973 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); | 975 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); |
974 ASSERT_TRUE(keyboard_container); | 976 ASSERT_TRUE(keyboard_container); |
975 // Track the keyboard container window. | 977 // Track the keyboard container window. |
976 aura::WindowTracker tracker; | 978 aura::WindowTracker tracker; |
977 tracker.Add(keyboard_container); | 979 tracker.Add(keyboard_container); |
978 // Mock a login user profile change to reinitialize the keyboard. | 980 // Reinitialize the keyboard. |
979 Shell::GetInstance()->OnLoginUserProfilePrepared(); | 981 Shell::GetInstance()->CreateKeyboard(); |
980 // keyboard_container should no longer be present. | 982 // keyboard_container should no longer be present. |
981 EXPECT_FALSE(tracker.Contains(keyboard_container)); | 983 EXPECT_FALSE(tracker.Contains(keyboard_container)); |
982 } | 984 } |
983 | 985 |
984 // Test for crbug.com/342524. After user login, the work space should restore to | 986 // Test for crbug.com/342524. After user login, the work space should restore to |
985 // full screen. | 987 // full screen. |
986 TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) { | 988 TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) { |
987 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 989 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
988 aura::Window* keyboard_container = | 990 aura::Window* keyboard_container = |
989 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); | 991 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); |
(...skipping 13 matching lines...) Expand all Loading... |
1003 // Notify keyboard bounds changing. | 1005 // Notify keyboard bounds changing. |
1004 controller->NotifyKeyboardBoundsChanging(keyboard_container->bounds()); | 1006 controller->NotifyKeyboardBoundsChanging(keyboard_container->bounds()); |
1005 | 1007 |
1006 if (!keyboard::IsKeyboardOverscrollEnabled()) { | 1008 if (!keyboard::IsKeyboardOverscrollEnabled()) { |
1007 gfx::Rect after = | 1009 gfx::Rect after = |
1008 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); | 1010 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); |
1009 EXPECT_LT(after, before); | 1011 EXPECT_LT(after, before); |
1010 } | 1012 } |
1011 | 1013 |
1012 // Mock a login user profile change to reinitialize the keyboard. | 1014 // Mock a login user profile change to reinitialize the keyboard. |
1013 Shell::GetInstance()->OnLoginUserProfilePrepared(); | 1015 mojom::SessionInfoPtr info = mojom::SessionInfo::New(); |
| 1016 info->state = session_manager::SessionState::ACTIVE; |
| 1017 WmShell::Get()->session_controller()->SetSessionInfo(std::move(info)); |
1014 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().work_area(), | 1018 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().work_area(), |
1015 before); | 1019 before); |
1016 } | 1020 } |
1017 | 1021 |
1018 // Ensure that system modal dialogs do not block events targeted at the virtual | 1022 // Ensure that system modal dialogs do not block events targeted at the virtual |
1019 // keyboard. | 1023 // keyboard. |
1020 TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) { | 1024 TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) { |
1021 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 1025 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
1022 aura::Window* keyboard_container = | 1026 aura::Window* keyboard_container = |
1023 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); | 1027 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( | 1257 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( |
1254 gfx::Rect(0, 400, 800, 200)); | 1258 gfx::Rect(0, 400, 800, 200)); |
1255 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); | 1259 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); |
1256 | 1260 |
1257 UpdateDisplay("600x800"); | 1261 UpdateDisplay("600x800"); |
1258 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); | 1262 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); |
1259 } | 1263 } |
1260 | 1264 |
1261 } // namespace test | 1265 } // namespace test |
1262 } // namespace ash | 1266 } // namespace ash |
OLD | NEW |