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

Side by Side Diff: ui/aura_shell/workspace/workspace_manager_unittest.cc

Issue 8894018: Move the concept of Activation to the Shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | « ui/aura_shell/workspace/workspace.cc ('k') | ui/aura_shell/workspace_controller.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/aura_shell/workspace/workspace_manager.h" 5 #include "ui/aura_shell/workspace/workspace_manager.h"
6 6
7 #include "ui/aura/client/aura_constants.h" 7 #include "ui/aura/client/aura_constants.h"
8 #include "ui/aura/root_window.h" 8 #include "ui/aura/root_window.h"
9 #include "ui/aura/screen_aura.h" 9 #include "ui/aura/screen_aura.h"
10 #include "ui/aura/test/aura_test_base.h" 10 #include "ui/aura/test/aura_test_base.h"
11 #include "ui/aura/test/test_stacking_client.h" 11 #include "ui/aura/test/test_stacking_client.h"
12 #include "ui/aura/window.h" 12 #include "ui/aura/window.h"
13 #include "ui/aura_shell/activation_controller.h"
14 #include "ui/aura_shell/shell_window_ids.h"
13 #include "ui/aura_shell/workspace/workspace.h" 15 #include "ui/aura_shell/workspace/workspace.h"
14 #include "ui/aura_shell/workspace/workspace_observer.h" 16 #include "ui/aura_shell/workspace/workspace_observer.h"
15 #include "ui/base/ui_base_types.h" 17 #include "ui/base/ui_base_types.h"
16 18
17 namespace { 19 namespace {
18 using aura_shell::internal::Workspace; 20 using aura_shell::internal::Workspace;
19 using aura_shell::internal::WorkspaceManager; 21 using aura_shell::internal::WorkspaceManager;
20 using aura::Window; 22 using aura::Window;
21 23
22 class TestWorkspaceObserver : public aura_shell::internal::WorkspaceObserver { 24 class TestWorkspaceObserver : public aura_shell::internal::WorkspaceObserver {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 DISALLOW_COPY_AND_ASSIGN(TestWorkspaceObserver); 72 DISALLOW_COPY_AND_ASSIGN(TestWorkspaceObserver);
71 }; 73 };
72 74
73 } // namespace 75 } // namespace
74 76
75 namespace aura_shell { 77 namespace aura_shell {
76 namespace internal { 78 namespace internal {
77 79
78 class WorkspaceManagerTestBase : public aura::test::AuraTestBase { 80 class WorkspaceManagerTestBase : public aura::test::AuraTestBase {
79 public: 81 public:
80 WorkspaceManagerTestBase() {} 82 WorkspaceManagerTestBase() {
83 aura::test::TestStackingClient* stacking_client =
84 static_cast<aura::test::TestStackingClient*>(
85 aura::RootWindow::GetInstance()->stacking_client());
86 stacking_client->default_container()->set_id(
87 internal::kShellWindowId_DefaultContainer);
88 activation_controller_.reset(new internal::ActivationController);
89 activation_controller_->set_default_container_for_test(
90 stacking_client->default_container());
91 }
81 virtual ~WorkspaceManagerTestBase() {} 92 virtual ~WorkspaceManagerTestBase() {}
82 93
83 virtual void SetUp() OVERRIDE { 94 virtual void SetUp() OVERRIDE {
84 aura::test::AuraTestBase::SetUp(); 95 aura::test::AuraTestBase::SetUp();
85 manager_.reset(new WorkspaceManager(viewport())); 96 manager_.reset(new WorkspaceManager(viewport()));
86 } 97 }
87 98
88 virtual void TearDown() OVERRIDE { 99 virtual void TearDown() OVERRIDE {
89 manager_.reset(); 100 manager_.reset();
90 aura::test::AuraTestBase::TearDown(); 101 aura::test::AuraTestBase::TearDown();
91 } 102 }
92 103
93 aura::Window* CreateTestWindow() { 104 aura::Window* CreateTestWindow() {
94 aura::Window* window = new aura::Window(NULL); 105 aura::Window* window = new aura::Window(NULL);
95 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); 106 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
96 return window; 107 return window;
97 } 108 }
98 109
99 aura::Window* viewport() { 110 aura::Window* viewport() {
100 return GetTestStackingClient()->default_container(); 111 return GetTestStackingClient()->default_container();
101 } 112 }
102 scoped_ptr<WorkspaceManager> manager_; 113 scoped_ptr<WorkspaceManager> manager_;
103 114
104 private: 115 private:
116 scoped_ptr<internal::ActivationController> activation_controller_;
117
105 DISALLOW_COPY_AND_ASSIGN(WorkspaceManagerTestBase); 118 DISALLOW_COPY_AND_ASSIGN(WorkspaceManagerTestBase);
106 }; 119 };
107 120
108 class WorkspaceManagerTest : public WorkspaceManagerTestBase { 121 class WorkspaceManagerTest : public WorkspaceManagerTestBase {
109 }; 122 };
110 123
111 TEST_F(WorkspaceManagerTest, WorkspaceManagerCreateAddFind) { 124 TEST_F(WorkspaceManagerTest, WorkspaceManagerCreateAddFind) {
112 scoped_ptr<Window> w1(CreateTestWindow()); 125 scoped_ptr<Window> w1(CreateTestWindow());
113 scoped_ptr<Window> w2(CreateTestWindow()); 126 scoped_ptr<Window> w2(CreateTestWindow());
114 127
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 562
550 w2->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 563 w2->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
551 EXPECT_TRUE(ws->ContainsFullscreenWindow()); 564 EXPECT_TRUE(ws->ContainsFullscreenWindow());
552 565
553 w2->Hide(); 566 w2->Hide();
554 EXPECT_FALSE(ws->ContainsFullscreenWindow()); 567 EXPECT_FALSE(ws->ContainsFullscreenWindow());
555 } 568 }
556 569
557 } // namespace internal 570 } // namespace internal
558 } // namespace aura_shell 571 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/workspace/workspace.cc ('k') | ui/aura_shell/workspace_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698