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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 { | 615 { |
616 public: | 616 public: |
617 VirtualKeyboardRootWindowControllerTest() {}; | 617 VirtualKeyboardRootWindowControllerTest() {}; |
618 virtual ~VirtualKeyboardRootWindowControllerTest() {}; | 618 virtual ~VirtualKeyboardRootWindowControllerTest() {}; |
619 | 619 |
620 virtual void SetUp() OVERRIDE { | 620 virtual void SetUp() OVERRIDE { |
621 CommandLine::ForCurrentProcess()->AppendSwitch( | 621 CommandLine::ForCurrentProcess()->AppendSwitch( |
622 keyboard::switches::kEnableVirtualKeyboard); | 622 keyboard::switches::kEnableVirtualKeyboard); |
623 test::AshTestBase::SetUp(); | 623 test::AshTestBase::SetUp(); |
624 Shell::GetPrimaryRootWindowController()->ActivateKeyboard( | 624 Shell::GetPrimaryRootWindowController()->ActivateKeyboard( |
625 Shell::GetInstance()->keyboard_controller()); | 625 keyboard::KeyboardController::GetInstance()); |
626 } | 626 } |
627 | 627 |
628 private: | 628 private: |
629 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardRootWindowControllerTest); | 629 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardRootWindowControllerTest); |
630 }; | 630 }; |
631 | 631 |
632 // Test for http://crbug.com/297858. Virtual keyboard container should only show | 632 // Test for http://crbug.com/297858. Virtual keyboard container should only show |
633 // on primary root window. | 633 // on primary root window. |
634 TEST_F(VirtualKeyboardRootWindowControllerTest, | 634 TEST_F(VirtualKeyboardRootWindowControllerTest, |
635 VirtualKeyboardOnPrimaryRootWindowOnly) { | 635 VirtualKeyboardOnPrimaryRootWindowOnly) { |
(...skipping 17 matching lines...) Expand all Loading... |
653 // Test for http://crbug.com/263599. Virtual keyboard should be able to receive | 653 // Test for http://crbug.com/263599. Virtual keyboard should be able to receive |
654 // events at blocked user session. | 654 // events at blocked user session. |
655 TEST_F(VirtualKeyboardRootWindowControllerTest, | 655 TEST_F(VirtualKeyboardRootWindowControllerTest, |
656 ClickVirtualKeyboardInBlockedWindow) { | 656 ClickVirtualKeyboardInBlockedWindow) { |
657 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 657 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
658 aura::Window* keyboard_container = | 658 aura::Window* keyboard_container = |
659 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); | 659 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); |
660 ASSERT_TRUE(keyboard_container); | 660 ASSERT_TRUE(keyboard_container); |
661 keyboard_container->Show(); | 661 keyboard_container->Show(); |
662 | 662 |
663 aura::Window* keyboard_window = Shell::GetInstance()->keyboard_controller()-> | 663 aura::Window* keyboard_window = keyboard::KeyboardController::GetInstance()-> |
664 proxy()->GetKeyboardWindow(); | 664 proxy()->GetKeyboardWindow(); |
665 keyboard_container->AddChild(keyboard_window); | 665 keyboard_container->AddChild(keyboard_window); |
666 keyboard_window->set_owned_by_parent(false); | 666 keyboard_window->set_owned_by_parent(false); |
667 keyboard_window->SetBounds(gfx::Rect()); | 667 keyboard_window->SetBounds(gfx::Rect()); |
668 keyboard_window->Show(); | 668 keyboard_window->Show(); |
669 | 669 |
670 ui::test::TestEventHandler* handler = new ui::test::TestEventHandler; | 670 ui::test::TestEventHandler* handler = new ui::test::TestEventHandler; |
671 root_window->SetEventFilter(handler); | 671 root_window->SetEventFilter(handler); |
672 | 672 |
673 aura::test::EventGenerator event_generator(root_window, keyboard_window); | 673 aura::test::EventGenerator event_generator(root_window, keyboard_window); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 } | 705 } |
706 | 706 |
707 // Test for crbug.com/342524. After user login, the work space should restore to | 707 // Test for crbug.com/342524. After user login, the work space should restore to |
708 // full screen. | 708 // full screen. |
709 TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) { | 709 TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) { |
710 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 710 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
711 aura::Window* keyboard_container = | 711 aura::Window* keyboard_container = |
712 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); | 712 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); |
713 keyboard_container->Show(); | 713 keyboard_container->Show(); |
714 keyboard::KeyboardController* controller = | 714 keyboard::KeyboardController* controller = |
715 Shell::GetInstance()->keyboard_controller(); | 715 keyboard::KeyboardController::GetInstance(); |
716 aura::Window* keyboard_window = controller->proxy()->GetKeyboardWindow(); | 716 aura::Window* keyboard_window = controller->proxy()->GetKeyboardWindow(); |
717 keyboard_container->AddChild(keyboard_window); | 717 keyboard_container->AddChild(keyboard_window); |
718 keyboard_window->set_owned_by_parent(false); | 718 keyboard_window->set_owned_by_parent(false); |
719 keyboard_window->Show(); | 719 keyboard_window->Show(); |
720 | 720 |
721 gfx::Rect before = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); | 721 gfx::Rect before = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); |
722 | 722 |
723 // Notify keyboard bounds changing. | 723 // Notify keyboard bounds changing. |
724 controller->NotifyKeyboardBoundsChanging( | 724 controller->NotifyKeyboardBoundsChanging( |
725 controller->proxy()->GetKeyboardWindow()->bounds()); | 725 controller->proxy()->GetKeyboardWindow()->bounds()); |
726 | 726 |
727 gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); | 727 gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); |
728 EXPECT_LT(after, before); | 728 EXPECT_LT(after, before); |
729 | 729 |
730 // Mock a login user profile change to reinitialize the keyboard. | 730 // Mock a login user profile change to reinitialize the keyboard. |
731 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); | 731 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); |
732 EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before); | 732 EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before); |
733 } | 733 } |
734 | 734 |
735 // Ensure that system modal dialogs do not block events targeted at the virtual | 735 // Ensure that system modal dialogs do not block events targeted at the virtual |
736 // keyboard. | 736 // keyboard. |
737 TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) { | 737 TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) { |
738 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 738 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
739 aura::Window* keyboard_container = | 739 aura::Window* keyboard_container = |
740 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); | 740 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); |
741 ASSERT_TRUE(keyboard_container); | 741 ASSERT_TRUE(keyboard_container); |
742 keyboard_container->Show(); | 742 keyboard_container->Show(); |
743 | 743 |
744 aura::Window* keyboard_window = Shell::GetInstance()->keyboard_controller()-> | 744 aura::Window* keyboard_window = keyboard::KeyboardController::GetInstance()-> |
745 proxy()->GetKeyboardWindow(); | 745 proxy()->GetKeyboardWindow(); |
746 keyboard_container->AddChild(keyboard_window); | 746 keyboard_container->AddChild(keyboard_window); |
747 keyboard_window->set_owned_by_parent(false); | 747 keyboard_window->set_owned_by_parent(false); |
748 keyboard_window->SetBounds(gfx::Rect()); | 748 keyboard_window->SetBounds(gfx::Rect()); |
749 keyboard_window->Show(); | 749 keyboard_window->Show(); |
750 | 750 |
751 ui::test::TestEventHandler* handler = new ui::test::TestEventHandler; | 751 ui::test::TestEventHandler* handler = new ui::test::TestEventHandler; |
752 root_window->SetEventFilter(handler); | 752 root_window->SetEventFilter(handler); |
753 aura::test::EventGenerator root_window_event_generator(root_window); | 753 aura::test::EventGenerator root_window_event_generator(root_window); |
754 aura::test::EventGenerator keyboard_event_generator(root_window, | 754 aura::test::EventGenerator keyboard_event_generator(root_window, |
(...skipping 13 matching lines...) Expand all Loading... |
768 | 768 |
769 modal_widget->Close(); | 769 modal_widget->Close(); |
770 | 770 |
771 // Verify that mouse events are now unblocked to the root window. | 771 // Verify that mouse events are now unblocked to the root window. |
772 root_window_event_generator.ClickLeftButton(); | 772 root_window_event_generator.ClickLeftButton(); |
773 EXPECT_EQ(2, handler->num_mouse_events() / 2); | 773 EXPECT_EQ(2, handler->num_mouse_events() / 2); |
774 } | 774 } |
775 | 775 |
776 } // namespace test | 776 } // namespace test |
777 } // namespace ash | 777 } // namespace ash |
OLD | NEW |