Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 2625733003: Re-reland: chromeos: Fix shelf appearing at login screen under mash (Closed)
Patch Set: rebase, fix conflict with sky Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_shell.h" 17 #include "ash/common/wm_shell.h"
17 #include "ash/common/wm_window.h" 18 #include "ash/common/wm_window.h"
18 #include "ash/public/cpp/shell_window_ids.h" 19 #include "ash/public/cpp/shell_window_ids.h"
19 #include "ash/root_window_controller.h"
20 #include "ash/shell.h" 20 #include "ash/shell.h"
21 #include "ash/test/ash_md_test_base.h" 21 #include "ash/test/ash_md_test_base.h"
22 #include "ash/test/ash_test_base.h" 22 #include "ash/test/ash_test_base.h"
23 #include "ash/wm/window_properties.h" 23 #include "ash/wm/window_properties.h"
24 #include "ash/wm/window_state_aura.h" 24 #include "ash/wm/window_state_aura.h"
25 #include "ash/wm/window_util.h" 25 #include "ash/wm/window_util.h"
26 #include "base/command_line.h" 26 #include "base/command_line.h"
27 #include "ui/aura/client/focus_change_observer.h" 27 #include "ui/aura/client/focus_change_observer.h"
28 #include "ui/aura/client/focus_client.h" 28 #include "ui/aura/client/focus_client.h"
29 #include "ui/aura/client/window_parenting_client.h" 29 #include "ui/aura/client/window_parenting_client.h"
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 // GetWindowContainer(). 963 // GetWindowContainer().
964 TEST_F(VirtualKeyboardRootWindowControllerTest, 964 TEST_F(VirtualKeyboardRootWindowControllerTest,
965 DeleteOldContainerOnVirtualKeyboardInit) { 965 DeleteOldContainerOnVirtualKeyboardInit) {
966 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 966 aura::Window* root_window = Shell::GetPrimaryRootWindow();
967 aura::Window* keyboard_container = 967 aura::Window* keyboard_container =
968 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); 968 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer);
969 ASSERT_TRUE(keyboard_container); 969 ASSERT_TRUE(keyboard_container);
970 // Track the keyboard container window. 970 // Track the keyboard container window.
971 aura::WindowTracker tracker; 971 aura::WindowTracker tracker;
972 tracker.Add(keyboard_container); 972 tracker.Add(keyboard_container);
973 // Mock a login user profile change to reinitialize the keyboard. 973 // Reinitialize the keyboard.
974 Shell::GetInstance()->OnLoginUserProfilePrepared(); 974 Shell::GetInstance()->CreateKeyboard();
975 // keyboard_container should no longer be present. 975 // keyboard_container should no longer be present.
976 EXPECT_FALSE(tracker.Contains(keyboard_container)); 976 EXPECT_FALSE(tracker.Contains(keyboard_container));
977 } 977 }
978 978
979 // Test for crbug.com/342524. After user login, the work space should restore to 979 // Test for crbug.com/342524. After user login, the work space should restore to
980 // full screen. 980 // full screen.
981 TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) { 981 TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) {
982 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 982 aura::Window* root_window = Shell::GetPrimaryRootWindow();
983 aura::Window* keyboard_container = 983 aura::Window* keyboard_container =
984 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); 984 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer);
(...skipping 13 matching lines...) Expand all
998 // Notify keyboard bounds changing. 998 // Notify keyboard bounds changing.
999 controller->NotifyKeyboardBoundsChanging(keyboard_container->bounds()); 999 controller->NotifyKeyboardBoundsChanging(keyboard_container->bounds());
1000 1000
1001 if (!keyboard::IsKeyboardOverscrollEnabled()) { 1001 if (!keyboard::IsKeyboardOverscrollEnabled()) {
1002 gfx::Rect after = 1002 gfx::Rect after =
1003 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); 1003 display::Screen::GetScreen()->GetPrimaryDisplay().work_area();
1004 EXPECT_LT(after, before); 1004 EXPECT_LT(after, before);
1005 } 1005 }
1006 1006
1007 // Mock a login user profile change to reinitialize the keyboard. 1007 // Mock a login user profile change to reinitialize the keyboard.
1008 Shell::GetInstance()->OnLoginUserProfilePrepared(); 1008 mojom::SessionInfoPtr info = mojom::SessionInfo::New();
1009 info->state = session_manager::SessionState::ACTIVE;
1010 WmShell::Get()->session_controller()->SetSessionInfo(std::move(info));
1009 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().work_area(), 1011 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().work_area(),
1010 before); 1012 before);
1011 } 1013 }
1012 1014
1013 // Ensure that system modal dialogs do not block events targeted at the virtual 1015 // Ensure that system modal dialogs do not block events targeted at the virtual
1014 // keyboard. 1016 // keyboard.
1015 TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) { 1017 TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) {
1016 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 1018 aura::Window* root_window = Shell::GetPrimaryRootWindow();
1017 aura::Window* keyboard_container = 1019 aura::Window* keyboard_container =
1018 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); 1020 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( 1243 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds(
1242 gfx::Rect(0, 400, 800, 200)); 1244 gfx::Rect(0, 400, 800, 200));
1243 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); 1245 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString());
1244 1246
1245 UpdateDisplay("600x800"); 1247 UpdateDisplay("600x800");
1246 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); 1248 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString());
1247 } 1249 }
1248 1250
1249 } // namespace test 1251 } // namespace test
1250 } // namespace ash 1252 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698