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" | |
12 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
13 #include "ui/aura_shell/activation_controller.h" | 12 #include "ui/aura_shell/activation_controller.h" |
14 #include "ui/aura_shell/shell_window_ids.h" | 13 #include "ui/aura_shell/shell_window_ids.h" |
15 #include "ui/aura_shell/workspace/workspace.h" | 14 #include "ui/aura_shell/workspace/workspace.h" |
16 #include "ui/aura_shell/workspace/workspace_observer.h" | 15 #include "ui/aura_shell/workspace/workspace_observer.h" |
17 #include "ui/base/ui_base_types.h" | 16 #include "ui/base/ui_base_types.h" |
18 | 17 |
19 namespace { | 18 namespace { |
20 using aura_shell::internal::Workspace; | 19 using aura_shell::internal::Workspace; |
21 using aura_shell::internal::WorkspaceManager; | 20 using aura_shell::internal::WorkspaceManager; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 }; | 72 }; |
74 | 73 |
75 } // namespace | 74 } // namespace |
76 | 75 |
77 namespace aura_shell { | 76 namespace aura_shell { |
78 namespace internal { | 77 namespace internal { |
79 | 78 |
80 class WorkspaceManagerTestBase : public aura::test::AuraTestBase { | 79 class WorkspaceManagerTestBase : public aura::test::AuraTestBase { |
81 public: | 80 public: |
82 WorkspaceManagerTestBase() { | 81 WorkspaceManagerTestBase() { |
83 aura::test::TestStackingClient* stacking_client = | 82 aura::RootWindow::GetInstance()->set_id( |
84 static_cast<aura::test::TestStackingClient*>( | |
85 aura::RootWindow::GetInstance()->stacking_client()); | |
86 stacking_client->default_container()->set_id( | |
87 internal::kShellWindowId_DefaultContainer); | 83 internal::kShellWindowId_DefaultContainer); |
88 activation_controller_.reset(new internal::ActivationController); | 84 activation_controller_.reset(new internal::ActivationController); |
89 activation_controller_->set_default_container_for_test( | 85 activation_controller_->set_default_container_for_test( |
90 stacking_client->default_container()); | 86 aura::RootWindow::GetInstance()); |
91 } | 87 } |
92 virtual ~WorkspaceManagerTestBase() {} | 88 virtual ~WorkspaceManagerTestBase() {} |
93 | 89 |
94 virtual void SetUp() OVERRIDE { | 90 virtual void SetUp() OVERRIDE { |
95 aura::test::AuraTestBase::SetUp(); | 91 aura::test::AuraTestBase::SetUp(); |
96 manager_.reset(new WorkspaceManager(viewport())); | 92 manager_.reset(new WorkspaceManager(viewport())); |
97 } | 93 } |
98 | 94 |
99 virtual void TearDown() OVERRIDE { | 95 virtual void TearDown() OVERRIDE { |
100 manager_.reset(); | 96 manager_.reset(); |
101 aura::test::AuraTestBase::TearDown(); | 97 aura::test::AuraTestBase::TearDown(); |
102 } | 98 } |
103 | 99 |
104 aura::Window* CreateTestWindow() { | 100 aura::Window* CreateTestWindow() { |
105 aura::Window* window = new aura::Window(NULL); | 101 aura::Window* window = new aura::Window(NULL); |
106 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); | 102 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); |
107 return window; | 103 return window; |
108 } | 104 } |
109 | 105 |
110 aura::Window* viewport() { | 106 aura::Window* viewport() { |
111 return GetTestStackingClient()->default_container(); | 107 return aura::RootWindow::GetInstance(); |
112 } | 108 } |
113 scoped_ptr<WorkspaceManager> manager_; | 109 scoped_ptr<WorkspaceManager> manager_; |
114 | 110 |
115 private: | 111 private: |
116 scoped_ptr<internal::ActivationController> activation_controller_; | 112 scoped_ptr<internal::ActivationController> activation_controller_; |
117 | 113 |
118 DISALLOW_COPY_AND_ASSIGN(WorkspaceManagerTestBase); | 114 DISALLOW_COPY_AND_ASSIGN(WorkspaceManagerTestBase); |
119 }; | 115 }; |
120 | 116 |
121 class WorkspaceManagerTest : public WorkspaceManagerTestBase { | 117 class WorkspaceManagerTest : public WorkspaceManagerTestBase { |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 558 |
563 w2->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 559 w2->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
564 EXPECT_TRUE(ws->ContainsFullscreenWindow()); | 560 EXPECT_TRUE(ws->ContainsFullscreenWindow()); |
565 | 561 |
566 w2->Hide(); | 562 w2->Hide(); |
567 EXPECT_FALSE(ws->ContainsFullscreenWindow()); | 563 EXPECT_FALSE(ws->ContainsFullscreenWindow()); |
568 } | 564 } |
569 | 565 |
570 } // namespace internal | 566 } // namespace internal |
571 } // namespace aura_shell | 567 } // namespace aura_shell |
OLD | NEW |