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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 2355063002: Separate ash::test::DisplayManagerTestApi from ash (Closed)
Patch Set: review comment Created 4 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
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/aura/wm_window_aura.h" 5 #include "ash/aura/wm_window_aura.h"
6 #include "ash/common/shell_window_ids.h" 6 #include "ash/common/shell_window_ids.h"
7 #include "ash/common/system/tray/system_tray.h" 7 #include "ash/common/system/tray/system_tray.h"
8 #include "ash/common/wm/root_window_finder.h" 8 #include "ash/common/wm/root_window_finder.h"
9 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
11 #include "ash/screen_util.h"
12 #include "ash/shell.h" 11 #include "ash/shell.h"
13 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
14 #include "ash/wm/window_properties.h" 13 #include "ash/wm/window_properties.h"
15 #include "ash/wm/window_util.h" 14 #include "ash/wm/window_util.h"
16 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
18 #include "ui/aura/client/capture_client.h" 17 #include "ui/aura/client/capture_client.h"
19 #include "ui/aura/client/focus_client.h" 18 #include "ui/aura/client/focus_client.h"
20 #include "ui/aura/test/test_windows.h" 19 #include "ui/aura/test/test_windows.h"
21 #include "ui/aura/test/window_test_api.h" 20 #include "ui/aura/test/window_test_api.h"
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); 810 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow());
812 811
813 // a window in SettingsBubbleContainer and StatusContainer should 812 // a window in SettingsBubbleContainer and StatusContainer should
814 // not move to another root window regardles of the bounds specified. 813 // not move to another root window regardles of the bounds specified.
815 aura::Window* settings_bubble_container = 814 aura::Window* settings_bubble_container =
816 Shell::GetPrimaryRootWindowController()->GetContainer( 815 Shell::GetPrimaryRootWindowController()->GetContainer(
817 kShellWindowId_SettingBubbleContainer); 816 kShellWindowId_SettingBubbleContainer);
818 aura::Window* window = 817 aura::Window* window =
819 aura::test::CreateTestWindowWithId(100, settings_bubble_container); 818 aura::test::CreateTestWindowWithId(100, settings_bubble_container);
820 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), 819 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50),
821 ScreenUtil::GetSecondaryDisplay()); 820 display_manager()->GetSecondaryDisplay());
822 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 821 EXPECT_EQ(root_windows[0], window->GetRootWindow());
823 822
824 aura::Window* status_container = 823 aura::Window* status_container =
825 Shell::GetPrimaryRootWindowController()->GetContainer( 824 Shell::GetPrimaryRootWindowController()->GetContainer(
826 kShellWindowId_StatusContainer); 825 kShellWindowId_StatusContainer);
827 window = aura::test::CreateTestWindowWithId(100, status_container); 826 window = aura::test::CreateTestWindowWithId(100, status_container);
828 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), 827 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50),
829 ScreenUtil::GetSecondaryDisplay()); 828 display_manager()->GetSecondaryDisplay());
830 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 829 EXPECT_EQ(root_windows[0], window->GetRootWindow());
831 } 830 }
832 831
833 TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) { 832 TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) {
834 if (!SupportsMultipleDisplays()) 833 if (!SupportsMultipleDisplays())
835 return; 834 return;
836 835
837 UpdateDisplay("100x100,200x200"); 836 UpdateDisplay("100x100,200x200");
838 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 837 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
839 838
840 // Create normal windows on both displays. 839 // Create normal windows on both displays.
841 views::Widget* widget1 = CreateTestWidget( 840 views::Widget* widget1 = CreateTestWidget(
842 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); 841 display::Screen::GetScreen()->GetPrimaryDisplay().bounds());
843 widget1->Show(); 842 widget1->Show();
844 EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow()); 843 EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow());
845 views::Widget* widget2 = 844 views::Widget* widget2 =
846 CreateTestWidget(ScreenUtil::GetSecondaryDisplay().bounds()); 845 CreateTestWidget(display_manager()->GetSecondaryDisplay().bounds());
847 widget2->Show(); 846 widget2->Show();
848 EXPECT_EQ(root_windows[1], widget2->GetNativeView()->GetRootWindow()); 847 EXPECT_EQ(root_windows[1], widget2->GetNativeView()->GetRootWindow());
849 848
850 // Create a LockScreen window. 849 // Create a LockScreen window.
851 views::Widget* lock_widget = CreateTestWidget( 850 views::Widget* lock_widget = CreateTestWidget(
852 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); 851 display::Screen::GetScreen()->GetPrimaryDisplay().bounds());
853 views::Textfield* textfield = new views::Textfield; 852 views::Textfield* textfield = new views::Textfield;
854 lock_widget->client_view()->AddChildView(textfield); 853 lock_widget->client_view()->AddChildView(textfield);
855 854
856 ash::Shell::GetContainer(Shell::GetPrimaryRootWindow(), 855 ash::Shell::GetContainer(Shell::GetPrimaryRootWindow(),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 generator.ReleaseLeftButton(); 927 generator.ReleaseLeftButton();
929 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); 928 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset());
930 929
931 generator.MoveMouseTo(400, 150); 930 generator.MoveMouseTo(400, 150);
932 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); 931 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset());
933 932
934 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); 933 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
935 } 934 }
936 935
937 } // namespace ash 936 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/window_tree_host_manager_unittest.cc ('k') | ash/mus/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698