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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 138003007: [Cleanup] Screen cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make sure screen_for_shutdown is reset everytime Created 6 years, 11 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/display/screen_position_controller_unittest.cc ('k') | ash/screen_ash.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_ash.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"
11 #include "ash/system/tray/system_tray.h" 11 #include "ash/system/tray/system_tray.h"
12 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
13 #include "ash/wm/coordinate_conversion.h" 13 #include "ash/wm/coordinate_conversion.h"
14 #include "ash/wm/window_cycle_controller.h" 14 #include "ash/wm/window_cycle_controller.h"
15 #include "ash/wm/window_properties.h" 15 #include "ash/wm/window_properties.h"
16 #include "ash/wm/window_util.h" 16 #include "ash/wm/window_util.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "ui/aura/client/activation_client.h" 18 #include "ui/aura/client/activation_client.h"
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); 602 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow());
603 EXPECT_EQ("10,50 50x50", 603 EXPECT_EQ("10,50 50x50",
604 w1_t1->GetWindowBoundsInScreen().ToString()); 604 w1_t1->GetWindowBoundsInScreen().ToString());
605 } 605 }
606 606
607 // Test if the Window::ConvertPointToTarget works across root windows. 607 // Test if the Window::ConvertPointToTarget works across root windows.
608 // TODO(oshima): Move multiple display suport and this test to aura. 608 // TODO(oshima): Move multiple display suport and this test to aura.
609 TEST_F(ExtendedDesktopTest, ConvertPoint) { 609 TEST_F(ExtendedDesktopTest, ConvertPoint) {
610 if (!SupportsMultipleDisplays()) 610 if (!SupportsMultipleDisplays())
611 return; 611 return;
612 gfx::Screen* screen = Shell::GetInstance()->screen(); 612 gfx::Screen* screen = Shell::GetScreen();
613 UpdateDisplay("1000x600,600x400"); 613 UpdateDisplay("1000x600,600x400");
614 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 614 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
615 gfx::Display display_1 = screen->GetDisplayNearestWindow(root_windows[0]); 615 gfx::Display display_1 = screen->GetDisplayNearestWindow(root_windows[0]);
616 EXPECT_EQ("0,0", display_1.bounds().origin().ToString()); 616 EXPECT_EQ("0,0", display_1.bounds().origin().ToString());
617 gfx::Display display_2 = screen->GetDisplayNearestWindow(root_windows[1]); 617 gfx::Display display_2 = screen->GetDisplayNearestWindow(root_windows[1]);
618 EXPECT_EQ("1000,0", display_2.bounds().origin().ToString()); 618 EXPECT_EQ("1000,0", display_2.bounds().origin().ToString());
619 619
620 aura::Window* d1 = 620 aura::Window* d1 =
621 CreateTestWidget(gfx::Rect(10, 10, 100, 100))->GetNativeView(); 621 CreateTestWidget(gfx::Rect(10, 10, 100, 100))->GetNativeView();
622 aura::Window* d2 = 622 aura::Window* d2 =
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); 720 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow());
721 721
722 // a window in SettingsBubbleContainer and StatusContainer should 722 // a window in SettingsBubbleContainer and StatusContainer should
723 // not move to another root window regardles of the bounds specified. 723 // not move to another root window regardles of the bounds specified.
724 aura::Window* settings_bubble_container = 724 aura::Window* settings_bubble_container =
725 Shell::GetPrimaryRootWindowController()->GetContainer( 725 Shell::GetPrimaryRootWindowController()->GetContainer(
726 internal::kShellWindowId_SettingBubbleContainer); 726 internal::kShellWindowId_SettingBubbleContainer);
727 aura::Window* window = aura::test::CreateTestWindowWithId( 727 aura::Window* window = aura::test::CreateTestWindowWithId(
728 100, settings_bubble_container); 728 100, settings_bubble_container);
729 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), 729 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50),
730 ScreenAsh::GetSecondaryDisplay()); 730 ScreenUtil::GetSecondaryDisplay());
731 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 731 EXPECT_EQ(root_windows[0], window->GetRootWindow());
732 732
733 aura::Window* status_container = 733 aura::Window* status_container =
734 Shell::GetPrimaryRootWindowController()->GetContainer( 734 Shell::GetPrimaryRootWindowController()->GetContainer(
735 internal::kShellWindowId_StatusContainer); 735 internal::kShellWindowId_StatusContainer);
736 window = aura::test::CreateTestWindowWithId(100, status_container); 736 window = aura::test::CreateTestWindowWithId(100, status_container);
737 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), 737 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50),
738 ScreenAsh::GetSecondaryDisplay()); 738 ScreenUtil::GetSecondaryDisplay());
739 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 739 EXPECT_EQ(root_windows[0], window->GetRootWindow());
740 } 740 }
741 741
742 TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) { 742 TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) {
743 if (!SupportsMultipleDisplays()) 743 if (!SupportsMultipleDisplays())
744 return; 744 return;
745 745
746 UpdateDisplay("100x100,200x200"); 746 UpdateDisplay("100x100,200x200");
747 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 747 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
748 748
749 // Create normal windows on both displays. 749 // Create normal windows on both displays.
750 views::Widget* widget1 = CreateTestWidget( 750 views::Widget* widget1 = CreateTestWidget(
751 Shell::GetScreen()->GetPrimaryDisplay().bounds()); 751 Shell::GetScreen()->GetPrimaryDisplay().bounds());
752 widget1->Show(); 752 widget1->Show();
753 EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow()); 753 EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow());
754 views::Widget* widget2 = CreateTestWidget( 754 views::Widget* widget2 = CreateTestWidget(
755 ScreenAsh::GetSecondaryDisplay().bounds()); 755 ScreenUtil::GetSecondaryDisplay().bounds());
756 widget2->Show(); 756 widget2->Show();
757 EXPECT_EQ(root_windows[1], widget2->GetNativeView()->GetRootWindow()); 757 EXPECT_EQ(root_windows[1], widget2->GetNativeView()->GetRootWindow());
758 758
759 // Create a LockScreen window. 759 // Create a LockScreen window.
760 views::Widget* lock_widget = CreateTestWidget( 760 views::Widget* lock_widget = CreateTestWidget(
761 Shell::GetScreen()->GetPrimaryDisplay().bounds()); 761 Shell::GetScreen()->GetPrimaryDisplay().bounds());
762 views::Textfield* textfield = new views::Textfield; 762 views::Textfield* textfield = new views::Textfield;
763 lock_widget->client_view()->AddChildView(textfield); 763 lock_widget->client_view()->AddChildView(textfield);
764 764
765 ash::Shell::GetContainer( 765 ash::Shell::GetContainer(
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 generator.ReleaseLeftButton(); 837 generator.ReleaseLeftButton();
838 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); 838 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset());
839 839
840 generator.MoveMouseTo(400, 150); 840 generator.MoveMouseTo(400, 150);
841 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); 841 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset());
842 842
843 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); 843 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
844 } 844 }
845 845
846 } // namespace ash 846 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/screen_position_controller_unittest.cc ('k') | ash/screen_ash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698