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

Unified Diff: ash/root_window_controller_unittest.cc

Issue 19945004: Modal window in user session not blocks user adding screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: ash/root_window_controller_unittest.cc
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc
index d1ced436f3bc89794370120861e25bd084d20d0f..c6781cbbd3c78fff4943de5619283cb65ec56512 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -357,6 +357,55 @@ TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) {
session_modal_widget->GetNativeView()));
}
+TEST_F(RootWindowControllerTest, ModalContainerBlockedSession) {
+ UpdateDisplay("600x600");
+ Shell* shell = Shell::GetInstance();
+ internal::RootWindowController* controller =
+ shell->GetPrimaryRootWindowController();
+ aura::Window* lock_container =
+ Shell::GetContainer(controller->root_window(),
+ internal::kShellWindowId_LockScreenContainer);
+ for (int block_reason = FIRST_BLOCK_REASON;
+ block_reason < NUMBER_OF_BLOCK_REASONS;
+ ++block_reason) {
+ views::Widget* session_modal_widget =
+ CreateModalWidget(gfx::Rect(300, 10, 100, 100));
+ EXPECT_EQ(Shell::GetContainer(controller->root_window(),
+ internal::kShellWindowId_SystemModalContainer)->layout_manager(),
+ controller->GetSystemModalLayoutManager(
+ session_modal_widget->GetNativeView()));
+ EXPECT_EQ(Shell::GetContainer(controller->root_window(),
+ internal::kShellWindowId_SystemModalContainer)->layout_manager(),
+ controller->GetSystemModalLayoutManager(NULL));
+ session_modal_widget->Close();
+
+ BlockUserSession(static_cast<UserSessionBlockReason>(block_reason));
+
+ EXPECT_EQ(Shell::GetContainer(controller->root_window(),
+ internal::kShellWindowId_LockSystemModalContainer)->layout_manager(),
+ controller->GetSystemModalLayoutManager(NULL));
+
+ views::Widget* lock_modal_widget =
+ CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100),
+ lock_container);
+ EXPECT_EQ(Shell::GetContainer(controller->root_window(),
+ internal::kShellWindowId_LockSystemModalContainer)->layout_manager(),
+ controller->GetSystemModalLayoutManager(
+ lock_modal_widget->GetNativeView()));
+
+ session_modal_widget =
+ CreateModalWidget(gfx::Rect(300, 10, 100, 100));
+ EXPECT_EQ(Shell::GetContainer(controller->root_window(),
+ internal::kShellWindowId_SystemModalContainer)->layout_manager(),
+ controller->GetSystemModalLayoutManager(
+ session_modal_widget->GetNativeView()));
+ session_modal_widget->Close();
+
+ lock_modal_widget->Close();
+ UnblockUserSession();
+ }
+}
+
// Test that GetFullscreenWindow() returns a fullscreen window only if the
// fullscreen window is in the active workspace.
TEST_F(RootWindowControllerTest, GetFullscreenWindow) {
@@ -403,21 +452,16 @@ TEST_F(RootWindowControllerTest, FocusBlockedWindow) {
CreateTestWidget(gfx::Rect(0, 0, 100, 100))->GetNativeView();
session_window->Show();
- // Lock screen.
- Shell::GetInstance()->session_state_delegate()->LockScreen();
- lock_window->Focus();
- EXPECT_TRUE(lock_window->HasFocus());
- session_window->Focus();
- EXPECT_FALSE(session_window->HasFocus());
- Shell::GetInstance()->session_state_delegate()->UnlockScreen();
-
- // Session not started yet.
- SetSessionStarted(false);
- lock_window->Focus();
- EXPECT_TRUE(lock_window->HasFocus());
- session_window->Focus();
- EXPECT_FALSE(session_window->HasFocus());
- SetSessionStarted(true);
+ for (int block_reason = FIRST_BLOCK_REASON;
+ block_reason < NUMBER_OF_BLOCK_REASONS;
+ ++block_reason) {
+ BlockUserSession(static_cast<UserSessionBlockReason>(block_reason));
+ lock_window->Focus();
+ EXPECT_TRUE(lock_window->HasFocus());
+ session_window->Focus();
+ EXPECT_FALSE(session_window->HasFocus());
+ UnblockUserSession();
+ }
}
} // namespace test

Powered by Google App Engine
This is Rietveld 408576698