| 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_manager2.h" | 5 #include "ash/wm/workspace/workspace_manager2.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 result += " active=" + base::IntToString(active_index()); | 115 result += " active=" + base::IntToString(active_index()); |
| 116 return result; | 116 return result; |
| 117 } | 117 } |
| 118 | 118 |
| 119 // Overridden from AshTestBase: | 119 // Overridden from AshTestBase: |
| 120 virtual void SetUp() OVERRIDE { | 120 virtual void SetUp() OVERRIDE { |
| 121 test::AshTestBase::SetUp(); | 121 test::AshTestBase::SetUp(); |
| 122 WorkspaceControllerTestHelper workspace_helper( | 122 WorkspaceControllerTestHelper workspace_helper( |
| 123 Shell::TestApi(Shell::GetInstance()).workspace_controller()); | 123 Shell::TestApi(Shell::GetInstance()).workspace_controller()); |
| 124 manager_ = workspace_helper.workspace_manager2(); | 124 manager_ = workspace_helper.workspace_manager2(); |
| 125 manager_->SetGridSize(0); | |
| 126 } | 125 } |
| 127 | 126 |
| 128 virtual void TearDown() OVERRIDE { | 127 virtual void TearDown() OVERRIDE { |
| 129 manager_ = NULL; | 128 manager_ = NULL; |
| 130 test::AshTestBase::TearDown(); | 129 test::AshTestBase::TearDown(); |
| 131 } | 130 } |
| 132 | 131 |
| 133 protected: | 132 protected: |
| 134 WorkspaceManager2* manager_; | 133 WorkspaceManager2* manager_; |
| 135 | 134 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 305 |
| 307 // Setting the bounds should go through since the window is in the normal | 306 // Setting the bounds should go through since the window is in the normal |
| 308 // workspace. | 307 // workspace. |
| 309 w1->SetBounds(gfx::Rect(0, 0, 200, 500)); | 308 w1->SetBounds(gfx::Rect(0, 0, 200, 500)); |
| 310 EXPECT_EQ(200, w1->bounds().width()); | 309 EXPECT_EQ(200, w1->bounds().width()); |
| 311 EXPECT_EQ(500, w1->bounds().height()); | 310 EXPECT_EQ(500, w1->bounds().height()); |
| 312 } | 311 } |
| 313 | 312 |
| 314 // Verifies the bounds is not altered when showing and grid is enabled. | 313 // Verifies the bounds is not altered when showing and grid is enabled. |
| 315 TEST_F(WorkspaceManager2Test, SnapToGrid) { | 314 TEST_F(WorkspaceManager2Test, SnapToGrid) { |
| 316 manager_->SetGridSize(8); | |
| 317 | |
| 318 scoped_ptr<Window> w1(CreateTestWindowUnparented()); | 315 scoped_ptr<Window> w1(CreateTestWindowUnparented()); |
| 319 w1->SetBounds(gfx::Rect(1, 6, 25, 30)); | 316 w1->SetBounds(gfx::Rect(1, 6, 25, 30)); |
| 320 w1->SetParent(NULL); | 317 w1->SetParent(NULL); |
| 321 // We are not aligning this anymore this way. When the window gets shown | 318 // We are not aligning this anymore this way. When the window gets shown |
| 322 // the window is expected to be handled differently, but this cannot be | 319 // the window is expected to be handled differently, but this cannot be |
| 323 // tested with this test. So the result of this test should be that the | 320 // tested with this test. So the result of this test should be that the |
| 324 // bounds are exactly as passed in. | 321 // bounds are exactly as passed in. |
| 325 EXPECT_EQ("1,6 25x30", w1->bounds().ToString()); | 322 EXPECT_EQ("1,6 25x30", w1->bounds().ToString()); |
| 326 } | 323 } |
| 327 | 324 |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 EXPECT_FALSE(wm::IsActiveWindow(w2.get())); | 906 EXPECT_FALSE(wm::IsActiveWindow(w2.get())); |
| 910 | 907 |
| 911 w2->Focus(); | 908 w2->Focus(); |
| 912 EXPECT_TRUE(w2->IsVisible()); | 909 EXPECT_TRUE(w2->IsVisible()); |
| 913 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); | 910 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); |
| 914 EXPECT_FALSE(w1->IsVisible()); | 911 EXPECT_FALSE(w1->IsVisible()); |
| 915 } | 912 } |
| 916 | 913 |
| 917 } // namespace internal | 914 } // namespace internal |
| 918 } // namespace ash | 915 } // namespace ash |
| OLD | NEW |