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 "ash/session_state_delegate.h" | 7 #include "ash/session_state_delegate.h" |
8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 EXPECT_EQ(expected_mouse_presses, handler->num_mouse_events() / 2); | 642 EXPECT_EQ(expected_mouse_presses, handler->num_mouse_events() / 2); |
643 UnblockUserSession(); | 643 UnblockUserSession(); |
644 } | 644 } |
645 } | 645 } |
646 | 646 |
647 // Test for http://crbug.com/299787. RootWindowController should delete | 647 // Test for http://crbug.com/299787. RootWindowController should delete |
648 // the old container since the keyboard controller creates a new window in | 648 // the old container since the keyboard controller creates a new window in |
649 // GetWindowContainer(). | 649 // GetWindowContainer(). |
650 TEST_F(VirtualKeyboardRootWindowControllerTest, | 650 TEST_F(VirtualKeyboardRootWindowControllerTest, |
651 DeleteOldContainerOnVirtualKeyboardInit) { | 651 DeleteOldContainerOnVirtualKeyboardInit) { |
652 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); | 652 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
653 aura::Window* keyboard_container = Shell::GetContainer(root_window, | 653 aura::Window* keyboard_container = Shell::GetContainer(root_window, |
654 internal::kShellWindowId_VirtualKeyboardContainer); | 654 internal::kShellWindowId_VirtualKeyboardContainer); |
655 ASSERT_TRUE(keyboard_container); | 655 ASSERT_TRUE(keyboard_container); |
656 // Track the keyboard container window. | 656 // Track the keyboard container window. |
657 aura::WindowTracker tracker; | 657 aura::WindowTracker tracker; |
658 tracker.Add(keyboard_container); | 658 tracker.Add(keyboard_container); |
659 // Mock a login user profile change to reinitialize the keyboard. | 659 // Mock a login user profile change to reinitialize the keyboard. |
660 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); | 660 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); |
661 // keyboard_container should no longer be present. | 661 // keyboard_container should no longer be present. |
662 EXPECT_FALSE(tracker.Contains(keyboard_container)); | 662 EXPECT_FALSE(tracker.Contains(keyboard_container)); |
663 } | 663 } |
664 | 664 |
| 665 // Test for crbug.com/342524. After user login, the work space should restore to |
| 666 // full screen. |
| 667 TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) { |
| 668 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
| 669 aura::Window* keyboard_container = Shell::GetContainer(root_window, |
| 670 internal::kShellWindowId_VirtualKeyboardContainer); |
| 671 keyboard_container->Show(); |
| 672 keyboard::KeyboardController* controller = |
| 673 Shell::GetInstance()->keyboard_controller(); |
| 674 aura::Window* keyboard_window = controller->proxy()->GetKeyboardWindow(); |
| 675 keyboard_container->AddChild(keyboard_window); |
| 676 keyboard_window->set_owned_by_parent(false); |
| 677 keyboard_window->Show(); |
| 678 |
| 679 gfx::Rect before = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); |
| 680 |
| 681 // Notify keyboard bounds changing. |
| 682 controller->NotifyKeyboardBoundsChanging( |
| 683 controller->proxy()->GetKeyboardWindow()->bounds()); |
| 684 |
| 685 gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); |
| 686 EXPECT_LT(after, before); |
| 687 |
| 688 // Mock a login user profile change to reinitialize the keyboard. |
| 689 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); |
| 690 EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before); |
| 691 } |
| 692 |
665 } // namespace test | 693 } // namespace test |
666 } // namespace ash | 694 } // namespace ash |
OLD | NEW |