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

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: use aura::WindowType 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
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 26 matching lines...) Expand all
37 37
38 desktop->SetHostSize(gfx::Size(500, 400)); 38 desktop->SetHostSize(gfx::Size(500, 400));
39 default_container_layout_manager_ = new DefaultContainerLayoutManager( 39 default_container_layout_manager_ = new DefaultContainerLayoutManager(
40 container_.get(), workspace_manager_.get()); 40 container_.get(), workspace_manager_.get());
41 // draggable area is 0,0 500x400. 41 // draggable area is 0,0 500x400.
42 container_->SetLayoutManager(default_container_layout_manager_); 42 container_->SetLayoutManager(default_container_layout_manager_);
43 } 43 }
44 44
45 aura::Window* CreateTestWindowWithType(const gfx::Rect& bounds, 45 aura::Window* CreateTestWindowWithType(const gfx::Rect& bounds,
46 aura::Window* parent, 46 aura::Window* parent,
47 Widget::InitParams::Type type) { 47 aura::WindowType type) {
48 aura::Window* window = new aura::Window(NULL); 48 aura::Window* window = new aura::Window(NULL);
49 props_.push_back(new ui::ViewProp(
50 window, views::NativeWidgetAura::kWindowTypeKey,
51 reinterpret_cast<void*>(type)));
52 window->SetType(type); 49 window->SetType(type);
53 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); 50 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE,
51 aura::Window::LAYER_INITIALLY_INVISIBLE);
54 window->SetBounds(bounds); 52 window->SetBounds(bounds);
55 window->Show(); 53 window->Show();
56 window->SetParent(parent); 54 window->SetParent(parent);
57 return window; 55 return window;
58 } 56 }
59 57
60 aura::Window* CreateTestWindow(const gfx::Rect& bounds, 58 aura::Window* CreateTestWindow(const gfx::Rect& bounds,
61 aura::Window* parent) { 59 aura::Window* parent) {
62 return CreateTestWindowWithType(bounds, 60 return CreateTestWindowWithType(bounds,
63 parent, 61 parent,
64 Widget::InitParams::TYPE_WINDOW); 62 aura::WINDOW_TYPE_NORMAL);
65 } 63 }
66 64
67 aura::Window* container() { return container_.get(); } 65 aura::Window* container() { return container_.get(); }
68 66
69 DefaultContainerLayoutManager* default_container_layout_manager() { 67 DefaultContainerLayoutManager* default_container_layout_manager() {
70 return default_container_layout_manager_; 68 return default_container_layout_manager_;
71 } 69 }
72 70
73 71
74 private: 72 private:
75 scoped_ptr<aura::Window> container_; 73 scoped_ptr<aura::Window> container_;
76 ScopedVector<ui::ViewProp> props_;
77 scoped_ptr<aura_shell::WorkspaceManager> workspace_manager_; 74 scoped_ptr<aura_shell::WorkspaceManager> workspace_manager_;
78 DefaultContainerLayoutManager* default_container_layout_manager_; 75 DefaultContainerLayoutManager* default_container_layout_manager_;
79 76
80 DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest); 77 DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest);
81 }; 78 };
82 79
83 } // namespace 80 } // namespace
84 81
85 #if !defined(OS_WIN) 82 #if !defined(OS_WIN)
86 TEST_F(DefaultContainerLayoutManagerTest, SetBounds) { 83 TEST_F(DefaultContainerLayoutManagerTest, SetBounds) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 EXPECT_EQ("450,0 50x50", child->GetTargetBounds().ToString()); 118 EXPECT_EQ("450,0 50x50", child->GetTargetBounds().ToString());
122 default_container_layout_manager()->EndMove(child.get(), NULL); 119 default_container_layout_manager()->EndMove(child.get(), NULL);
123 EXPECT_EQ(original_bounds.ToString(), child->GetTargetBounds().ToString()); 120 EXPECT_EQ(original_bounds.ToString(), child->GetTargetBounds().ToString());
124 } 121 }
125 #endif 122 #endif
126 123
127 TEST_F(DefaultContainerLayoutManagerTest, Popup) { 124 TEST_F(DefaultContainerLayoutManagerTest, Popup) {
128 scoped_ptr<aura::Window> popup( 125 scoped_ptr<aura::Window> popup(
129 CreateTestWindowWithType(gfx::Rect(0, -1000, 100, 100), 126 CreateTestWindowWithType(gfx::Rect(0, -1000, 100, 100),
130 container(), 127 container(),
131 Widget::InitParams::TYPE_POPUP)); 128 aura::WINDOW_TYPE_POPUP));
132 // A popup window can be placed outside of draggable area. 129 // A popup window can be placed outside of draggable area.
133 EXPECT_EQ("0,-1000 100x100", popup->bounds().ToString()); 130 EXPECT_EQ("0,-1000 100x100", popup->bounds().ToString());
134 131
135 // A popup window can be moved to outside of draggable area. 132 // A popup window can be moved to outside of draggable area.
136 popup->SetBounds(gfx::Rect(-100, 0, 100, 100)); 133 popup->SetBounds(gfx::Rect(-100, 0, 100, 100));
137 EXPECT_EQ("-100,0 100x100", popup->bounds().ToString()); 134 EXPECT_EQ("-100,0 100x100", popup->bounds().ToString());
138 135
139 // A popup window can be resized to the size bigger than draggable area. 136 // A popup window can be resized to the size bigger than draggable area.
140 popup->SetBounds(gfx::Rect(0, 0, 1000, 1000)); 137 popup->SetBounds(gfx::Rect(0, 0, 1000, 1000));
141 EXPECT_EQ("0,0 1000x1000", popup->bounds().ToString()); 138 EXPECT_EQ("0,0 1000x1000", popup->bounds().ToString());
142 } 139 }
143 140
144 } // namespace test 141 } // namespace test
145 } // namespace aura_shell 142 } // namespace aura_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698