| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/workspace_controller.h" | 5 #include "ash/wm/workspace_controller.h" |
| 6 | 6 |
| 7 #include "ash/shell_window_ids.h" | 7 #include "ash/shell_window_ids.h" |
| 8 #include "ash/wm/activation_controller.h" | 8 #include "ash/wm/activation_controller.h" |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "ash/wm/workspace/workspace.h" | 10 #include "ash/wm/workspace/workspace.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 scoped_ptr<WorkspaceController> controller_; | 60 scoped_ptr<WorkspaceController> controller_; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 aura::Window* contents_view_; | 63 aura::Window* contents_view_; |
| 64 | 64 |
| 65 scoped_ptr<ActivationController> activation_controller_; | 65 scoped_ptr<ActivationController> activation_controller_; |
| 66 | 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(WorkspaceControllerTest); | 67 DISALLOW_COPY_AND_ASSIGN(WorkspaceControllerTest); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 TEST_F(WorkspaceControllerTest, Overview) { | |
| 71 workspace_manager()->SetWorkspaceSize(gfx::Size(500, 300)); | |
| 72 | |
| 73 // Creating two workspaces, ws1 which contains window w1, | |
| 74 // and ws2 which contains window w2. | |
| 75 Workspace* ws1 = workspace_manager()->CreateWorkspace(); | |
| 76 scoped_ptr<Window> w1(CreateTestWindow()); | |
| 77 EXPECT_TRUE(ws1->AddWindowAfter(w1.get(), NULL)); | |
| 78 | |
| 79 Workspace* ws2 = workspace_manager()->CreateWorkspace(); | |
| 80 scoped_ptr<Window> w2(CreateTestWindow()); | |
| 81 EXPECT_TRUE(ws2->AddWindowAfter(w2.get(), NULL)); | |
| 82 | |
| 83 // Activating a window switches the active workspace. | |
| 84 ash::ActivateWindow(w2.get()); | |
| 85 EXPECT_EQ(ws2, workspace_manager()->GetActiveWorkspace()); | |
| 86 | |
| 87 // The size of contents_view() is now ws1(500) + ws2(500) + margin(50). | |
| 88 EXPECT_EQ("0,0 1050x300", contents_view()->bounds().ToString()); | |
| 89 EXPECT_FALSE(workspace_manager()->is_overview()); | |
| 90 workspace_manager()->SetOverview(true); | |
| 91 EXPECT_TRUE(workspace_manager()->is_overview()); | |
| 92 | |
| 93 // Switching overview mode doesn't change the active workspace. | |
| 94 EXPECT_EQ(ws2, workspace_manager()->GetActiveWorkspace()); | |
| 95 | |
| 96 // Activating window w1 switches the active window and | |
| 97 // the mode back to normal mode. | |
| 98 ash::ActivateWindow(w1.get()); | |
| 99 EXPECT_EQ(ws1, workspace_manager()->GetActiveWorkspace()); | |
| 100 EXPECT_FALSE(workspace_manager()->is_overview()); | |
| 101 | |
| 102 // Deleting w1 without StackingClient resets the active workspace | |
| 103 ws1->RemoveWindow(w1.get()); | |
| 104 delete ws1; | |
| 105 w1.reset(); | |
| 106 EXPECT_EQ(ws2, workspace_manager()->GetActiveWorkspace()); | |
| 107 EXPECT_EQ("0,0 500x300", contents_view()->bounds().ToString()); | |
| 108 ws2->RemoveWindow(w2.get()); | |
| 109 delete ws2; | |
| 110 // The size of contents_view() for no workspace case must be | |
| 111 // same as one contents_view() case. | |
| 112 EXPECT_EQ("0,0 500x300", contents_view()->bounds().ToString()); | |
| 113 | |
| 114 // Reset now before windows are destroyed. | |
| 115 controller_.reset(); | |
| 116 } | |
| 117 | |
| 118 } // namespace internal | 70 } // namespace internal |
| 119 } // namespace ash | 71 } // namespace ash |
| OLD | NEW |