| Index: ash/wm/workspace/workspace_layout_manager2_unittest.cc
|
| diff --git a/ash/wm/workspace/workspace_layout_manager2_unittest.cc b/ash/wm/workspace/workspace_layout_manager2_unittest.cc
|
| index 59cab50ed8e5550ac3c77b824963fad06af2ab6a..ff933f6850b0050c22d94c16a4086cb0fe24acbe 100644
|
| --- a/ash/wm/workspace/workspace_layout_manager2_unittest.cc
|
| +++ b/ash/wm/workspace/workspace_layout_manager2_unittest.cc
|
| @@ -9,6 +9,7 @@
|
| #include "ash/wm/property_util.h"
|
| #include "ash/wm/shelf_layout_manager.h"
|
| #include "ash/wm/window_util.h"
|
| +#include "base/string_number_conversions.h"
|
| #include "ui/aura/root_window.h"
|
| #include "ui/aura/test/test_windows.h"
|
| #include "ui/aura/window.h"
|
| @@ -134,6 +135,52 @@ TEST_F(WorkspaceLayoutManager2Test, WindowShouldBeOnScreenWhenAdded) {
|
| EXPECT_TRUE(out_window->bounds().Intersects(root_window_bounds));
|
| }
|
|
|
| +// Test the placement of the last remaining window.
|
| +TEST_F(WorkspaceLayoutManager2Test, PlaceRemainingWindowsOnDestroy) {
|
| + // Create a dummy window.
|
| + scoped_ptr<aura::Window> window1(
|
| + aura::test::CreateTestWindowWithId(0, NULL));
|
| + window1->SetBounds(gfx::Rect(16, 32, 640, 320));
|
| +
|
| + scoped_ptr<aura::Window> window2(
|
| + aura::test::CreateTestWindowWithId(1, NULL));
|
| + window2->SetBounds(gfx::Rect(32, 48, 256, 512));
|
| +
|
| + window1->Show();
|
| + window2->Show();
|
| +
|
| + // Check the initial position of the windows.
|
| + EXPECT_EQ("16,32 640x320", window1->bounds().ToString());
|
| + EXPECT_EQ("32,48 256x512", window2->bounds().ToString());
|
| +
|
| + // Get rid of the second window and make sure that the first window is
|
| + // centered
|
| + // browser_window2.reset();
|
| + window2.reset();
|
| + gfx::Rect work_area = window1->parent()->bounds();
|
| + //gfx::Screen::GetDisplayMatching(
|
| + // window1->GetBoundsInScreen()).work_area();
|
| +
|
| + // Check the initial position of the windows.
|
| + EXPECT_EQ("16,32 640x320", window1->bounds().ToString());
|
| +
|
| + // Now mark create a new window and mark both as manageable and try again.
|
| + ash::wm::SetWindowPositionManageable(window1.get(), true);
|
| +
|
| + scoped_ptr<aura::Window> window3(
|
| + aura::test::CreateTestWindowWithId(2, NULL));
|
| + ash::wm::SetWindowPositionManageable(window3.get(), true);
|
| + window3->SetBounds(gfx::Rect(32, 48, 256, 512));
|
| + window3->Show();
|
| + EXPECT_EQ("16,32 640x320", window1->bounds().ToString());
|
| + EXPECT_EQ("32,48 256x512", window3->bounds().ToString());
|
| + window3.reset();
|
| +
|
| + EXPECT_EQ(
|
| + base::IntToString((work_area.width() - window1->bounds().width()) / 2) +
|
| + ",32 640x320", window1->bounds().ToString());
|
| + }
|
| +
|
| } // namespace
|
|
|
| } // namespace ash
|
|
|