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

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

Issue 10852003: Changes all non-workspace code to talk to WorkspaceManager via (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more constness 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
« no previous file with comments | « ash/wm/workspace/workspace_manager.cc ('k') | ash/wm/workspace/workspace_types.h » ('j') | 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"
11 #include "ash/wm/activation_controller.h" 11 #include "ash/wm/activation_controller.h"
12 #include "ash/wm/property_util.h" 12 #include "ash/wm/property_util.h"
13 #include "ash/wm/shelf_layout_manager.h" 13 #include "ash/wm/shelf_layout_manager.h"
14 #include "ash/wm/window_util.h" 14 #include "ash/wm/window_util.h"
15 #include "ash/wm/workspace/workspace.h" 15 #include "ash/wm/workspace/workspace.h"
16 #include "ash/wm/workspace/workspace_layout_manager.h" 16 #include "ash/wm/workspace/workspace_layout_manager.h"
17 #include "ash/wm/workspace_controller.h" 17 #include "ash/wm/workspace_controller_test_helper.h"
18 #include "ui/aura/client/aura_constants.h" 18 #include "ui/aura/client/aura_constants.h"
19 #include "ui/aura/root_window.h" 19 #include "ui/aura/root_window.h"
20 #include "ui/aura/test/event_generator.h" 20 #include "ui/aura/test/event_generator.h"
21 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
22 #include "ui/base/ui_base_types.h" 22 #include "ui/base/ui_base_types.h"
23 #include "ui/compositor/layer.h" 23 #include "ui/compositor/layer.h"
24 #include "ui/gfx/screen.h" 24 #include "ui/gfx/screen.h"
25 25
26 using aura::Window; 26 using aura::Window;
27 27
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return manager_->active_workspace_; 68 return manager_->active_workspace_;
69 } 69 }
70 70
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 Shell::TestApi shell_test(Shell::GetInstance()); 78 WorkspaceControllerTestHelper workspace_helper(
79 manager_ = shell_test.workspace_controller()->workspace_manager(); 79 Shell::TestApi(Shell::GetInstance()).workspace_controller());
80 manager_ = workspace_helper.workspace_manager();
80 manager_->set_grid_size(0); 81 manager_->set_grid_size(0);
81 } 82 }
82 virtual void TearDown() OVERRIDE { 83 virtual void TearDown() OVERRIDE {
83 manager_ = NULL; 84 manager_ = NULL;
84 test::AshTestBase::TearDown(); 85 test::AshTestBase::TearDown();
85 } 86 }
86 87
87 protected: 88 protected:
88 WorkspaceManager* manager_; 89 WorkspaceManager* manager_;
89 90
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 601
601 scoped_ptr<Window> w2(CreateTestWindow()); 602 scoped_ptr<Window> w2(CreateTestWindow());
602 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 603 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
603 SetPersistsAcrossAllWorkspaces( 604 SetPersistsAcrossAllWorkspaces(
604 w2.get(), 605 w2.get(),
605 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 606 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
606 w2->Show(); 607 w2->Show();
607 608
608 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); 609 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
609 ASSERT_FALSE(manager_->ShouldManageWindow(w2.get())); 610 ASSERT_FALSE(manager_->ShouldManageWindow(w2.get()));
610 EXPECT_EQ(WorkspaceManager::WINDOW_STATE_FULL_SCREEN, 611 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN,
611 manager_->GetWindowState()); 612 manager_->GetWindowState());
612 613
613 w2->Hide(); 614 w2->Hide();
614 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 615 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
615 616
616 w2->Show(); 617 w2->Show();
617 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); 618 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
618 619
619 w2.reset(); 620 w2.reset();
620 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 621 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
(...skipping 15 matching lines...) Expand all
636 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 637 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
637 SetPersistsAcrossAllWorkspaces( 638 SetPersistsAcrossAllWorkspaces(
638 w2.get(), 639 w2.get(),
639 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 640 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
640 w2->Show(); 641 w2->Show();
641 642
642 // Even though auto-hide behavior is NEVER full-screen windows cause the shelf 643 // Even though auto-hide behavior is NEVER full-screen windows cause the shelf
643 // to hide. 644 // to hide.
644 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); 645 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
645 ASSERT_FALSE(manager_->ShouldManageWindow(w2.get())); 646 ASSERT_FALSE(manager_->ShouldManageWindow(w2.get()));
646 EXPECT_EQ(WorkspaceManager::WINDOW_STATE_FULL_SCREEN, 647 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN,
647 manager_->GetWindowState()); 648 manager_->GetWindowState());
648 649
649 w2->Hide(); 650 w2->Hide();
650 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 651 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
651 652
652 w2->Show(); 653 w2->Show();
653 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); 654 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
654 EXPECT_EQ(WorkspaceManager::WINDOW_STATE_FULL_SCREEN, 655 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN,
655 manager_->GetWindowState()); 656 manager_->GetWindowState());
656 657
657 w2.reset(); 658 w2.reset();
658 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 659 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
659 } 660 }
660 661
661 // Makes sure that if animations are disabled on a window they don't get reset 662 // Makes sure that if animations are disabled on a window they don't get reset
662 // when switching workspaces. 663 // when switching workspaces.
663 TEST_F(WorkspaceManagerTest, DontResetAnimation) { 664 TEST_F(WorkspaceManagerTest, DontResetAnimation) {
664 scoped_ptr<Window> w1(CreateTestWindow()); 665 scoped_ptr<Window> w1(CreateTestWindow());
(...skipping 24 matching lines...) Expand all
689 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 690 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
690 EXPECT_TRUE(manager_->Contains(w1.get())); 691 EXPECT_TRUE(manager_->Contains(w1.get()));
691 692
692 // And resetting to normal should remove it. 693 // And resetting to normal should remove it.
693 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 694 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
694 EXPECT_FALSE(manager_->Contains(w1.get())); 695 EXPECT_FALSE(manager_->Contains(w1.get()));
695 } 696 }
696 697
697 } // namespace internal 698 } // namespace internal
698 } // namespace ash 699 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_manager.cc ('k') | ash/wm/workspace/workspace_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698