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

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

Issue 8417008: aura: Add fullscreen/popups to RenderWidgetHostViewAura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge 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/test/aura_test_base.h" 10 #include "ui/aura/test/aura_test_base.h"
(...skipping 23 matching lines...) Expand all
34 container_.reset( 34 container_.reset(
35 CreateTestWindow(gfx::Rect(0, 0, 500, 400), desktop)); 35 CreateTestWindow(gfx::Rect(0, 0, 500, 400), desktop));
36 workspace_controller_.reset( 36 workspace_controller_.reset(
37 new internal::WorkspaceController(container_.get())); 37 new internal::WorkspaceController(container_.get()));
38 38
39 desktop->SetHostSize(gfx::Size(500, 400)); 39 desktop->SetHostSize(gfx::Size(500, 400));
40 } 40 }
41 41
42 aura::Window* CreateTestWindowWithType(const gfx::Rect& bounds, 42 aura::Window* CreateTestWindowWithType(const gfx::Rect& bounds,
43 aura::Window* parent, 43 aura::Window* parent,
44 Widget::InitParams::Type type) { 44 aura::WindowType type) {
45 aura::Window* window = new aura::Window(NULL); 45 aura::Window* window = new aura::Window(NULL);
46 props_.push_back(new ui::ViewProp(
47 window, views::NativeWidgetAura::kWindowTypeKey,
48 reinterpret_cast<void*>(type)));
49 window->SetType(type); 46 window->SetType(type);
50 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); 47 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
51 window->SetBounds(bounds); 48 window->SetBounds(bounds);
52 window->Show(); 49 window->Show();
53 window->SetParent(parent); 50 window->SetParent(parent);
54 return window; 51 return window;
55 } 52 }
56 53
57 aura::Window* CreateTestWindow(const gfx::Rect& bounds, 54 aura::Window* CreateTestWindow(const gfx::Rect& bounds,
58 aura::Window* parent) { 55 aura::Window* parent) {
59 return CreateTestWindowWithType(bounds, 56 return CreateTestWindowWithType(bounds,
60 parent, 57 parent,
61 Widget::InitParams::TYPE_WINDOW); 58 aura::WINDOW_TYPE_NORMAL);
62 } 59 }
63 60
64 aura::Window* container() { return container_.get(); } 61 aura::Window* container() { return container_.get(); }
65 62
66 DefaultContainerLayoutManager* default_container_layout_manager() { 63 DefaultContainerLayoutManager* default_container_layout_manager() {
67 return workspace_controller_->layout_manager(); 64 return workspace_controller_->layout_manager();
68 } 65 }
69 66
70 protected: 67 protected:
71 scoped_ptr<aura::Window> container_; 68 scoped_ptr<aura::Window> container_;
72 ScopedVector<ui::ViewProp> props_;
73 scoped_ptr<aura_shell::internal::WorkspaceController> workspace_controller_; 69 scoped_ptr<aura_shell::internal::WorkspaceController> workspace_controller_;
74 70
75 private: 71 private:
76 DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest); 72 DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest);
77 }; 73 };
78 74
79 } // namespace 75 } // namespace
80 76
81 #if !defined(OS_WIN) 77 #if !defined(OS_WIN)
82 TEST_F(DefaultContainerLayoutManagerTest, SetBounds) { 78 TEST_F(DefaultContainerLayoutManagerTest, SetBounds) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 EXPECT_EQ("450,0 50x50", child->GetTargetBounds().ToString()); 113 EXPECT_EQ("450,0 50x50", child->GetTargetBounds().ToString());
118 default_container_layout_manager()->EndMove(child.get(), NULL); 114 default_container_layout_manager()->EndMove(child.get(), NULL);
119 EXPECT_EQ(original_bounds.ToString(), child->GetTargetBounds().ToString()); 115 EXPECT_EQ(original_bounds.ToString(), child->GetTargetBounds().ToString());
120 } 116 }
121 #endif 117 #endif
122 118
123 TEST_F(DefaultContainerLayoutManagerTest, Popup) { 119 TEST_F(DefaultContainerLayoutManagerTest, Popup) {
124 scoped_ptr<aura::Window> popup( 120 scoped_ptr<aura::Window> popup(
125 CreateTestWindowWithType(gfx::Rect(0, -1000, 100, 100), 121 CreateTestWindowWithType(gfx::Rect(0, -1000, 100, 100),
126 container(), 122 container(),
127 Widget::InitParams::TYPE_POPUP)); 123 aura::WINDOW_TYPE_POPUP));
128 // A popup window can be placed outside of draggable area. 124 // A popup window can be placed outside of draggable area.
129 EXPECT_EQ("0,-1000 100x100", popup->bounds().ToString()); 125 EXPECT_EQ("0,-1000 100x100", popup->bounds().ToString());
130 126
131 // A popup window can be moved to outside of draggable area. 127 // A popup window can be moved to outside of draggable area.
132 popup->SetBounds(gfx::Rect(-100, 0, 100, 100)); 128 popup->SetBounds(gfx::Rect(-100, 0, 100, 100));
133 EXPECT_EQ("-100,0 100x100", popup->bounds().ToString()); 129 EXPECT_EQ("-100,0 100x100", popup->bounds().ToString());
134 130
135 // A popup window can be resized to the size bigger than draggable area. 131 // A popup window can be resized to the size bigger than draggable area.
136 popup->SetBounds(gfx::Rect(0, 0, 1000, 1000)); 132 popup->SetBounds(gfx::Rect(0, 0, 1000, 1000));
137 EXPECT_EQ("0,0 1000x1000", popup->bounds().ToString()); 133 EXPECT_EQ("0,0 1000x1000", popup->bounds().ToString());
(...skipping 12 matching lines...) Expand all
150 aura::Desktop::GetInstance()->AddTransientChild(window.get()); 146 aura::Desktop::GetInstance()->AddTransientChild(window.get());
151 window->SetBounds(gfx::Rect(0, 0, 200, 200)); 147 window->SetBounds(gfx::Rect(0, 0, 200, 200));
152 window->Show(); 148 window->Show();
153 window->SetParent(container()); 149 window->SetParent(container());
154 150
155 EXPECT_EQ("0,0 200x200", window->bounds().ToString()); 151 EXPECT_EQ("0,0 200x200", window->bounds().ToString());
156 } 152 }
157 153
158 } // namespace test 154 } // namespace test
159 } // namespace aura_shell 155 } // 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