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

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

Issue 10828026: Renames two WorkspaceManager methods so that they are more clearly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
« no previous file with comments | « ash/wm/workspace/workspace_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 scoped_ptr<ActivationController> activation_controller_; 91 scoped_ptr<ActivationController> activation_controller_;
92 92
93 DISALLOW_COPY_AND_ASSIGN(WorkspaceManagerTest); 93 DISALLOW_COPY_AND_ASSIGN(WorkspaceManagerTest);
94 }; 94 };
95 95
96 // Assertions around adding a normal window. 96 // Assertions around adding a normal window.
97 TEST_F(WorkspaceManagerTest, AddNormalWindowWhenEmpty) { 97 TEST_F(WorkspaceManagerTest, AddNormalWindowWhenEmpty) {
98 scoped_ptr<Window> w1(CreateTestWindow()); 98 scoped_ptr<Window> w1(CreateTestWindow());
99 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); 99 w1->SetBounds(gfx::Rect(0, 0, 250, 251));
100 100
101 ASSERT_TRUE(manager_->IsManagedWindow(w1.get())); 101 ASSERT_TRUE(manager_->ShouldManageWindow(w1.get()));
102 EXPECT_FALSE(FindBy(w1.get())); 102 EXPECT_FALSE(FindBy(w1.get()));
103 103
104 EXPECT_TRUE(GetRestoreBoundsInScreen(w1.get()) == NULL); 104 EXPECT_TRUE(GetRestoreBoundsInScreen(w1.get()) == NULL);
105 105
106 w1->Show(); 106 w1->Show();
107 107
108 EXPECT_TRUE(GetRestoreBoundsInScreen(w1.get()) == NULL); 108 EXPECT_TRUE(GetRestoreBoundsInScreen(w1.get()) == NULL);
109 109
110 ASSERT_TRUE(w1->layer() != NULL); 110 ASSERT_TRUE(w1->layer() != NULL);
111 EXPECT_TRUE(w1->layer()->visible()); 111 EXPECT_TRUE(w1->layer()->visible());
112 112
113 EXPECT_EQ(250, w1->bounds().width()); 113 EXPECT_EQ(250, w1->bounds().width());
114 EXPECT_EQ(251, w1->bounds().height()); 114 EXPECT_EQ(251, w1->bounds().height());
115 115
116 // Should be 1 workspace, TYPE_NORNMAL with w1. 116 // Should be 1 workspace, TYPE_NORNMAL with w1.
117 ASSERT_EQ(1u, workspaces().size()); 117 ASSERT_EQ(1u, workspaces().size());
118 EXPECT_EQ(Workspace::TYPE_MANAGED, workspaces()[0]->type()); 118 EXPECT_EQ(Workspace::TYPE_MANAGED, workspaces()[0]->type());
119 ASSERT_EQ(1u, workspaces()[0]->windows().size()); 119 ASSERT_EQ(1u, workspaces()[0]->windows().size());
120 EXPECT_EQ(w1.get(), workspaces()[0]->windows()[0]); 120 EXPECT_EQ(w1.get(), workspaces()[0]->windows()[0]);
121 } 121 }
122 122
123 // Assertions around maximizing/unmaximizing. 123 // Assertions around maximizing/unmaximizing.
124 TEST_F(WorkspaceManagerTest, SingleMaximizeWindow) { 124 TEST_F(WorkspaceManagerTest, SingleMaximizeWindow) {
125 scoped_ptr<Window> w1(CreateTestWindow()); 125 scoped_ptr<Window> w1(CreateTestWindow());
126 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); 126 w1->SetBounds(gfx::Rect(0, 0, 250, 251));
127 127
128 ASSERT_TRUE(manager_->IsManagedWindow(w1.get())); 128 ASSERT_TRUE(manager_->ShouldManageWindow(w1.get()));
129 129
130 w1->Show(); 130 w1->Show();
131 131
132 ASSERT_TRUE(w1->layer() != NULL); 132 ASSERT_TRUE(w1->layer() != NULL);
133 EXPECT_TRUE(w1->layer()->visible()); 133 EXPECT_TRUE(w1->layer()->visible());
134 134
135 EXPECT_EQ(250, w1->bounds().width()); 135 EXPECT_EQ(250, w1->bounds().width());
136 EXPECT_EQ(251, w1->bounds().height()); 136 EXPECT_EQ(251, w1->bounds().height());
137 137
138 // Maximize the window. 138 // Maximize the window.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 EXPECT_FALSE(w1->layer()->visible()); 285 EXPECT_FALSE(w1->layer()->visible());
286 ASSERT_TRUE(w2->layer() != NULL); 286 ASSERT_TRUE(w2->layer() != NULL);
287 EXPECT_TRUE(w2->layer()->visible()); 287 EXPECT_TRUE(w2->layer()->visible());
288 } 288 }
289 289
290 // Makes sure requests to change the bounds of a normal window go through. 290 // Makes sure requests to change the bounds of a normal window go through.
291 TEST_F(WorkspaceManagerTest, ChangeBoundsOfNormalWindow) { 291 TEST_F(WorkspaceManagerTest, ChangeBoundsOfNormalWindow) {
292 scoped_ptr<Window> w1(CreateTestWindow()); 292 scoped_ptr<Window> w1(CreateTestWindow());
293 w1->Show(); 293 w1->Show();
294 294
295 EXPECT_TRUE(manager_->IsManagedWindow(w1.get())); 295 EXPECT_TRUE(manager_->ShouldManageWindow(w1.get()));
296 // Setting the bounds should go through since the window is in the normal 296 // Setting the bounds should go through since the window is in the normal
297 // workspace. 297 // workspace.
298 w1->SetBounds(gfx::Rect(0, 0, 200, 500)); 298 w1->SetBounds(gfx::Rect(0, 0, 200, 500));
299 EXPECT_EQ(200, w1->bounds().width()); 299 EXPECT_EQ(200, w1->bounds().width());
300 EXPECT_EQ(500, w1->bounds().height()); 300 EXPECT_EQ(500, w1->bounds().height());
301 } 301 }
302 302
303 // Assertions around grid size. 303 // Assertions around grid size.
304 TEST_F(WorkspaceManagerTest, SnapToGrid) { 304 TEST_F(WorkspaceManagerTest, SnapToGrid) {
305 manager_->set_grid_size(8); 305 manager_->set_grid_size(8);
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 w1->Show(); 599 w1->Show();
600 600
601 scoped_ptr<Window> w2(CreateTestWindow()); 601 scoped_ptr<Window> w2(CreateTestWindow());
602 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 602 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
603 SetPersistsAcrossAllWorkspaces( 603 SetPersistsAcrossAllWorkspaces(
604 w2.get(), 604 w2.get(),
605 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 605 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
606 w2->Show(); 606 w2->Show();
607 607
608 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); 608 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
609 ASSERT_FALSE(manager_->IsManagedWindow(w2.get())); 609 ASSERT_FALSE(manager_->ShouldManageWindow(w2.get()));
610 EXPECT_EQ(WorkspaceManager::WINDOW_STATE_FULL_SCREEN, 610 EXPECT_EQ(WorkspaceManager::WINDOW_STATE_FULL_SCREEN,
611 manager_->GetWindowState()); 611 manager_->GetWindowState());
612 612
613 w2->Hide(); 613 w2->Hide();
614 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 614 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
615 615
616 w2->Show(); 616 w2->Show();
617 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); 617 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
618 618
619 w2.reset(); 619 w2.reset();
(...skipping 15 matching lines...) Expand all
635 scoped_ptr<Window> w2(CreateTestWindow()); 635 scoped_ptr<Window> w2(CreateTestWindow());
636 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 636 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
637 SetPersistsAcrossAllWorkspaces( 637 SetPersistsAcrossAllWorkspaces(
638 w2.get(), 638 w2.get(),
639 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 639 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
640 w2->Show(); 640 w2->Show();
641 641
642 // Even though auto-hide behavior is NEVER full-screen windows cause the shelf 642 // Even though auto-hide behavior is NEVER full-screen windows cause the shelf
643 // to hide. 643 // to hide.
644 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); 644 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
645 ASSERT_FALSE(manager_->IsManagedWindow(w2.get())); 645 ASSERT_FALSE(manager_->ShouldManageWindow(w2.get()));
646 EXPECT_EQ(WorkspaceManager::WINDOW_STATE_FULL_SCREEN, 646 EXPECT_EQ(WorkspaceManager::WINDOW_STATE_FULL_SCREEN,
647 manager_->GetWindowState()); 647 manager_->GetWindowState());
648 648
649 w2->Hide(); 649 w2->Hide();
650 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 650 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
651 651
652 w2->Show(); 652 w2->Show();
653 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); 653 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
654 EXPECT_EQ(WorkspaceManager::WINDOW_STATE_FULL_SCREEN, 654 EXPECT_EQ(WorkspaceManager::WINDOW_STATE_FULL_SCREEN,
655 manager_->GetWindowState()); 655 manager_->GetWindowState());
(...skipping 11 matching lines...) Expand all
667 w1->Show(); 667 w1->Show();
668 w1->SetProperty(aura::client::kAnimationsDisabledKey, true); 668 w1->SetProperty(aura::client::kAnimationsDisabledKey, true);
669 669
670 w2->Show(); 670 w2->Show();
671 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 671 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
672 EXPECT_TRUE(w1->GetProperty(aura::client::kAnimationsDisabledKey)); 672 EXPECT_TRUE(w1->GetProperty(aura::client::kAnimationsDisabledKey));
673 } 673 }
674 674
675 } // namespace internal 675 } // namespace internal
676 } // namespace ash 676 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698