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/common/session/session_controller.h" | 9 #include "ash/common/session/session_controller.h" |
10 #include "ash/common/system/tray/system_tray_delegate.h" | 10 #include "ash/common/system/tray/system_tray_delegate.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 Shell::Get()->system_tray_delegate()->GetUserLoginStatus()); | 390 Shell::Get()->system_tray_delegate()->GetUserLoginStatus()); |
391 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), | 391 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), |
392 controller->GetSystemModalLayoutManager(NULL)); | 392 controller->GetSystemModalLayoutManager(NULL)); |
393 | 393 |
394 views::Widget* session_modal_widget = | 394 views::Widget* session_modal_widget = |
395 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); | 395 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
396 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), | 396 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), |
397 controller->GetSystemModalLayoutManager( | 397 controller->GetSystemModalLayoutManager( |
398 WmWindow::Get(session_modal_widget->GetNativeWindow()))); | 398 WmWindow::Get(session_modal_widget->GetNativeWindow()))); |
399 | 399 |
400 wm_shell->session_controller()->LockScreenAndFlushForTest(); | 400 Shell::Get()->session_controller()->LockScreenAndFlushForTest(); |
401 EXPECT_EQ(LoginStatus::LOCKED, | 401 EXPECT_EQ(LoginStatus::LOCKED, |
402 Shell::Get()->system_tray_delegate()->GetUserLoginStatus()); | 402 Shell::Get()->system_tray_delegate()->GetUserLoginStatus()); |
403 EXPECT_EQ( | 403 EXPECT_EQ( |
404 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), | 404 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), |
405 controller->GetSystemModalLayoutManager(nullptr)); | 405 controller->GetSystemModalLayoutManager(nullptr)); |
406 | 406 |
407 aura::Window* lock_container = | 407 aura::Window* lock_container = |
408 controller->GetContainer(kShellWindowId_LockScreenContainer); | 408 controller->GetContainer(kShellWindowId_LockScreenContainer); |
409 views::Widget* lock_modal_widget = | 409 views::Widget* lock_modal_widget = |
410 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); | 410 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); |
411 EXPECT_EQ( | 411 EXPECT_EQ( |
412 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), | 412 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), |
413 controller->GetSystemModalLayoutManager( | 413 controller->GetSystemModalLayoutManager( |
414 WmWindow::Get(lock_modal_widget->GetNativeWindow()))); | 414 WmWindow::Get(lock_modal_widget->GetNativeWindow()))); |
415 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), | 415 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), |
416 controller->GetSystemModalLayoutManager( | 416 controller->GetSystemModalLayoutManager( |
417 WmWindow::Get(session_modal_widget->GetNativeWindow()))); | 417 WmWindow::Get(session_modal_widget->GetNativeWindow()))); |
418 | 418 |
419 GetSessionControllerClient()->UnlockScreen(); | 419 GetSessionControllerClient()->UnlockScreen(); |
420 } | 420 } |
421 | 421 |
422 TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) { | 422 TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) { |
423 UpdateDisplay("600x600"); | 423 UpdateDisplay("600x600"); |
424 | 424 |
425 // Configure login screen environment. | 425 // Configure login screen environment. |
426 SessionController* session_controller = WmShell::Get()->session_controller(); | 426 SessionController* session_controller = Shell::Get()->session_controller(); |
427 SetUserLoggedIn(false); | 427 SetUserLoggedIn(false); |
428 EXPECT_EQ(LoginStatus::NOT_LOGGED_IN, | 428 EXPECT_EQ(LoginStatus::NOT_LOGGED_IN, |
429 Shell::Get()->system_tray_delegate()->GetUserLoginStatus()); | 429 Shell::Get()->system_tray_delegate()->GetUserLoginStatus()); |
430 EXPECT_EQ(0, session_controller->NumberOfLoggedInUsers()); | 430 EXPECT_EQ(0, session_controller->NumberOfLoggedInUsers()); |
431 EXPECT_FALSE(session_controller->IsActiveUserSessionStarted()); | 431 EXPECT_FALSE(session_controller->IsActiveUserSessionStarted()); |
432 | 432 |
433 RootWindowController* controller = | 433 RootWindowController* controller = |
434 WmShell::Get()->GetPrimaryRootWindowController(); | 434 WmShell::Get()->GetPrimaryRootWindowController(); |
435 EXPECT_EQ( | 435 EXPECT_EQ( |
436 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), | 436 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 | 997 |
998 if (!keyboard::IsKeyboardOverscrollEnabled()) { | 998 if (!keyboard::IsKeyboardOverscrollEnabled()) { |
999 gfx::Rect after = | 999 gfx::Rect after = |
1000 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); | 1000 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); |
1001 EXPECT_LT(after, before); | 1001 EXPECT_LT(after, before); |
1002 } | 1002 } |
1003 | 1003 |
1004 // Mock a login user profile change to reinitialize the keyboard. | 1004 // Mock a login user profile change to reinitialize the keyboard. |
1005 mojom::SessionInfoPtr info = mojom::SessionInfo::New(); | 1005 mojom::SessionInfoPtr info = mojom::SessionInfo::New(); |
1006 info->state = session_manager::SessionState::ACTIVE; | 1006 info->state = session_manager::SessionState::ACTIVE; |
1007 WmShell::Get()->session_controller()->SetSessionInfo(std::move(info)); | 1007 Shell::Get()->session_controller()->SetSessionInfo(std::move(info)); |
1008 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().work_area(), | 1008 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().work_area(), |
1009 before); | 1009 before); |
1010 } | 1010 } |
1011 | 1011 |
1012 // Ensure that system modal dialogs do not block events targeted at the virtual | 1012 // Ensure that system modal dialogs do not block events targeted at the virtual |
1013 // keyboard. | 1013 // keyboard. |
1014 TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) { | 1014 TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) { |
1015 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 1015 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
1016 aura::Window* keyboard_container = | 1016 aura::Window* keyboard_container = |
1017 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); | 1017 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( | 1240 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( |
1241 gfx::Rect(0, 400, 800, 200)); | 1241 gfx::Rect(0, 400, 800, 200)); |
1242 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); | 1242 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); |
1243 | 1243 |
1244 UpdateDisplay("600x800"); | 1244 UpdateDisplay("600x800"); |
1245 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); | 1245 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); |
1246 } | 1246 } |
1247 | 1247 |
1248 } // namespace test | 1248 } // namespace test |
1249 } // namespace ash | 1249 } // namespace ash |
OLD | NEW |