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/scoped_target_root_window.h" | 5 #include "ash/scoped_target_root_window.h" |
6 #include "ash/screen_util.h" | 6 #include "ash/screen_util.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ash/test/test_shell_delegate.h" | 9 #include "ash/test/test_shell_delegate.h" |
10 #include "ash/wm/window_positioner.h" | 10 #include "ash/wm/window_positioner.h" |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
884 p1600x1200), ui::SHOW_STATE_MAXIMIZED); | 884 p1600x1200), ui::SHOW_STATE_MAXIMIZED); |
885 | 885 |
886 // The popup should favor the initial show state over the command line. | 886 // The popup should favor the initial show state over the command line. |
887 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, | 887 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, |
888 ui::SHOW_STATE_NORMAL, | 888 ui::SHOW_STATE_NORMAL, |
889 BOTH, | 889 BOTH, |
890 browser_popup->browser(), | 890 browser_popup->browser(), |
891 p1600x1200), ui::SHOW_STATE_NORMAL); | 891 p1600x1200), ui::SHOW_STATE_NORMAL); |
892 } | 892 } |
893 | 893 |
894 // Test that the target root window is used as the destionation of | 894 TEST_F(WindowSizerAshTest, DefaultStateBecomesMaximized) { |
895 gfx::Rect display_bounds = ash::Shell::GetInstance()->GetScreen()-> | |
896 GetPrimaryDisplay().bounds(); | |
897 gfx::Rect specified_bounds = display_bounds; | |
898 | |
899 // Make a window bigger than the display work area. | |
msw
2014/07/31 04:03:24
Users can still make windows excessively large and
varkha
2014/08/01 14:18:34
No, with ash they cannot. The biggest a window is
msw
2014/08/01 16:24:47
But windows could span multiple displays on Window
varkha
2014/08/01 21:00:24
I've moved the behavior in window_sizer_ash.cc so
| |
900 specified_bounds.Inset(-20, -20); | |
901 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; | |
902 gfx::Rect bounds; | |
903 WindowSizer::GetBrowserWindowBoundsAndShowState( | |
904 std::string(), specified_bounds, NULL, &bounds, &show_state); | |
905 // The window should start maximized with its restore bounds shrunken. | |
906 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, show_state); | |
907 EXPECT_NE(display_bounds.ToString(), bounds.ToString()); | |
908 EXPECT_TRUE(display_bounds.Contains(bounds)); | |
909 | |
910 // Make a window smaller than the display work area. | |
911 specified_bounds.Inset(100, 100); | |
912 show_state = ui::SHOW_STATE_DEFAULT; | |
913 WindowSizer::GetBrowserWindowBoundsAndShowState( | |
914 std::string(), specified_bounds, NULL, &bounds, &show_state); | |
915 // The window should start in default state. | |
916 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, show_state); | |
917 EXPECT_EQ(specified_bounds.ToString(), bounds.ToString()); | |
918 } | |
919 | |
920 // Test that the target root window is used as the destination of | |
895 // the non browser window. This differ from PersistedBoundsCase | 921 // the non browser window. This differ from PersistedBoundsCase |
896 // in that this uses real ash shell implementations + StateProvider | 922 // in that this uses real ash shell implementations + StateProvider |
897 // TargetDisplayProvider, rather than mocks. | 923 // TargetDisplayProvider, rather than mocks. |
898 TEST_F(WindowSizerAshTest, DefaultBoundsInTargetDisplay) { | 924 TEST_F(WindowSizerAshTest, DefaultBoundsInTargetDisplay) { |
899 if (!SupportsMultipleDisplays() || !chrome::ShouldOpenAshOnStartup()) | 925 if (!SupportsMultipleDisplays() || !chrome::ShouldOpenAshOnStartup()) |
900 return; | 926 return; |
901 UpdateDisplay("500x500,600x600"); | 927 UpdateDisplay("500x500,600x600"); |
902 { | 928 { |
903 aura::Window* first_root = | 929 aura::Window* first_root = |
904 ash::Shell::GetAllRootWindows()[0]; | 930 ash::Shell::GetAllRootWindows()[0]; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
941 trusted_popup_create_params)); | 967 trusted_popup_create_params)); |
942 // Trusted popup windows should follow the saved show state and ignore the | 968 // Trusted popup windows should follow the saved show state and ignore the |
943 // last show state. | 969 // last show state. |
944 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, | 970 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, |
945 GetWindowShowState(ui::SHOW_STATE_DEFAULT, | 971 GetWindowShowState(ui::SHOW_STATE_DEFAULT, |
946 ui::SHOW_STATE_NORMAL, | 972 ui::SHOW_STATE_NORMAL, |
947 BOTH, | 973 BOTH, |
948 trusted_popup->browser(), | 974 trusted_popup->browser(), |
949 p1600x1200)); | 975 p1600x1200)); |
950 } | 976 } |
OLD | NEW |