| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/workspace_manager.h" | 5 #include "ash/wm/workspace/workspace_manager.h" |
| 6 | 6 |
| 7 #include "ash/screen_ash.h" |
| 7 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 8 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 9 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/wm/activation_controller.h" | 11 #include "ash/wm/activation_controller.h" |
| 11 #include "ash/wm/property_util.h" | 12 #include "ash/wm/property_util.h" |
| 12 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 13 #include "ash/wm/workspace_controller.h" | 14 #include "ash/wm/workspace_controller.h" |
| 14 #include "ash/wm/workspace/workspace.h" | 15 #include "ash/wm/workspace/workspace.h" |
| 15 #include "ash/wm/workspace/workspace_layout_manager.h" | 16 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 16 #include "ui/aura/client/aura_constants.h" | 17 #include "ui/aura/client/aura_constants.h" |
| 17 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
| 18 #include "ui/aura/screen_aura.h" | |
| 19 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 20 #include "ui/base/ui_base_types.h" | 20 #include "ui/base/ui_base_types.h" |
| 21 #include "ui/gfx/screen.h" | 21 #include "ui/gfx/screen.h" |
| 22 | 22 |
| 23 using aura::Window; | 23 using aura::Window; |
| 24 | 24 |
| 25 namespace ash { | 25 namespace ash { |
| 26 namespace internal { | 26 namespace internal { |
| 27 | 27 |
| 28 class WorkspaceManagerTest : public test::AshTestBase { | 28 class WorkspaceManagerTest : public test::AshTestBase { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 w1->Show(); | 168 w1->Show(); |
| 169 | 169 |
| 170 ASSERT_TRUE(w1->layer() != NULL); | 170 ASSERT_TRUE(w1->layer() != NULL); |
| 171 EXPECT_TRUE(w1->layer()->visible()); | 171 EXPECT_TRUE(w1->layer()->visible()); |
| 172 | 172 |
| 173 EXPECT_EQ(250, w1->bounds().width()); | 173 EXPECT_EQ(250, w1->bounds().width()); |
| 174 EXPECT_EQ(251, w1->bounds().height()); | 174 EXPECT_EQ(251, w1->bounds().height()); |
| 175 | 175 |
| 176 // Maximize the window. | 176 // Maximize the window. |
| 177 Shell::GetRootWindow()->SetScreenWorkAreaInsets( | 177 Shell::GetInstance()->SetScreenWorkAreaInsets( |
| 178 gfx::Insets(0, 0, 30, 0)); | 178 gfx::Insets(0, 0, 30, 0)); |
| 179 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 179 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 180 | 180 |
| 181 // Should be 1 workspace, TYPE_MAXIMIZED with w1, fills the work area bounds. | 181 // Should be 1 workspace, TYPE_MAXIMIZED with w1, fills the work area bounds. |
| 182 ASSERT_EQ(1u, workspaces().size()); | 182 ASSERT_EQ(1u, workspaces().size()); |
| 183 EXPECT_EQ(Workspace::TYPE_MAXIMIZED, workspaces()[0]->type()); | 183 EXPECT_EQ(Workspace::TYPE_MAXIMIZED, workspaces()[0]->type()); |
| 184 ASSERT_EQ(1u, workspaces()[0]->windows().size()); | 184 ASSERT_EQ(1u, workspaces()[0]->windows().size()); |
| 185 EXPECT_EQ(w1.get(), workspaces()[0]->windows()[0]); | 185 EXPECT_EQ(w1.get(), workspaces()[0]->windows()[0]); |
| 186 EXPECT_EQ(GetWorkAreaBounds().width(), w1->bounds().width()); | 186 EXPECT_EQ(GetWorkAreaBounds().width(), w1->bounds().width()); |
| 187 EXPECT_EQ(GetWorkAreaBounds().height(), w1->bounds().height()); | 187 EXPECT_EQ(GetWorkAreaBounds().height(), w1->bounds().height()); |
| 188 | 188 |
| 189 // Change work area insets. | 189 // Change work area insets. |
| 190 Shell::GetRootWindow()->SetScreenWorkAreaInsets( | 190 Shell::GetInstance()->SetScreenWorkAreaInsets( |
| 191 gfx::Insets(0, 0, 60, 0)); | 191 gfx::Insets(0, 0, 60, 0)); |
| 192 | 192 |
| 193 // Should be 1 workspace, TYPE_MAXIMIZED with w1, fills the changed work | 193 // Should be 1 workspace, TYPE_MAXIMIZED with w1, fills the changed work |
| 194 // area bounds. | 194 // area bounds. |
| 195 ASSERT_EQ(1u, workspaces().size()); | 195 ASSERT_EQ(1u, workspaces().size()); |
| 196 EXPECT_EQ(Workspace::TYPE_MAXIMIZED, workspaces()[0]->type()); | 196 EXPECT_EQ(Workspace::TYPE_MAXIMIZED, workspaces()[0]->type()); |
| 197 ASSERT_EQ(1u, workspaces()[0]->windows().size()); | 197 ASSERT_EQ(1u, workspaces()[0]->windows().size()); |
| 198 EXPECT_EQ(w1.get(), workspaces()[0]->windows()[0]); | 198 EXPECT_EQ(w1.get(), workspaces()[0]->windows()[0]); |
| 199 EXPECT_EQ(GetWorkAreaBounds().width(), w1->bounds().width()); | 199 EXPECT_EQ(GetWorkAreaBounds().width(), w1->bounds().width()); |
| 200 EXPECT_EQ(GetWorkAreaBounds().height(), w1->bounds().height()); | 200 EXPECT_EQ(GetWorkAreaBounds().height(), w1->bounds().height()); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 EXPECT_TRUE(w3->layer()->IsDrawn()); | 411 EXPECT_TRUE(w3->layer()->IsDrawn()); |
| 412 | 412 |
| 413 w1->Show(); | 413 w1->Show(); |
| 414 EXPECT_TRUE(w1->layer()->IsDrawn()); | 414 EXPECT_TRUE(w1->layer()->IsDrawn()); |
| 415 EXPECT_FALSE(w2->layer()->IsDrawn()); | 415 EXPECT_FALSE(w2->layer()->IsDrawn()); |
| 416 EXPECT_FALSE(w3->layer()->IsDrawn()); | 416 EXPECT_FALSE(w3->layer()->IsDrawn()); |
| 417 } | 417 } |
| 418 | 418 |
| 419 } // namespace internal | 419 } // namespace internal |
| 420 } // namespace ash | 420 } // namespace ash |
| OLD | NEW |