Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: First cut for review/trybots Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 19 matching lines...) Expand all
630 // Test for http://crbug.com/297858. Virtual keyboard container should only show 630 // Test for http://crbug.com/297858. Virtual keyboard container should only show
631 // on primary root window. 631 // on primary root window.
632 TEST_F(VirtualKeyboardRootWindowControllerTest, 632 TEST_F(VirtualKeyboardRootWindowControllerTest,
633 VirtualKeyboardOnPrimaryRootWindowOnly) { 633 VirtualKeyboardOnPrimaryRootWindowOnly) {
634 if (!SupportsMultipleDisplays()) 634 if (!SupportsMultipleDisplays())
635 return; 635 return;
636 636
637 UpdateDisplay("500x500,500x500"); 637 UpdateDisplay("500x500,500x500");
638 638
639 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 639 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
640 aura::RootWindow* primary_root_window = Shell::GetPrimaryRootWindow(); 640 aura::Window* primary_root_window = Shell::GetPrimaryRootWindow();
641 aura::RootWindow* secondary_root_window = 641 aura::Window* secondary_root_window =
642 root_windows[0] == primary_root_window ? 642 root_windows[0] == primary_root_window ?
643 root_windows[1] : root_windows[0]; 643 root_windows[1] : root_windows[0];
644 644
645 ASSERT_TRUE(Shell::GetContainer( 645 ASSERT_TRUE(Shell::GetContainer(
646 primary_root_window, 646 primary_root_window,
647 internal::kShellWindowId_VirtualKeyboardContainer)); 647 internal::kShellWindowId_VirtualKeyboardContainer));
648 ASSERT_FALSE(Shell::GetContainer( 648 ASSERT_FALSE(Shell::GetContainer(
649 secondary_root_window, 649 secondary_root_window,
650 internal::kShellWindowId_VirtualKeyboardContainer)); 650 internal::kShellWindowId_VirtualKeyboardContainer));
651 } 651 }
652 652
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::RootWindow* root_window = Shell::GetPrimaryRootWindow(); 657 aura::Window* root_window = Shell::GetPrimaryRootWindow();
658 aura::Window* keyboard_container = Shell::GetContainer(root_window, 658 aura::Window* keyboard_container = Shell::GetContainer(root_window,
659 internal::kShellWindowId_VirtualKeyboardContainer); 659 internal::kShellWindowId_VirtualKeyboardContainer);
660 ASSERT_TRUE(keyboard_container); 660 ASSERT_TRUE(keyboard_container);
661 keyboard_container->Show(); 661 keyboard_container->Show();
662 662
663 ClickTestWindow* main_delegate = new ClickTestWindow(); 663 ClickTestWindow* main_delegate = new ClickTestWindow();
664 scoped_ptr<aura::Window> keyboard_window( 664 scoped_ptr<aura::Window> keyboard_window(
665 main_delegate->CreateTestWindowWithParent(keyboard_container)); 665 main_delegate->CreateTestWindowWithParent(keyboard_container));
666 keyboard_container->layout_manager()->OnWindowResized(); 666 keyboard_container->layout_manager()->OnWindowResized();
667 keyboard_window->Show(); 667 keyboard_window->Show();
(...skipping 12 matching lines...) Expand all
680 EXPECT_EQ(expected_mouse_presses, main_delegate->mouse_presses()); 680 EXPECT_EQ(expected_mouse_presses, main_delegate->mouse_presses());
681 UnblockUserSession(); 681 UnblockUserSession();
682 } 682 }
683 } 683 }
684 684
685 // Test for http://crbug.com/299787. RootWindowController should delete 685 // Test for http://crbug.com/299787. RootWindowController should delete
686 // the old container since the keyboard controller creates a new window in 686 // the old container since the keyboard controller creates a new window in
687 // GetWindowContainer(). 687 // GetWindowContainer().
688 TEST_F(VirtualKeyboardRootWindowControllerTest, 688 TEST_F(VirtualKeyboardRootWindowControllerTest,
689 DeleteOldContainerOnVirtualKeyboardInit) { 689 DeleteOldContainerOnVirtualKeyboardInit) {
690 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); 690 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow();
691 aura::Window* keyboard_container = Shell::GetContainer(root_window, 691 aura::Window* keyboard_container = Shell::GetContainer(root_window,
692 internal::kShellWindowId_VirtualKeyboardContainer); 692 internal::kShellWindowId_VirtualKeyboardContainer);
693 ASSERT_TRUE(keyboard_container); 693 ASSERT_TRUE(keyboard_container);
694 // Track the keyboard container window. 694 // Track the keyboard container window.
695 aura::WindowTracker tracker; 695 aura::WindowTracker tracker;
696 tracker.Add(keyboard_container); 696 tracker.Add(keyboard_container);
697 // Mock a login state change to reinitialize the keyboard. 697 // Mock a login state change to reinitialize the keyboard.
698 ash::Shell::GetInstance()->OnLoginStateChanged(user::LOGGED_IN_OWNER); 698 ash::Shell::GetInstance()->OnLoginStateChanged(user::LOGGED_IN_OWNER);
699 // keyboard_container should no longer be present. 699 // keyboard_container should no longer be present.
700 EXPECT_FALSE(tracker.Contains(keyboard_container)); 700 EXPECT_FALSE(tracker.Contains(keyboard_container));
701 } 701 }
702 702
703 } // namespace test 703 } // namespace test
704 } // namespace ash 704 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698