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

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: Cahnged the SetBounds to SetBoundsInScreen 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
« no previous file with comments | « chrome/browser/ui/window_sizer/window_sizer_ash.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4cb09de078633a5d81b45e6d22d2022ad02ecd9c 100644
--- a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc
+++ b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc
@@ -65,6 +65,10 @@ class TestBrowserWindowAura : public TestBrowserWindow {
return native_window_;
}
+ virtual gfx::Rect GetBounds() const {
+ return native_window_->bounds();
+ }
+
private:
gfx::NativeWindow native_window_;
@@ -219,8 +223,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 +238,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 +251,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 +265,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 +279,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 +288,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 +298,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 +308,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 +320,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 +332,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 +344,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 +355,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 +376,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 +386,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 +396,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 +409,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 +419,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 +432,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 +450,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 +459,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 +470,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 +481,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 +490,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 +502,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 +511,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 +520,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 +530,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 +540,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 +553,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 +565,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 +574,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 +582,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 +590,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 +598,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 +607,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 +615,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 +624,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));
@@ -654,7 +679,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 +719,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 +752,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 +760,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());
}
}
« no previous file with comments | « chrome/browser/ui/window_sizer/window_sizer_ash.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698