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 "ash/wm/default_container_layout_manager.h" | 5 #include "ash/wm/default_container_layout_manager.h" |
6 | 6 |
7 #include "ash/wm/workspace/workspace.h" | 7 #include "ash/wm/workspace/workspace.h" |
8 #include "ash/wm/workspace/workspace_manager.h" | 8 #include "ash/wm/workspace/workspace_manager.h" |
9 #include "ash/wm/workspace_controller.h" | 9 #include "ash/wm/workspace_controller.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "ui/aura/client/aura_constants.h" | 13 #include "ui/aura/client/aura_constants.h" |
14 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
15 #include "ui/aura/screen_aura.h" | 15 #include "ui/aura/screen_aura.h" |
16 #include "ui/aura/test/aura_test_base.h" | 16 #include "ui/aura/test/aura_test_base.h" |
17 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
18 #include "ui/base/ui_base_types.h" | 18 #include "ui/base/ui_base_types.h" |
19 #include "ui/views/widget/native_widget_aura.h" | 19 #include "ui/views/widget/native_widget_aura.h" |
20 | 20 |
21 namespace aura_shell { | 21 namespace ash { |
22 namespace test { | 22 namespace test { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 using views::Widget; | 26 using views::Widget; |
27 using aura_shell::internal::DefaultContainerLayoutManager; | 27 using ash::internal::DefaultContainerLayoutManager; |
28 | 28 |
29 class DefaultContainerLayoutManagerTest : public aura::test::AuraTestBase { | 29 class DefaultContainerLayoutManagerTest : public aura::test::AuraTestBase { |
30 public: | 30 public: |
31 DefaultContainerLayoutManagerTest() : layout_manager_(NULL) {} | 31 DefaultContainerLayoutManagerTest() : layout_manager_(NULL) {} |
32 virtual ~DefaultContainerLayoutManagerTest() {} | 32 virtual ~DefaultContainerLayoutManagerTest() {} |
33 | 33 |
34 virtual void SetUp() OVERRIDE { | 34 virtual void SetUp() OVERRIDE { |
35 aura::test::AuraTestBase::SetUp(); | 35 aura::test::AuraTestBase::SetUp(); |
36 aura::RootWindow* root_window = aura::RootWindow::GetInstance(); | 36 aura::RootWindow* root_window = aura::RootWindow::GetInstance(); |
37 container_.reset( | 37 container_.reset( |
38 CreateTestWindow(gfx::Rect(0, 0, 500, 400), root_window)); | 38 CreateTestWindow(gfx::Rect(0, 0, 500, 400), root_window)); |
39 workspace_controller_.reset( | 39 workspace_controller_.reset( |
40 new aura_shell::internal::WorkspaceController(container_.get())); | 40 new ash::internal::WorkspaceController(container_.get())); |
41 layout_manager_ = new DefaultContainerLayoutManager( | 41 layout_manager_ = new DefaultContainerLayoutManager( |
42 workspace_controller_->workspace_manager()); | 42 workspace_controller_->workspace_manager()); |
43 container_->SetLayoutManager(layout_manager_); | 43 container_->SetLayoutManager(layout_manager_); |
44 | 44 |
45 root_window->SetHostSize(gfx::Size(500, 400)); | 45 root_window->SetHostSize(gfx::Size(500, 400)); |
46 } | 46 } |
47 | 47 |
48 aura::Window* CreateTestWindowWithType(const gfx::Rect& bounds, | 48 aura::Window* CreateTestWindowWithType(const gfx::Rect& bounds, |
49 aura::Window* parent, | 49 aura::Window* parent, |
50 aura::client::WindowType type) { | 50 aura::client::WindowType type) { |
(...skipping 13 matching lines...) Expand all Loading... |
64 aura::client::WINDOW_TYPE_NORMAL); | 64 aura::client::WINDOW_TYPE_NORMAL); |
65 } | 65 } |
66 | 66 |
67 aura::Window* container() { return container_.get(); } | 67 aura::Window* container() { return container_.get(); } |
68 | 68 |
69 DefaultContainerLayoutManager* default_container_layout_manager() { | 69 DefaultContainerLayoutManager* default_container_layout_manager() { |
70 return layout_manager_; | 70 return layout_manager_; |
71 } | 71 } |
72 | 72 |
73 protected: | 73 protected: |
74 aura_shell::internal::WorkspaceManager* workspace_manager() { | 74 ash::internal::WorkspaceManager* workspace_manager() { |
75 return workspace_controller_->workspace_manager(); | 75 return workspace_controller_->workspace_manager(); |
76 } | 76 } |
77 | 77 |
78 private: | 78 private: |
79 scoped_ptr<aura::Window> container_; | 79 scoped_ptr<aura::Window> container_; |
80 scoped_ptr<aura_shell::internal::WorkspaceController> workspace_controller_; | 80 scoped_ptr<ash::internal::WorkspaceController> workspace_controller_; |
81 // LayoutManager is owned by |container|. | 81 // LayoutManager is owned by |container|. |
82 aura_shell::internal::DefaultContainerLayoutManager* layout_manager_; | 82 ash::internal::DefaultContainerLayoutManager* layout_manager_; |
83 | 83 |
84 private: | 84 private: |
85 DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest); | 85 DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest); |
86 }; | 86 }; |
87 | 87 |
88 // Utility functions to set and get show state on |window|. | 88 // Utility functions to set and get show state on |window|. |
89 void Maximize(aura::Window* window) { | 89 void Maximize(aura::Window* window) { |
90 window->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 90 window->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
91 } | 91 } |
92 | 92 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 w1->GetTargetBounds().ToString()); | 331 w1->GetTargetBounds().ToString()); |
332 | 332 |
333 Restore(w1.get()); | 333 Restore(w1.get()); |
334 // The following test does not pass due to crbug.com/102413. | 334 // The following test does not pass due to crbug.com/102413. |
335 // TODO(oshima): Re-enable this once the bug is fixed. | 335 // TODO(oshima): Re-enable this once the bug is fixed. |
336 // EXPECT_EQ(window_bounds.size().ToString(), | 336 // EXPECT_EQ(window_bounds.size().ToString(), |
337 // w1->GetTargetBounds().size().ToString()); | 337 // w1->GetTargetBounds().size().ToString()); |
338 } | 338 } |
339 | 339 |
340 } // namespace test | 340 } // namespace test |
341 } // namespace aura_shell | 341 } // namespace ash |
OLD | NEW |