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

Side by Side Diff: ui/aura_shell/default_container_layout_manager_unittest.cc

Issue 8430024: Add WorkspaceObserver to observe changes in workspace state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comments Created 9 years, 1 month 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/default_container_layout_manager.cc ('k') | ui/aura_shell/shell.cc » ('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/default_container_layout_manager.h" 5 #include "ui/aura_shell/default_container_layout_manager.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "ui/aura/aura_constants.h" 10 #include "ui/aura/aura_constants.h"
(...skipping 10 matching lines...) Expand all
21 namespace aura_shell { 21 namespace aura_shell {
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 aura_shell::internal::DefaultContainerLayoutManager;
28 28
29 class DefaultContainerLayoutManagerTest : public aura::test::AuraTestBase { 29 class DefaultContainerLayoutManagerTest : public aura::test::AuraTestBase {
30 public: 30 public:
31 DefaultContainerLayoutManagerTest() {} 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::Desktop* desktop = aura::Desktop::GetInstance(); 36 aura::Desktop* desktop = aura::Desktop::GetInstance();
37 container_.reset( 37 container_.reset(
38 CreateTestWindow(gfx::Rect(0, 0, 500, 400), desktop)); 38 CreateTestWindow(gfx::Rect(0, 0, 500, 400), desktop));
39 workspace_controller_.reset( 39 workspace_controller_.reset(
40 new internal::WorkspaceController(container_.get())); 40 new aura_shell::internal::WorkspaceController(container_.get()));
41 layout_manager_ = new DefaultContainerLayoutManager(
42 workspace_controller_->workspace_manager());
43 container_->SetLayoutManager(layout_manager_);
41 44
42 desktop->SetHostSize(gfx::Size(500, 400)); 45 desktop->SetHostSize(gfx::Size(500, 400));
43 } 46 }
44 47
45 aura::Window* CreateTestWindowWithType(const gfx::Rect& bounds, 48 aura::Window* CreateTestWindowWithType(const gfx::Rect& bounds,
46 aura::Window* parent, 49 aura::Window* parent,
47 aura::WindowType type) { 50 aura::WindowType type) {
48 aura::Window* window = new aura::Window(NULL); 51 aura::Window* window = new aura::Window(NULL);
49 window->SetType(type); 52 window->SetType(type);
50 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); 53 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
51 window->SetBounds(bounds); 54 window->SetBounds(bounds);
52 window->Show(); 55 window->Show();
53 window->SetParent(parent); 56 window->SetParent(parent);
54 return window; 57 return window;
55 } 58 }
56 59
57 aura::Window* CreateTestWindow(const gfx::Rect& bounds, 60 aura::Window* CreateTestWindow(const gfx::Rect& bounds,
58 aura::Window* parent) { 61 aura::Window* parent) {
59 return CreateTestWindowWithType(bounds, 62 return CreateTestWindowWithType(bounds,
60 parent, 63 parent,
61 aura::WINDOW_TYPE_NORMAL); 64 aura::WINDOW_TYPE_NORMAL);
62 } 65 }
63 66
64 aura::Window* container() { return container_.get(); } 67 aura::Window* container() { return container_.get(); }
65 68
66 DefaultContainerLayoutManager* default_container_layout_manager() { 69 DefaultContainerLayoutManager* default_container_layout_manager() {
67 return workspace_controller_->layout_manager(); 70 return layout_manager_;
68 } 71 }
69 72
70 protected: 73 protected:
71 aura_shell::internal::WorkspaceManager* workspace_manager() { 74 aura_shell::internal::WorkspaceManager* workspace_manager() {
72 return workspace_controller_->layout_manager()->workspace_manager(); 75 return workspace_controller_->workspace_manager();
73 } 76 }
74 77
75 private: 78 private:
76 scoped_ptr<aura::Window> container_; 79 scoped_ptr<aura::Window> container_;
77 scoped_ptr<aura_shell::internal::WorkspaceController> workspace_controller_; 80 scoped_ptr<aura_shell::internal::WorkspaceController> workspace_controller_;
81 // LayoutManager is owned by |container|.
82 aura_shell::internal::DefaultContainerLayoutManager* layout_manager_;
78 83
79 private: 84 private:
80 DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest); 85 DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest);
81 }; 86 };
82 87
83 // Utility functions to set and get show state on |window|. 88 // Utility functions to set and get show state on |window|.
84 void Maximize(aura::Window* window) { 89 void Maximize(aura::Window* window) {
85 window->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 90 window->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
86 } 91 }
87 92
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 335
331 Restore(w1.get()); 336 Restore(w1.get());
332 // The following test does not pass due to crbug.com/102413. 337 // The following test does not pass due to crbug.com/102413.
333 // TODO(oshima): Re-enable this once the bug is fixed. 338 // TODO(oshima): Re-enable this once the bug is fixed.
334 // EXPECT_EQ(window_bounds.size().ToString(), 339 // EXPECT_EQ(window_bounds.size().ToString(),
335 // w1->GetTargetBounds().size().ToString()); 340 // w1->GetTargetBounds().size().ToString());
336 } 341 }
337 342
338 } // namespace test 343 } // namespace test
339 } // namespace aura_shell 344 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/default_container_layout_manager.cc ('k') | ui/aura_shell/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698