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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 delete window1; | 590 delete window1; |
591 | 591 |
592 ASSERT_FALSE(observer2.destroyed()); | 592 ASSERT_FALSE(observer2.destroyed()); |
593 delete window2; | 593 delete window2; |
594 } | 594 } |
595 | 595 |
596 typedef test::NoSessionAshTestBase NoSessionRootWindowControllerTest; | 596 typedef test::NoSessionAshTestBase NoSessionRootWindowControllerTest; |
597 | 597 |
598 // Make sure that an event handler exists for entire display area. | 598 // Make sure that an event handler exists for entire display area. |
599 TEST_F(NoSessionRootWindowControllerTest, Event) { | 599 TEST_F(NoSessionRootWindowControllerTest, Event) { |
600 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); | 600 aura::Window* root = Shell::GetPrimaryRootWindow(); |
601 const gfx::Size size = root->bounds().size(); | 601 const gfx::Size size = root->bounds().size(); |
602 aura::Window* event_target = root->GetEventHandlerForPoint(gfx::Point(0, 0)); | 602 aura::Window* event_target = root->GetEventHandlerForPoint(gfx::Point(0, 0)); |
603 EXPECT_TRUE(event_target); | 603 EXPECT_TRUE(event_target); |
604 EXPECT_EQ(event_target, | 604 EXPECT_EQ(event_target, |
605 root->GetEventHandlerForPoint(gfx::Point(0, size.height() - 1))); | 605 root->GetEventHandlerForPoint(gfx::Point(0, size.height() - 1))); |
606 EXPECT_EQ(event_target, | 606 EXPECT_EQ(event_target, |
607 root->GetEventHandlerForPoint(gfx::Point(size.width() - 1, 0))); | 607 root->GetEventHandlerForPoint(gfx::Point(size.width() - 1, 0))); |
608 EXPECT_EQ(event_target, | 608 EXPECT_EQ(event_target, |
609 root->GetEventHandlerForPoint(gfx::Point(0, size.height() - 1))); | 609 root->GetEventHandlerForPoint(gfx::Point(0, size.height() - 1))); |
610 EXPECT_EQ(event_target, | 610 EXPECT_EQ(event_target, |
(...skipping 21 matching lines...) Expand all Loading... |
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) { |
636 if (!SupportsMultipleDisplays()) | 636 if (!SupportsMultipleDisplays()) |
637 return; | 637 return; |
638 | 638 |
639 UpdateDisplay("500x500,500x500"); | 639 UpdateDisplay("500x500,500x500"); |
640 | 640 |
641 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 641 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
642 aura::RootWindow* primary_root_window = Shell::GetPrimaryRootWindow(); | 642 aura::Window* primary_root_window = Shell::GetPrimaryRootWindow(); |
643 aura::RootWindow* secondary_root_window = | 643 aura::Window* secondary_root_window = |
644 root_windows[0] == primary_root_window ? | 644 root_windows[0] == primary_root_window ? |
645 root_windows[1] : root_windows[0]; | 645 root_windows[1] : root_windows[0]; |
646 | 646 |
647 ASSERT_TRUE(Shell::GetContainer( | 647 ASSERT_TRUE(Shell::GetContainer( |
648 primary_root_window, | 648 primary_root_window, |
649 internal::kShellWindowId_VirtualKeyboardContainer)); | 649 internal::kShellWindowId_VirtualKeyboardContainer)); |
650 ASSERT_FALSE(Shell::GetContainer( | 650 ASSERT_FALSE(Shell::GetContainer( |
651 secondary_root_window, | 651 secondary_root_window, |
652 internal::kShellWindowId_VirtualKeyboardContainer)); | 652 internal::kShellWindowId_VirtualKeyboardContainer)); |
653 } | 653 } |
654 | 654 |
655 // Test for http://crbug.com/263599. Virtual keyboard should be able to receive | 655 // Test for http://crbug.com/263599. Virtual keyboard should be able to receive |
656 // events at blocked user session. | 656 // events at blocked user session. |
657 TEST_F(VirtualKeyboardRootWindowControllerTest, | 657 TEST_F(VirtualKeyboardRootWindowControllerTest, |
658 ClickVirtualKeyboardInBlockedWindow) { | 658 ClickVirtualKeyboardInBlockedWindow) { |
659 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); | 659 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
660 aura::Window* keyboard_container = Shell::GetContainer(root_window, | 660 aura::Window* keyboard_container = Shell::GetContainer(root_window, |
661 internal::kShellWindowId_VirtualKeyboardContainer); | 661 internal::kShellWindowId_VirtualKeyboardContainer); |
662 ASSERT_TRUE(keyboard_container); | 662 ASSERT_TRUE(keyboard_container); |
663 keyboard_container->Show(); | 663 keyboard_container->Show(); |
664 | 664 |
665 ClickTestWindow* main_delegate = new ClickTestWindow(); | 665 ClickTestWindow* main_delegate = new ClickTestWindow(); |
666 scoped_ptr<aura::Window> keyboard_window( | 666 scoped_ptr<aura::Window> keyboard_window( |
667 main_delegate->CreateTestWindowWithParent(keyboard_container)); | 667 main_delegate->CreateTestWindowWithParent(keyboard_container)); |
668 keyboard_container->layout_manager()->OnWindowResized(); | 668 keyboard_container->layout_manager()->OnWindowResized(); |
669 keyboard_window->Show(); | 669 keyboard_window->Show(); |
(...skipping 12 matching lines...) Expand all Loading... |
682 EXPECT_EQ(expected_mouse_presses, main_delegate->mouse_presses()); | 682 EXPECT_EQ(expected_mouse_presses, main_delegate->mouse_presses()); |
683 UnblockUserSession(); | 683 UnblockUserSession(); |
684 } | 684 } |
685 } | 685 } |
686 | 686 |
687 // Test for http://crbug.com/299787. RootWindowController should delete | 687 // Test for http://crbug.com/299787. RootWindowController should delete |
688 // the old container since the keyboard controller creates a new window in | 688 // the old container since the keyboard controller creates a new window in |
689 // GetWindowContainer(). | 689 // GetWindowContainer(). |
690 TEST_F(VirtualKeyboardRootWindowControllerTest, | 690 TEST_F(VirtualKeyboardRootWindowControllerTest, |
691 DeleteOldContainerOnVirtualKeyboardInit) { | 691 DeleteOldContainerOnVirtualKeyboardInit) { |
692 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); | 692 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); |
693 aura::Window* keyboard_container = Shell::GetContainer(root_window, | 693 aura::Window* keyboard_container = Shell::GetContainer(root_window, |
694 internal::kShellWindowId_VirtualKeyboardContainer); | 694 internal::kShellWindowId_VirtualKeyboardContainer); |
695 ASSERT_TRUE(keyboard_container); | 695 ASSERT_TRUE(keyboard_container); |
696 // Track the keyboard container window. | 696 // Track the keyboard container window. |
697 aura::WindowTracker tracker; | 697 aura::WindowTracker tracker; |
698 tracker.Add(keyboard_container); | 698 tracker.Add(keyboard_container); |
699 // Mock a login state change to reinitialize the keyboard. | 699 // Mock a login state change to reinitialize the keyboard. |
700 ash::Shell::GetInstance()->OnLoginStateChanged(user::LOGGED_IN_OWNER); | 700 ash::Shell::GetInstance()->OnLoginStateChanged(user::LOGGED_IN_OWNER); |
701 // keyboard_container should no longer be present. | 701 // keyboard_container should no longer be present. |
702 EXPECT_FALSE(tracker.Contains(keyboard_container)); | 702 EXPECT_FALSE(tracker.Contains(keyboard_container)); |
703 } | 703 } |
704 | 704 |
705 } // namespace test | 705 } // namespace test |
706 } // namespace ash | 706 } // namespace ash |
OLD | NEW |