Index: chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc |
diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc |
index 4bd32d5ec0207c69c2bb9cc3ac9aaa0028ca9279..5f016a4364b9a82ac84903844a4772790007bf30 100644 |
--- a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc |
+++ b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc |
@@ -891,7 +891,41 @@ TEST_F(WindowSizerAshTest, TestShowStateDefaults) { |
p1600x1200), ui::SHOW_STATE_NORMAL); |
} |
-// Test that the target root window is used as the destionation of |
+TEST_F(WindowSizerAshTest, DefaultStateBecomesMaximized) { |
+ // Create a browser which we can use to pass into the GetWindowBounds |
+ // function. |
+ scoped_ptr<TestingProfile> profile(new TestingProfile()); |
+ Browser::CreateParams native_params(profile.get(), |
+ chrome::HOST_DESKTOP_TYPE_ASH); |
+ scoped_ptr<Browser> browser( |
+ chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
+ |
+ gfx::Rect display_bounds = ash::Shell::GetInstance()->GetScreen()-> |
+ GetPrimaryDisplay().bounds(); |
+ gfx::Rect specified_bounds = display_bounds; |
+ |
+ // Make a window bigger than the display work area. |
+ specified_bounds.Inset(-20, -20); |
+ ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; |
+ gfx::Rect bounds; |
+ WindowSizer::GetBrowserWindowBoundsAndShowState( |
+ std::string(), specified_bounds, browser.get(), &bounds, &show_state); |
+ // The window should start maximized with its restore bounds shrunken. |
+ EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, show_state); |
+ EXPECT_NE(display_bounds.ToString(), bounds.ToString()); |
+ EXPECT_TRUE(display_bounds.Contains(bounds)); |
+ |
+ // Make a window smaller than the display work area. |
+ specified_bounds.Inset(100, 100); |
+ show_state = ui::SHOW_STATE_DEFAULT; |
+ WindowSizer::GetBrowserWindowBoundsAndShowState( |
+ std::string(), specified_bounds, browser.get(), &bounds, &show_state); |
+ // The window should start in default state. |
+ EXPECT_EQ(ui::SHOW_STATE_DEFAULT, show_state); |
+ EXPECT_EQ(specified_bounds.ToString(), bounds.ToString()); |
+} |
+ |
+// Test that the target root window is used as the destination of |
// the non browser window. This differ from PersistedBoundsCase |
// in that this uses real ash shell implementations + StateProvider |
// TargetDisplayProvider, rather than mocks. |