OLD | NEW |
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" | |
15 #include "ui/aura_shell/workspace/workspace.h" | 13 #include "ui/aura_shell/workspace/workspace.h" |
16 #include "ui/aura_shell/workspace/workspace_observer.h" | 14 #include "ui/aura_shell/workspace/workspace_observer.h" |
17 #include "ui/base/ui_base_types.h" | 15 #include "ui/base/ui_base_types.h" |
18 | 16 |
19 namespace { | 17 namespace { |
20 using aura_shell::internal::Workspace; | 18 using aura_shell::internal::Workspace; |
21 using aura_shell::internal::WorkspaceManager; | 19 using aura_shell::internal::WorkspaceManager; |
22 using aura::Window; | 20 using aura::Window; |
23 | 21 |
24 class TestWorkspaceObserver : public aura_shell::internal::WorkspaceObserver { | 22 class TestWorkspaceObserver : public aura_shell::internal::WorkspaceObserver { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 DISALLOW_COPY_AND_ASSIGN(TestWorkspaceObserver); | 70 DISALLOW_COPY_AND_ASSIGN(TestWorkspaceObserver); |
73 }; | 71 }; |
74 | 72 |
75 } // namespace | 73 } // namespace |
76 | 74 |
77 namespace aura_shell { | 75 namespace aura_shell { |
78 namespace internal { | 76 namespace internal { |
79 | 77 |
80 class WorkspaceManagerTestBase : public aura::test::AuraTestBase { | 78 class WorkspaceManagerTestBase : public aura::test::AuraTestBase { |
81 public: | 79 public: |
82 WorkspaceManagerTestBase() { | 80 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 } | |
92 virtual ~WorkspaceManagerTestBase() {} | 81 virtual ~WorkspaceManagerTestBase() {} |
93 | 82 |
94 virtual void SetUp() OVERRIDE { | 83 virtual void SetUp() OVERRIDE { |
95 aura::test::AuraTestBase::SetUp(); | 84 aura::test::AuraTestBase::SetUp(); |
96 manager_.reset(new WorkspaceManager(viewport())); | 85 manager_.reset(new WorkspaceManager(viewport())); |
97 } | 86 } |
98 | 87 |
99 virtual void TearDown() OVERRIDE { | 88 virtual void TearDown() OVERRIDE { |
100 manager_.reset(); | 89 manager_.reset(); |
101 aura::test::AuraTestBase::TearDown(); | 90 aura::test::AuraTestBase::TearDown(); |
102 } | 91 } |
103 | 92 |
104 aura::Window* CreateTestWindow() { | 93 aura::Window* CreateTestWindow() { |
105 aura::Window* window = new aura::Window(NULL); | 94 aura::Window* window = new aura::Window(NULL); |
106 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); | 95 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); |
107 return window; | 96 return window; |
108 } | 97 } |
109 | 98 |
110 aura::Window* viewport() { | 99 aura::Window* viewport() { |
111 return GetTestStackingClient()->default_container(); | 100 return GetTestStackingClient()->default_container(); |
112 } | 101 } |
113 scoped_ptr<WorkspaceManager> manager_; | 102 scoped_ptr<WorkspaceManager> manager_; |
114 | 103 |
115 private: | 104 private: |
116 scoped_ptr<internal::ActivationController> activation_controller_; | |
117 | |
118 DISALLOW_COPY_AND_ASSIGN(WorkspaceManagerTestBase); | 105 DISALLOW_COPY_AND_ASSIGN(WorkspaceManagerTestBase); |
119 }; | 106 }; |
120 | 107 |
121 class WorkspaceManagerTest : public WorkspaceManagerTestBase { | 108 class WorkspaceManagerTest : public WorkspaceManagerTestBase { |
122 }; | 109 }; |
123 | 110 |
124 TEST_F(WorkspaceManagerTest, WorkspaceManagerCreateAddFind) { | 111 TEST_F(WorkspaceManagerTest, WorkspaceManagerCreateAddFind) { |
125 scoped_ptr<Window> w1(CreateTestWindow()); | 112 scoped_ptr<Window> w1(CreateTestWindow()); |
126 scoped_ptr<Window> w2(CreateTestWindow()); | 113 scoped_ptr<Window> w2(CreateTestWindow()); |
127 | 114 |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 549 |
563 w2->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 550 w2->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
564 EXPECT_TRUE(ws->ContainsFullscreenWindow()); | 551 EXPECT_TRUE(ws->ContainsFullscreenWindow()); |
565 | 552 |
566 w2->Hide(); | 553 w2->Hide(); |
567 EXPECT_FALSE(ws->ContainsFullscreenWindow()); | 554 EXPECT_FALSE(ws->ContainsFullscreenWindow()); |
568 } | 555 } |
569 | 556 |
570 } // namespace internal | 557 } // namespace internal |
571 } // namespace aura_shell | 558 } // namespace aura_shell |
OLD | NEW |