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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 224113005: Eliminate ash::internal namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
« no previous file with comments | « ash/drag_drop/drag_image_view.cc ('k') | ash/first_run/desktop_cleaner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/display/display_controller.h" 5 #include "ash/display/display_controller.h"
6 #include "ash/display/display_manager.h" 6 #include "ash/display/display_manager.h"
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (!SupportsMultipleDisplays()) 156 if (!SupportsMultipleDisplays())
157 return; 157 return;
158 158
159 UpdateDisplay("1000x600,600x400"); 159 UpdateDisplay("1000x600,600x400");
160 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 160 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
161 161
162 // All root windows must have the root window controller. 162 // All root windows must have the root window controller.
163 ASSERT_EQ(2U, root_windows.size()); 163 ASSERT_EQ(2U, root_windows.size());
164 for (aura::Window::Windows::const_iterator iter = root_windows.begin(); 164 for (aura::Window::Windows::const_iterator iter = root_windows.begin();
165 iter != root_windows.end(); ++iter) { 165 iter != root_windows.end(); ++iter) {
166 EXPECT_TRUE(internal::GetRootWindowController(*iter) != NULL); 166 EXPECT_TRUE(GetRootWindowController(*iter) != NULL);
167 } 167 }
168 // Make sure root windows share the same controllers. 168 // Make sure root windows share the same controllers.
169 EXPECT_EQ(aura::client::GetFocusClient(root_windows[0]), 169 EXPECT_EQ(aura::client::GetFocusClient(root_windows[0]),
170 aura::client::GetFocusClient(root_windows[1])); 170 aura::client::GetFocusClient(root_windows[1]));
171 EXPECT_EQ(aura::client::GetActivationClient(root_windows[0]), 171 EXPECT_EQ(aura::client::GetActivationClient(root_windows[0]),
172 aura::client::GetActivationClient(root_windows[1])); 172 aura::client::GetActivationClient(root_windows[1]));
173 EXPECT_EQ(aura::client::GetCaptureClient(root_windows[0]), 173 EXPECT_EQ(aura::client::GetCaptureClient(root_windows[0]),
174 aura::client::GetCaptureClient(root_windows[1])); 174 aura::client::GetCaptureClient(root_windows[1]));
175 } 175 }
176 176
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 664
665 UpdateDisplay("100x100,200x200"); 665 UpdateDisplay("100x100,200x200");
666 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 666 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
667 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 50, 50)); 667 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 50, 50));
668 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); 668 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow());
669 w1->SetBounds(gfx::Rect(150, 10, 50, 50)); 669 w1->SetBounds(gfx::Rect(150, 10, 50, 50));
670 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); 670 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow());
671 671
672 // The widget stays in the same root if kStayInSameRootWindowKey is set to 672 // The widget stays in the same root if kStayInSameRootWindowKey is set to
673 // true. 673 // true.
674 w1->GetNativeView()->SetProperty(internal::kStayInSameRootWindowKey, true); 674 w1->GetNativeView()->SetProperty(kStayInSameRootWindowKey, true);
675 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); 675 w1->SetBounds(gfx::Rect(10, 10, 50, 50));
676 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); 676 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow());
677 677
678 // The widget should now move to the 1st root window without the property. 678 // The widget should now move to the 1st root window without the property.
679 w1->GetNativeView()->ClearProperty(internal::kStayInSameRootWindowKey); 679 w1->GetNativeView()->ClearProperty(kStayInSameRootWindowKey);
680 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); 680 w1->SetBounds(gfx::Rect(10, 10, 50, 50));
681 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); 681 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow());
682 682
683 // a window in SettingsBubbleContainer and StatusContainer should 683 // a window in SettingsBubbleContainer and StatusContainer should
684 // not move to another root window regardles of the bounds specified. 684 // not move to another root window regardles of the bounds specified.
685 aura::Window* settings_bubble_container = 685 aura::Window* settings_bubble_container =
686 Shell::GetPrimaryRootWindowController()->GetContainer( 686 Shell::GetPrimaryRootWindowController()->GetContainer(
687 internal::kShellWindowId_SettingBubbleContainer); 687 kShellWindowId_SettingBubbleContainer);
688 aura::Window* window = aura::test::CreateTestWindowWithId( 688 aura::Window* window = aura::test::CreateTestWindowWithId(
689 100, settings_bubble_container); 689 100, settings_bubble_container);
690 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), 690 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50),
691 ScreenUtil::GetSecondaryDisplay()); 691 ScreenUtil::GetSecondaryDisplay());
692 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 692 EXPECT_EQ(root_windows[0], window->GetRootWindow());
693 693
694 aura::Window* status_container = 694 aura::Window* status_container =
695 Shell::GetPrimaryRootWindowController()->GetContainer( 695 Shell::GetPrimaryRootWindowController()->GetContainer(
696 internal::kShellWindowId_StatusContainer); 696 kShellWindowId_StatusContainer);
697 window = aura::test::CreateTestWindowWithId(100, status_container); 697 window = aura::test::CreateTestWindowWithId(100, status_container);
698 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), 698 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50),
699 ScreenUtil::GetSecondaryDisplay()); 699 ScreenUtil::GetSecondaryDisplay());
700 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 700 EXPECT_EQ(root_windows[0], window->GetRootWindow());
701 } 701 }
702 702
703 TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) { 703 TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) {
704 if (!SupportsMultipleDisplays()) 704 if (!SupportsMultipleDisplays())
705 return; 705 return;
706 706
707 UpdateDisplay("100x100,200x200"); 707 UpdateDisplay("100x100,200x200");
708 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 708 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
709 709
710 // Create normal windows on both displays. 710 // Create normal windows on both displays.
711 views::Widget* widget1 = CreateTestWidget( 711 views::Widget* widget1 = CreateTestWidget(
712 Shell::GetScreen()->GetPrimaryDisplay().bounds()); 712 Shell::GetScreen()->GetPrimaryDisplay().bounds());
713 widget1->Show(); 713 widget1->Show();
714 EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow()); 714 EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow());
715 views::Widget* widget2 = CreateTestWidget( 715 views::Widget* widget2 = CreateTestWidget(
716 ScreenUtil::GetSecondaryDisplay().bounds()); 716 ScreenUtil::GetSecondaryDisplay().bounds());
717 widget2->Show(); 717 widget2->Show();
718 EXPECT_EQ(root_windows[1], widget2->GetNativeView()->GetRootWindow()); 718 EXPECT_EQ(root_windows[1], widget2->GetNativeView()->GetRootWindow());
719 719
720 // Create a LockScreen window. 720 // Create a LockScreen window.
721 views::Widget* lock_widget = CreateTestWidget( 721 views::Widget* lock_widget = CreateTestWidget(
722 Shell::GetScreen()->GetPrimaryDisplay().bounds()); 722 Shell::GetScreen()->GetPrimaryDisplay().bounds());
723 views::Textfield* textfield = new views::Textfield; 723 views::Textfield* textfield = new views::Textfield;
724 lock_widget->client_view()->AddChildView(textfield); 724 lock_widget->client_view()->AddChildView(textfield);
725 725
726 ash::Shell::GetContainer( 726 ash::Shell::GetContainer(Shell::GetPrimaryRootWindow(),
727 Shell::GetPrimaryRootWindow(), 727 ash::kShellWindowId_LockScreenContainer)
728 ash::internal::kShellWindowId_LockScreenContainer)-> 728 ->AddChild(lock_widget->GetNativeView());
729 AddChild(lock_widget->GetNativeView());
730 lock_widget->Show(); 729 lock_widget->Show();
731 textfield->RequestFocus(); 730 textfield->RequestFocus();
732 731
733 aura::client::FocusClient* focus_client = 732 aura::client::FocusClient* focus_client =
734 aura::client::GetFocusClient(root_windows[0]); 733 aura::client::GetFocusClient(root_windows[0]);
735 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 734 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
736 735
737 // The lock window should get events on both root windows. 736 // The lock window should get events on both root windows.
738 aura::test::EventGenerator& event_generator(GetEventGenerator()); 737 aura::test::EventGenerator& event_generator(GetEventGenerator());
739 738
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 generator.ReleaseLeftButton(); 797 generator.ReleaseLeftButton();
799 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); 798 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset());
800 799
801 generator.MoveMouseTo(400, 150); 800 generator.MoveMouseTo(400, 150);
802 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); 801 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset());
803 802
804 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); 803 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
805 } 804 }
806 805
807 } // namespace ash 806 } // namespace ash
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_image_view.cc ('k') | ash/first_run/desktop_cleaner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698