Index: ash/wm/workspace/workspace_manager2_unittest.cc |
diff --git a/ash/wm/workspace/workspace_manager2_unittest.cc b/ash/wm/workspace/workspace_manager2_unittest.cc |
index 47f51b23b47e1fa52cc963084c50e647b44c14c3..1676b00f196656c6d11c84a0b4cb6bfffbc2fc02 100644 |
--- a/ash/wm/workspace/workspace_manager2_unittest.cc |
+++ b/ash/wm/workspace/workspace_manager2_unittest.cc |
@@ -853,5 +853,32 @@ TEST_F(WorkspaceManager2Test, VisibilityTests) { |
EXPECT_TRUE(w1->IsVisible()); |
} |
+// Verifies windows that are offscreen don't move when switching workspaces. |
+TEST_F(WorkspaceManager2Test, DontMoveOnSwitch) { |
+ aura::test::EventGenerator generator( |
+ Shell::GetPrimaryRootWindow(), gfx::Point()); |
+ generator.MoveMouseTo(0, 0); |
+ |
+ scoped_ptr<Window> w1(CreateTestWindow()); |
+ const gfx::Rect w1_bounds(0, 1, 101, 102); |
+ ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); |
+ const gfx::Rect touches_shelf_bounds( |
+ 0, shelf->GetIdealBounds().y() - 10, 101, 102); |
+ // Move |w1| to overlap the shelf. |
+ w1->SetBounds(touches_shelf_bounds); |
+ w1->Show(); |
+ wm::ActivateWindow(w1.get()); |
+ |
+ // Create another window and maximize it. |
+ scoped_ptr<Window> w2(CreateTestWindow()); |
+ w2->SetBounds(gfx::Rect(10, 11, 250, 251)); |
+ w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
+ w2->Show(); |
+ wm::ActivateWindow(w2.get()); |
+ |
+ // Switch to w1. |
+ wm::ActivateWindow(w1.get()); |
+ EXPECT_EQ(touches_shelf_bounds.ToString(), w1->bounds().ToString()); |
+} |
} // namespace internal |
} // namespace ash |