Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: ash/wm/workspace/workspace_manager_unittest.cc

Issue 10857021: Prepare a bunch of ash tests for workspace2. With Workspace2 you can't (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/screen_ash.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 Workspace* FindBy(aura::Window* window) const { 71 Workspace* FindBy(aura::Window* window) const {
72 return manager_->FindBy(window); 72 return manager_->FindBy(window);
73 } 73 }
74 74
75 // Overridden from AshTestBase: 75 // Overridden from AshTestBase:
76 virtual void SetUp() OVERRIDE { 76 virtual void SetUp() OVERRIDE {
77 test::AshTestBase::SetUp(); 77 test::AshTestBase::SetUp();
78 WorkspaceControllerTestHelper workspace_helper( 78 WorkspaceControllerTestHelper workspace_helper(
79 Shell::TestApi(Shell::GetInstance()).workspace_controller()); 79 Shell::TestApi(Shell::GetInstance()).workspace_controller());
80 manager_ = workspace_helper.workspace_manager(); 80 manager_ = workspace_helper.workspace_manager();
81 manager_->set_grid_size(0); 81 manager_->SetGridSize(0);
82 } 82 }
83 virtual void TearDown() OVERRIDE { 83 virtual void TearDown() OVERRIDE {
84 manager_ = NULL; 84 manager_ = NULL;
85 test::AshTestBase::TearDown(); 85 test::AshTestBase::TearDown();
86 } 86 }
87 87
88 protected: 88 protected:
89 WorkspaceManager* manager_; 89 WorkspaceManager* manager_;
90 90
91 private: 91 private:
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 EXPECT_TRUE(manager_->ShouldManageWindow(w1.get())); 296 EXPECT_TRUE(manager_->ShouldManageWindow(w1.get()));
297 // Setting the bounds should go through since the window is in the normal 297 // Setting the bounds should go through since the window is in the normal
298 // workspace. 298 // workspace.
299 w1->SetBounds(gfx::Rect(0, 0, 200, 500)); 299 w1->SetBounds(gfx::Rect(0, 0, 200, 500));
300 EXPECT_EQ(200, w1->bounds().width()); 300 EXPECT_EQ(200, w1->bounds().width());
301 EXPECT_EQ(500, w1->bounds().height()); 301 EXPECT_EQ(500, w1->bounds().height());
302 } 302 }
303 303
304 // Assertions around grid size. 304 // Assertions around grid size.
305 TEST_F(WorkspaceManagerTest, SnapToGrid) { 305 TEST_F(WorkspaceManagerTest, SnapToGrid) {
306 manager_->set_grid_size(8); 306 manager_->SetGridSize(8);
307 307
308 // Verify snap to grid when bounds are set before parented. 308 // Verify snap to grid when bounds are set before parented.
309 scoped_ptr<Window> w1(CreateTestWindowUnparented()); 309 scoped_ptr<Window> w1(CreateTestWindowUnparented());
310 w1->SetBounds(gfx::Rect(1, 6, 25, 30)); 310 w1->SetBounds(gfx::Rect(1, 6, 25, 30));
311 w1->SetParent(GetViewport()); 311 w1->SetParent(GetViewport());
312 // We are not aligning this anymore this way. When the window gets shown 312 // We are not aligning this anymore this way. When the window gets shown
313 // the window is expected to be handled differently, but this cannot be 313 // the window is expected to be handled differently, but this cannot be
314 // tested with this test. So the result of this test should be that the 314 // tested with this test. So the result of this test should be that the
315 // bounds are exactly as passed in. 315 // bounds are exactly as passed in.
316 EXPECT_EQ(gfx::Rect(1, 6, 25, 30), w1->bounds()); 316 EXPECT_EQ(gfx::Rect(1, 6, 25, 30), w1->bounds());
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 wm::ActivateWindow(w1.get()); 703 wm::ActivateWindow(w1.get());
704 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 704 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
705 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); 705 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
706 EXPECT_EQ(ShelfLayoutManager::VISIBLE, 706 EXPECT_EQ(ShelfLayoutManager::VISIBLE,
707 Shell::GetInstance()->shelf()->visibility_state()); 707 Shell::GetInstance()->shelf()->visibility_state());
708 EXPECT_FALSE(Shell::GetInstance()->launcher()->paints_background()); 708 EXPECT_FALSE(Shell::GetInstance()->launcher()->paints_background());
709 } 709 }
710 710
711 } // namespace internal 711 } // namespace internal
712 } // namespace ash 712 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_manager.cc ('k') | ash/wm/workspace/workspace_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698