| Index: ash/wm/workspace_controller_unittest.cc
|
| diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc
|
| index 9137bd7ea053747acbf8673cbb30c05290cdf127..db4d5869762dff7e0340d9525b72602b0361871e 100644
|
| --- a/ash/wm/workspace_controller_unittest.cc
|
| +++ b/ash/wm/workspace_controller_unittest.cc
|
| @@ -14,6 +14,7 @@
|
| #include "ash/common/test/test_shelf_delegate.h"
|
| #include "ash/common/wm/panels/panel_layout_manager.h"
|
| #include "ash/common/wm/window_state.h"
|
| +#include "ash/common/wm/wm_event.h"
|
| #include "ash/common/wm/workspace/workspace_window_resizer.h"
|
| #include "ash/common/wm_shell.h"
|
| #include "ash/common/wm_window.h"
|
| @@ -1310,6 +1311,38 @@ TEST_F(WorkspaceControllerTest, VerifyLayerOrdering) {
|
| EXPECT_EQ(GetWindowNames(parent), GetLayerNames(parent));
|
| }
|
|
|
| +// Test that minimizing and restoring a snapped window should restore to the
|
| +// snapped bounds. When a window is created and snapped, it must be a
|
| +// user-initiated operation, no need to do rearrangement for restoring this
|
| +// window (crbug.com/692175).
|
| +TEST_F(WorkspaceControllerTest, RestoreMinimizedSnappedWindow) {
|
| + // Create an auto-positioned window.
|
| + std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
|
| + wm::WindowState* window_state = wm::GetWindowState(window.get());
|
| + window_state->set_window_position_managed(true);
|
| + window->SetBounds(gfx::Rect(10, 20, 100, 200));
|
| + window->Show();
|
| +
|
| + // Left snap |window|.
|
| + EXPECT_FALSE(window_state->bounds_changed_by_user());
|
| + const wm::WMEvent snap_left(wm::WM_EVENT_SNAP_LEFT);
|
| + window_state->OnWMEvent(&snap_left);
|
| + const gfx::Rect work_area =
|
| + display::Screen::GetScreen()
|
| + ->GetDisplayNearestPoint(window->bounds().origin())
|
| + .work_area();
|
| + gfx::Rect snapped_bounds(work_area.x(), work_area.y(), work_area.width() / 2,
|
| + work_area.height());
|
| + EXPECT_EQ(snapped_bounds, window->bounds());
|
| + EXPECT_TRUE(window_state->bounds_changed_by_user());
|
| +
|
| + // Minimize and Restore |window|, the restored bounds should be equal to the
|
| + // bounds of left snapped state.
|
| + window_state->Minimize();
|
| + window_state->Restore();
|
| + EXPECT_EQ(snapped_bounds, window->bounds());
|
| +}
|
| +
|
| namespace {
|
|
|
| // Used by DragMaximizedNonTrackedWindow to track how many times the window
|
|
|