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

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

Issue 10911274: Adding new window management (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 13d59dc63ebd08d957f1af7d59d4829653b4604e..812a8975bd40c72cda2a9554fcca3d6b82a158da 100644
--- a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc
+++ b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc
@@ -219,8 +219,8 @@ TEST_F(WindowSizerTest, LastWindowBoundsCase) {
gfx::Rect());
EXPECT_EQ(gfx::Rect(kWindowTilePixels + WindowSizer::kDesktopBorderSize,
kWindowTilePixels + WindowSizer::kDesktopBorderSize,
- 500, 400),
- window_bounds);
+ 500, 400).ToString(),
+ window_bounds.ToString());
}
{ // taskbar on top.
@@ -234,7 +234,7 @@ TEST_F(WindowSizerTest, LastWindowBoundsCase) {
std::max(kWindowTilePixels +
WindowSizer::kDesktopBorderSize,
34 /* toolbar height */),
- 500, 400), window_bounds);
+ 500, 400).ToString(), window_bounds.ToString());
}
{ // Too small to satisify the minimum visibility condition.
@@ -247,8 +247,8 @@ TEST_F(WindowSizerTest, LastWindowBoundsCase) {
EXPECT_EQ(gfx::Rect(kWindowTilePixels + WindowSizer::kDesktopBorderSize,
kWindowTilePixels + WindowSizer::kDesktopBorderSize,
30 /* not 29 */,
- 30 /* not 29 */),
- window_bounds);
+ 30 /* not 29 */).ToString(),
+ window_bounds.ToString());
}
@@ -261,8 +261,8 @@ TEST_F(WindowSizerTest, LastWindowBoundsCase) {
gfx::Rect());
EXPECT_EQ(gfx::Rect(kWindowTilePixels + WindowSizer::kDesktopBorderSize,
kWindowTilePixels + WindowSizer::kDesktopBorderSize,
- 500, 400),
- window_bounds);
+ 500, 400).ToString(),
+ window_bounds.ToString());
}
}
@@ -275,7 +275,7 @@ TEST_F(WindowSizerTest, PersistedBoundsCase) {
gfx::Rect window_bounds;
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), initial_bounds,
gfx::Rect(), PERSISTED, &window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(initial_bounds, window_bounds);
+ EXPECT_EQ(initial_bounds.ToString(), window_bounds.ToString());
}
{ // Normal.
@@ -284,7 +284,7 @@ TEST_F(WindowSizerTest, PersistedBoundsCase) {
gfx::Rect window_bounds;
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), initial_bounds,
gfx::Rect(), PERSISTED, &window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(initial_bounds, window_bounds);
+ EXPECT_EQ(initial_bounds.ToString(), window_bounds.ToString());
}
{ // normal, on non-primary monitor in negative coords.
@@ -294,7 +294,7 @@ TEST_F(WindowSizerTest, PersistedBoundsCase) {
GetWindowBounds(tentwentyfour, tentwentyfour, left_nonprimary,
initial_bounds, gfx::Rect(), PERSISTED, &window_bounds,
NULL, gfx::Rect());
- EXPECT_EQ(initial_bounds, window_bounds);
+ EXPECT_EQ(initial_bounds.ToString(), window_bounds.ToString());
}
{ // normal, on non-primary monitor in negative coords.
@@ -304,7 +304,7 @@ TEST_F(WindowSizerTest, PersistedBoundsCase) {
GetWindowBounds(tentwentyfour, tentwentyfour, left_nonprimary,
initial_bounds, gfx::Rect(), PERSISTED, &window_bounds,
NULL, gfx::Rect());
- EXPECT_EQ(initial_bounds, window_bounds);
+ EXPECT_EQ(initial_bounds.ToString(), window_bounds.ToString());
}
{ // Non-primary monitor resoultion has changed, but the monitor still
@@ -316,7 +316,7 @@ TEST_F(WindowSizerTest, PersistedBoundsCase) {
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(1024, 0, 800, 600),
initial_bounds, right_nonprimary, PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(initial_bounds, window_bounds);
+ EXPECT_EQ(initial_bounds.ToString(), window_bounds.ToString());
}
{ // Non-primary monitor resoultion has changed, and the window is partially
@@ -328,7 +328,7 @@ TEST_F(WindowSizerTest, PersistedBoundsCase) {
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(1024, 0, 800, 600),
initial_bounds, right_nonprimary, PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(1224, 50, 600, 500), window_bounds);
+ EXPECT_EQ("1224,50 600x500", window_bounds.ToString());
}
{ // Non-primary monitor resoultion has changed, and the window is now too
@@ -340,7 +340,7 @@ TEST_F(WindowSizerTest, PersistedBoundsCase) {
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(1024, 0, 800, 600),
initial_bounds, right_nonprimary, PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(1024, 0, 800, 600), window_bounds);
+ EXPECT_EQ("1024,0 800x600", window_bounds.ToString());
}
{ // width and height too small
@@ -351,8 +351,8 @@ TEST_F(WindowSizerTest, PersistedBoundsCase) {
gfx::Rect(), PERSISTED, &window_bounds, NULL, gfx::Rect());
EXPECT_EQ(gfx::Rect(WindowSizer::kDesktopBorderSize,
WindowSizer::kDesktopBorderSize,
- 30 /* not 29 */, 30 /* not 29 */),
- window_bounds);
+ 30 /* not 29 */, 30 /* not 29 */).ToString(),
+ window_bounds.ToString());
}
}
@@ -372,8 +372,8 @@ TEST_F(WindowSizerTest, LastWindowOffscreenWithNonAggressiveRepositioning) {
gfx::Rect());
EXPECT_EQ(gfx::Rect(kWindowTilePixels + WindowSizer::kDesktopBorderSize,
kWindowTilePixels + WindowSizer::kDesktopBorderSize,
- 500, 400),
- window_bounds);
+ 500, 400).ToString(),
+ window_bounds.ToString());
}
{ // offset would put the new window offscreen at the bottom but the minimum
@@ -382,8 +382,8 @@ TEST_F(WindowSizerTest, LastWindowOffscreenWithNonAggressiveRepositioning) {
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(10, 728, 500, 400), gfx::Rect(), LAST_ACTIVE,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(10 + kWindowTilePixels, 738,
- 500, 400), window_bounds);
+ EXPECT_EQ(gfx::Rect(10 + kWindowTilePixels, 738, 500, 400).ToString(),
+ window_bounds.ToString());
}
{ // offset would put the new window offscreen at the bottom and the minimum
@@ -392,8 +392,11 @@ TEST_F(WindowSizerTest, LastWindowOffscreenWithNonAggressiveRepositioning) {
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(10, 729, 500, 400), gfx::Rect(), LAST_ACTIVE,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(10 + kWindowTilePixels, 738 /* not 739 */, 500, 400),
- window_bounds);
+ EXPECT_EQ(gfx::Rect(10 + kWindowTilePixels,
+ 738 /* not 739 */,
+ 500,
+ 400).ToString(),
+ window_bounds.ToString());
}
{ // offset would put the new window offscreen at the right but the minimum
@@ -402,7 +405,8 @@ TEST_F(WindowSizerTest, LastWindowOffscreenWithNonAggressiveRepositioning) {
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(984, 10, 500, 400), gfx::Rect(), LAST_ACTIVE,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(994, 10 + kWindowTilePixels, 500, 400), window_bounds);
+ EXPECT_EQ(gfx::Rect(994, 10 + kWindowTilePixels, 500, 400).ToString(),
+ window_bounds.ToString());
}
{ // offset would put the new window offscreen at the right and the minimum
@@ -411,8 +415,11 @@ TEST_F(WindowSizerTest, LastWindowOffscreenWithNonAggressiveRepositioning) {
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(985, 10, 500, 400), gfx::Rect(), LAST_ACTIVE,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(994 /* not 995 */, 10 + kWindowTilePixels,
- 500, 400), window_bounds);
+ EXPECT_EQ(gfx::Rect(994 /* not 995 */,
+ 10 + kWindowTilePixels,
+ 500,
+ 400).ToString(),
+ window_bounds.ToString());
}
{ // offset would put the new window offscreen at the bottom right and the
@@ -421,8 +428,11 @@ TEST_F(WindowSizerTest, LastWindowOffscreenWithNonAggressiveRepositioning) {
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(985, 729, 500, 400), gfx::Rect(), LAST_ACTIVE,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(994 /* not 995 */, 738 /* not 739 */, 500, 400),
- window_bounds);
+ EXPECT_EQ(gfx::Rect(994 /* not 995 */,
+ 738 /* not 739 */,
+ 500,
+ 400).ToString(),
+ window_bounds.ToString());
}
}
@@ -436,7 +446,7 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
initial_bounds, gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(initial_bounds, window_bounds);
+ EXPECT_EQ(initial_bounds.ToString(), window_bounds.ToString());
}
{ // off the left and the minimum visibility condition is satisfied by
@@ -445,7 +455,8 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(-471, 50, 500, 400), gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(-470 /* not -471 */, 50, 500, 400), window_bounds);
+ EXPECT_EQ(gfx::Rect(-470 /* not -471 */, 50, 500, 400).ToString(),
+ window_bounds.ToString());
}
{ // off the top
@@ -455,7 +466,7 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(50, -370, 500, 400), gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(50, 0, 500, 400), window_bounds);
+ EXPECT_EQ("50,0 500x400", window_bounds.ToString());
}
{ // off the right but the minimum visibility condition is barely satisified
@@ -466,7 +477,7 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
initial_bounds, gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(initial_bounds, window_bounds);
+ EXPECT_EQ(initial_bounds.ToString(), window_bounds.ToString());
}
{ // off the right and the minimum visibility condition is satisified by
@@ -475,7 +486,8 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(995, 50, 500, 400), gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(994 /* not 995 */, 50, 500, 400), window_bounds);
+ EXPECT_EQ(gfx::Rect(994 /* not 995 */, 50, 500, 400).ToString(),
+ window_bounds.ToString());
}
{ // off the bottom but the minimum visibility condition is barely satisified
@@ -486,7 +498,7 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
initial_bounds, gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(initial_bounds, window_bounds);
+ EXPECT_EQ(initial_bounds.ToString(), window_bounds.ToString());
}
{ // off the bottom and the minimum visibility condition is satisified by
@@ -495,7 +507,8 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(50, 739, 500, 400), gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(50, 738 /* not 739 */, 500, 400), window_bounds);
+ EXPECT_EQ(gfx::Rect(50, 738 /* not 739 */, 500, 400).ToString(),
+ window_bounds.ToString());
}
{ // off the topleft
@@ -503,8 +516,8 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(-471, -371, 500, 400), gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(-470 /* not -471 */, 0, 500, 400),
- window_bounds);
+ EXPECT_EQ(gfx::Rect(-470 /* not -471 */, 0, 500, 400).ToString(),
+ window_bounds.ToString());
}
{ // off the topright and the minimum visibility condition is satisified by
@@ -513,8 +526,8 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(995, -371, 500, 400), gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(994 /* not 995 */, 0, 500, 400),
- window_bounds);
+ EXPECT_EQ(gfx::Rect(994 /* not 995 */, 0, 500, 400).ToString(),
+ window_bounds.ToString());
}
{ // off the bottomleft and the minimum visibility condition is satisified by
@@ -523,8 +536,11 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(-471, 739, 500, 400), gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(-470 /* not -471 */, 738 /* not 739 */, 500, 400),
- window_bounds);
+ EXPECT_EQ(gfx::Rect(-470 /* not -471 */,
+ 738 /* not 739 */,
+ 500,
+ 400).ToString(),
+ window_bounds.ToString());
}
{ // off the bottomright and the minimum visibility condition is satisified by
@@ -533,8 +549,11 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(995, 739, 500, 400), gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(994 /* not 995 */, 738 /* not 739 */, 500, 400),
- window_bounds);
+ EXPECT_EQ(gfx::Rect(994 /* not 995 */,
+ 738 /* not 739 */,
+ 500,
+ 400).ToString(),
+ window_bounds.ToString());
}
{ // entirely off left
@@ -542,7 +561,8 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(-700, 50, 500, 400), gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(-470 /* not -700 */, 50, 500, 400), window_bounds);
+ EXPECT_EQ(gfx::Rect(-470 /* not -700 */, 50, 500, 400).ToString(),
+ window_bounds.ToString());
}
{ // entirely off left (monitor was detached since last run)
@@ -550,7 +570,7 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(-700, 50, 500, 400), left_nonprimary, PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(0, 50, 500, 400), window_bounds);
+ EXPECT_EQ("0,50 500x400", window_bounds.ToString());
}
{ // entirely off top
@@ -558,7 +578,7 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(50, -500, 500, 400), gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(50, 0, 500, 400), window_bounds);
+ EXPECT_EQ("50,0 500x400", window_bounds.ToString());
}
{ // entirely off top (monitor was detached since last run)
@@ -566,7 +586,7 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(50, -500, 500, 400), top_nonprimary,
PERSISTED, &window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(50, 0, 500, 400), window_bounds);
+ EXPECT_EQ("50,0 500x400", window_bounds.ToString());
}
{ // entirely off right
@@ -574,7 +594,8 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(1200, 50, 500, 400), gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(994 /* not 1200 */, 50, 500, 400), window_bounds);
+ EXPECT_EQ(gfx::Rect(994 /* not 1200 */, 50, 500, 400).ToString(),
+ window_bounds.ToString());
}
{ // entirely off right (monitor was detached since last run)
@@ -582,7 +603,7 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(1200, 50, 500, 400), right_nonprimary,
PERSISTED, &window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(524, 50, 500, 400), window_bounds);
+ EXPECT_EQ("524,50 500x400", window_bounds.ToString());
}
{ // entirely off bottom
@@ -590,7 +611,8 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(50, 800, 500, 400), gfx::Rect(), PERSISTED,
&window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(50, 738 /* not 800 */, 500, 400), window_bounds);
+ EXPECT_EQ(gfx::Rect(50, 738 /* not 800 */, 500, 400).ToString(),
+ window_bounds.ToString());
}
{ // entirely off bottom (monitor was detached since last run)
@@ -598,13 +620,12 @@ TEST_F(WindowSizerTest,
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(50, 800, 500, 400), bottom_nonprimary,
PERSISTED, &window_bounds, NULL, gfx::Rect());
- EXPECT_EQ(gfx::Rect(50, 368, 500, 400), window_bounds);
+ EXPECT_EQ("50,368 500x400", window_bounds.ToString());
}
}
-// Test that a newly created window gets positioned over a previously created
-// window.
-TEST_F(WindowSizerTestWithBrowser, PlaceNewWindowOverOldWindow) {
+// Test the placement of newly created windows.
+TEST_F(WindowSizerTestWithBrowser, PlaceNewWindows) {
// Create a dummy window.
scoped_ptr<aura::Window> window(
aura::test::CreateTestWindowWithId(0, NULL));
@@ -633,6 +654,7 @@ TEST_F(WindowSizerTestWithBrowser, PlaceNewWindowOverOldWindow) {
Browser::CreateParams window_params(profile.get());
window_params.window = browser_window.get();
scoped_ptr<Browser> window_owning_browser(new Browser(window_params));
+ window_owning_browser->window()->SetBounds(gfx::Rect(16, 32, 640, 320));
// Creating a popup to make sure it does not interfere with the positioning.
scoped_ptr<BrowserWindow> browser_popup(
@@ -640,6 +662,7 @@ TEST_F(WindowSizerTestWithBrowser, PlaceNewWindowOverOldWindow) {
Browser::CreateParams popup_params(Browser::TYPE_POPUP, profile.get());
popup_params.window = browser_popup.get();
scoped_ptr<Browser> popup_owning_browser(new Browser(popup_params));
+ popup_owning_browser->window()->SetBounds(gfx::Rect(16, 32, 128, 256));
// Creating a panel to make sure it does not interfere with the positioning.
scoped_ptr<BrowserWindow> browser_panel(
@@ -647,6 +670,7 @@ TEST_F(WindowSizerTestWithBrowser, PlaceNewWindowOverOldWindow) {
Browser::CreateParams panel_params(Browser::TYPE_POPUP, profile.get());
panel_params.window = browser_panel.get();
scoped_ptr<Browser> panel_owning_browser(new Browser(panel_params));
+ panel_owning_browser->window()->SetBounds(gfx::Rect(32, 48, 256, 512));
window->Show();
{ // With a shown window it's size should get returned.
@@ -654,7 +678,38 @@ TEST_F(WindowSizerTestWithBrowser, PlaceNewWindowOverOldWindow) {
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(50, 100, 300, 150), bottom_nonprimary,
PERSISTED, &window_bounds, browser.get(), gfx::Rect());
- EXPECT_EQ(gfx::Rect(16, 32, 640, 320), window_bounds);
+ // The position should be right flush.
+ EXPECT_EQ("384,32 640x320", window_bounds.ToString());
+ // In addition the other window should have moved left flush.
+ EXPECT_EQ("0,32 640x320", window->bounds().ToString());
+ }
+
+ { // With the window shown - but more on the right side then on the left
+ // side (and partially out of the screen), it should default to the other
+ // side and inside the screen.
+ window->SetBounds(gfx::Rect(350, 600, 640, 320));
+ gfx::Rect window_bounds;
+ GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
+ gfx::Rect(50, 100, 300, 150), bottom_nonprimary,
+ PERSISTED, &window_bounds, browser.get(), gfx::Rect());
+ // The position should be left & bottom flush.
+ EXPECT_EQ("0,448 640x320", window_bounds.ToString());
+ // In addition the other window should have moved right flush.
+ EXPECT_EQ("384,600 640x320", window->bounds().ToString());
+ }
+
+ { // If the second windows right side is already over the right side of the
+ // screen, it will not move back into the screen.
+ window->SetBounds(gfx::Rect(1000, 600, 640, 320));
+ gfx::Rect window_bounds;
+ GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
+ gfx::Rect(50, 100, 300, 150), bottom_nonprimary,
+ PERSISTED, &window_bounds, browser.get(), gfx::Rect());
+ // The position should be left & bottom flush.
+ EXPECT_EQ("0,448 640x320", window_bounds.ToString());
+ // If the other window was already beyond the point to get right flush
+ // it will remain where it is.
+ EXPECT_EQ("1000,600 640x320", window->bounds().ToString());
}
{ // Make sure that popups do not get changed.
@@ -663,31 +718,28 @@ TEST_F(WindowSizerTestWithBrowser, PlaceNewWindowOverOldWindow) {
gfx::Rect(50, 100, 300, 150), bottom_nonprimary,
PERSISTED, &window_bounds, popup_owning_browser.get(),
gfx::Rect());
- EXPECT_EQ(gfx::Rect(50, 100, 300, 150), window_bounds);
+ EXPECT_EQ("50,100 300x150", window_bounds.ToString());
}
- window->SetBounds(gfx::Rect(816, 720, 640, 320));
- // Verifies newly created windows appear on screen.
- {
+ window->Hide();
+ { // If a window is there but not shown the persisted default should be used.
gfx::Rect window_bounds;
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
gfx::Rect(50, 100, 300, 150), bottom_nonprimary,
PERSISTED, &window_bounds, browser.get(), gfx::Rect());
- EXPECT_EQ("384,448 640x320", window_bounds.ToString());
+ EXPECT_EQ("50,100 300x150", window_bounds.ToString());
}
- window->Hide();
{ // If a window is there but not shown the default should be returned.
- // The existing popup should not have any impact as well.
gfx::Rect window_bounds;
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(),
- gfx::Rect(50, 100, 300, 150), bottom_nonprimary,
- PERSISTED, &window_bounds, browser.get(), gfx::Rect());
+ gfx::Rect(), bottom_nonprimary,
+ DEFAULT, &window_bounds, browser.get(), gfx::Rect());
EXPECT_EQ(gfx::Rect(WindowSizer::kDesktopBorderSize,
WindowSizer::kDesktopBorderSize,
1024 - 2 * WindowSizer::kDesktopBorderSize,
- 768 - WindowSizer::kDesktopBorderSize),
- window_bounds);
+ 768 - WindowSizer::kDesktopBorderSize).ToString(),
+ window_bounds.ToString());
}
}
@@ -699,7 +751,7 @@ TEST_F(WindowSizerTest, AdjustFitSize) {
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), gfx::Rect(),
gfx::Rect(), DEFAULT, &window_bounds, NULL,
gfx::Rect(-10, -10, 1024 + 20, 768 + 20));
- EXPECT_EQ(gfx::Rect(0, 0, 1024, 768), window_bounds);
+ EXPECT_EQ("0,0 1024x768", window_bounds.ToString());
}
{ // Check that a window which hangs out of the screen get moved back in.
@@ -707,6 +759,6 @@ TEST_F(WindowSizerTest, AdjustFitSize) {
GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), gfx::Rect(),
gfx::Rect(), DEFAULT, &window_bounds, NULL,
gfx::Rect(1020, 700, 100, 100));
- EXPECT_EQ(gfx::Rect(924, 668, 100, 100), window_bounds);
+ EXPECT_EQ("924,668 100x100", window_bounds.ToString());
}
}

Powered by Google App Engine
This is Rietveld 408576698