Index: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc |
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc |
index 29da872897688d5f2cddc05d334c2809e56820b9..e83305fea4c12745e8a253298727b24c93272674 100644 |
--- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc |
+++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc |
@@ -7,6 +7,8 @@ |
#include "ash/test/ash_test_base.h" |
#include "ash/test/test_session_state_delegate.h" |
#include "ash/test/test_shell_delegate.h" |
+#include "ash/wm/maximize_mode/maximize_mode_controller.h" |
+#include "ash/wm/maximize_mode/maximize_mode_window_manager.h" |
#include "ash/wm/window_state.h" |
#include "ash/wm/wm_event.h" |
#include "base/command_line.h" |
@@ -130,6 +132,19 @@ class MultiUserWindowManagerChromeOSTest : public AshTestBase { |
window); |
} |
+ // Create a maximize mode window manager. |
+ ash::MaximizeModeWindowManager* CreateMaximizeModeWindowManager() { |
+ EXPECT_FALSE(maximize_mode_window_manager()); |
+ Shell::GetInstance()->maximize_mode_controller()-> |
+ EnableMaximizeModeWindowManager(true); |
+ return maximize_mode_window_manager(); |
+ } |
+ |
+ ash::MaximizeModeWindowManager* maximize_mode_window_manager() { |
+ return Shell::GetInstance()->maximize_mode_controller()-> |
+ maximize_mode_window_manager_.get(); |
+ } |
+ |
private: |
// These get created for each session. |
std::vector<aura::Window*> window_; |
@@ -140,6 +155,9 @@ class MultiUserWindowManagerChromeOSTest : public AshTestBase { |
// The session state delegate. |
ash::test::TestSessionStateDelegate* session_state_delegate_; |
+ // The maximized window manager (if enabled). |
+ scoped_ptr<MaximizeModeWindowManager> maximize_mode_window_manager_; |
+ |
DISALLOW_COPY_AND_ASSIGN(MultiUserWindowManagerChromeOSTest); |
}; |
@@ -638,6 +656,30 @@ TEST_F(MultiUserWindowManagerChromeOSTest, PreserveInitialVisibility) { |
EXPECT_EQ("H[A,B], H[A,B], S[B,A], H[B,A]", GetStatus()); |
} |
+// Test that in case of an activated maximize mode, windows from other users get |
+// maximized after a user switch. |
+TEST_F(MultiUserWindowManagerChromeOSTest, MaximizeModeInteraction) { |
+ SetUpForThisManyWindows(2); |
+ |
+ multi_user_window_manager()->SetWindowOwner(window(0), "A"); |
+ multi_user_window_manager()->SetWindowOwner(window(1), "B"); |
+ |
+ EXPECT_FALSE(wm::GetWindowState(window(0))->IsMaximized()); |
+ EXPECT_FALSE(wm::GetWindowState(window(1))->IsMaximized()); |
+ |
+ ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); |
+ ASSERT_TRUE(manager); |
+ |
+ EXPECT_TRUE(wm::GetWindowState(window(0))->IsMaximized()); |
+ EXPECT_FALSE(wm::GetWindowState(window(1))->IsMaximized()); |
+ |
+ // After we start switching to B, the windows of user B should maximize. |
+ StartUserTransitionAnimation("B"); |
+ |
+ EXPECT_TRUE(wm::GetWindowState(window(0))->IsMaximized()); |
+ EXPECT_TRUE(wm::GetWindowState(window(1))->IsMaximized()); |
+} |
+ |
// Test that a system modal dialog will switch to the desktop of the owning |
// user. |
TEST_F(MultiUserWindowManagerChromeOSTest, SwitchUsersUponModalityChange) { |