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

Unified Diff: chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc

Issue 424463002: Makes a window that has been resized to maximized bounds, then maximized and then restored shrink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Maximizes a window that has been resized to maximized bounds (comments and restrict to ash) Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698