| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/ash/multi_user_window_manager.h" | 5 #include "chrome/browser/ui/ash/multi_user_window_manager.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
| 9 #include "ash/test/test_shell_delegate.h" | 9 #include "ash/test/test_shell_delegate.h" |
| 10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 window(4)->RemoveTransientChild(window(6)); | 466 window(4)->RemoveTransientChild(window(6)); |
| 467 EXPECT_EQ("S[A], S[], H[], H[], H[B], H[], S[], S[], S[], H[]", GetStatus()); | 467 EXPECT_EQ("S[A], S[], H[], H[], H[B], H[], S[], S[], S[], H[]", GetStatus()); |
| 468 // Before we leave we need to reverse all transient window ownerships. | 468 // Before we leave we need to reverse all transient window ownerships. |
| 469 window(0)->RemoveTransientChild(window(1)); | 469 window(0)->RemoveTransientChild(window(1)); |
| 470 window(1)->RemoveTransientChild(window(2)); | 470 window(1)->RemoveTransientChild(window(2)); |
| 471 window(4)->RemoveTransientChild(window(5)); | 471 window(4)->RemoveTransientChild(window(5)); |
| 472 window(7)->RemoveTransientChild(window(8)); | 472 window(7)->RemoveTransientChild(window(8)); |
| 473 window(7)->RemoveTransientChild(window(9)); | 473 window(7)->RemoveTransientChild(window(9)); |
| 474 } | 474 } |
| 475 | 475 |
| 476 // Test that the initial visibility state gets remembered. |
| 477 TEST_F(MultiUserWindowManagerTest, PreserveInitialVisibility) { |
| 478 SetUpForThisManyWindows(4); |
| 479 |
| 480 // Set our initial show state before we assign an owner. |
| 481 window(0)->Show(); |
| 482 window(1)->Hide(); |
| 483 window(2)->Show(); |
| 484 window(3)->Hide(); |
| 485 EXPECT_EQ("S[], H[], S[], H[]", GetStatus()); |
| 486 |
| 487 // First test: The show state gets preserved upon user switch. |
| 488 multi_user_window_manager()->SetWindowOwner(window(0), "A"); |
| 489 multi_user_window_manager()->SetWindowOwner(window(1), "A"); |
| 490 multi_user_window_manager()->SetWindowOwner(window(2), "B"); |
| 491 multi_user_window_manager()->SetWindowOwner(window(3), "B"); |
| 492 EXPECT_EQ("S[A], H[A], H[B], H[B]", GetStatus()); |
| 493 multi_user_window_manager()->ActiveUserChanged("B"); |
| 494 EXPECT_EQ("H[A], H[A], S[B], H[B]", GetStatus()); |
| 495 multi_user_window_manager()->ActiveUserChanged("A"); |
| 496 EXPECT_EQ("S[A], H[A], H[B], H[B]", GetStatus()); |
| 497 |
| 498 // Second test: Transferring the window to another desktop preserves the |
| 499 // show state. |
| 500 multi_user_window_manager()->ShowWindowForUser(window(0), "B"); |
| 501 multi_user_window_manager()->ShowWindowForUser(window(1), "B"); |
| 502 multi_user_window_manager()->ShowWindowForUser(window(2), "A"); |
| 503 multi_user_window_manager()->ShowWindowForUser(window(3), "A"); |
| 504 EXPECT_EQ("H[A,B], H[A,B], S[B,A], H[B,A]", GetStatus()); |
| 505 multi_user_window_manager()->ActiveUserChanged("B"); |
| 506 EXPECT_EQ("S[A,B], H[A,B], H[B,A], H[B,A]", GetStatus()); |
| 507 multi_user_window_manager()->ActiveUserChanged("A"); |
| 508 EXPECT_EQ("H[A,B], H[A,B], S[B,A], H[B,A]", GetStatus()); |
| 509 } |
| 510 |
| 476 } // namespace test | 511 } // namespace test |
| 477 } // namespace ash | 512 } // namespace ash |
| OLD | NEW |