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

Side by Side Diff: ui/views/widget/native_widget_aura_unittest.cc

Issue 623613004: Revert of Make WindowState::CanMinimize() take into account WidgetDelegate::CanMinimize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 public: 186 public:
187 PropertyTestLayoutManager() : added_(false) {} 187 PropertyTestLayoutManager() : added_(false) {}
188 virtual ~PropertyTestLayoutManager() {} 188 virtual ~PropertyTestLayoutManager() {}
189 189
190 bool added() const { return added_; } 190 bool added() const { return added_; }
191 191
192 private: 192 private:
193 // aura::LayoutManager: 193 // aura::LayoutManager:
194 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE { 194 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE {
195 EXPECT_TRUE(child->GetProperty(aura::client::kCanMaximizeKey)); 195 EXPECT_TRUE(child->GetProperty(aura::client::kCanMaximizeKey));
196 EXPECT_TRUE(child->GetProperty(aura::client::kCanMinimizeKey));
197 EXPECT_TRUE(child->GetProperty(aura::client::kCanResizeKey)); 196 EXPECT_TRUE(child->GetProperty(aura::client::kCanResizeKey));
198 added_ = true; 197 added_ = true;
199 } 198 }
200 199
201 bool added_; 200 bool added_;
202 201
203 DISALLOW_COPY_AND_ASSIGN(PropertyTestLayoutManager); 202 DISALLOW_COPY_AND_ASSIGN(PropertyTestLayoutManager);
204 }; 203 };
205 204
206 class PropertyTestWidgetDelegate : public views::WidgetDelegate { 205 class PropertyTestWidgetDelegate : public views::WidgetDelegate {
(...skipping 19 matching lines...) Expand all
226 return widget_; 225 return widget_;
227 } 226 }
228 virtual const Widget* GetWidget() const OVERRIDE { 227 virtual const Widget* GetWidget() const OVERRIDE {
229 return widget_; 228 return widget_;
230 } 229 }
231 230
232 Widget* widget_; 231 Widget* widget_;
233 DISALLOW_COPY_AND_ASSIGN(PropertyTestWidgetDelegate); 232 DISALLOW_COPY_AND_ASSIGN(PropertyTestWidgetDelegate);
234 }; 233 };
235 234
236 // Verifies that the kCanMaximizeKey/kCanMinimizeKey/kCanResizeKey have the 235 // Verifies that the kCanMaximizeKey/kCanReizeKey have the correct
237 // correct value when added to the layout manager. 236 // value when added to the layout manager.
238 TEST_F(NativeWidgetAuraTest, TestPropertiesWhenAddedToLayout) { 237 TEST_F(NativeWidgetAuraTest, TestPropertiesWhenAddedToLayout) {
239 root_window()->SetBounds(gfx::Rect(0, 0, 640, 480)); 238 root_window()->SetBounds(gfx::Rect(0, 0, 640, 480));
240 PropertyTestLayoutManager* layout_manager = new PropertyTestLayoutManager(); 239 PropertyTestLayoutManager* layout_manager = new PropertyTestLayoutManager();
241 root_window()->SetLayoutManager(layout_manager); 240 root_window()->SetLayoutManager(layout_manager);
242 scoped_ptr<TestWidget> widget(new TestWidget()); 241 scoped_ptr<TestWidget> widget(new TestWidget());
243 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); 242 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW);
244 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 243 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
245 params.delegate = new PropertyTestWidgetDelegate(widget.get()); 244 params.delegate = new PropertyTestWidgetDelegate(widget.get());
246 params.parent = NULL; 245 params.parent = NULL;
247 params.context = root_window(); 246 params.context = root_window();
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 delegate->ClearGotMove(); 476 delegate->ClearGotMove();
478 // Simulate a maximize with animation. 477 // Simulate a maximize with animation.
479 delete widget->GetNativeView()->RecreateLayer().release(); 478 delete widget->GetNativeView()->RecreateLayer().release();
480 widget->SetBounds(gfx::Rect(0, 0, 500, 500)); 479 widget->SetBounds(gfx::Rect(0, 0, 500, 500));
481 EXPECT_TRUE(delegate->got_move()); 480 EXPECT_TRUE(delegate->got_move());
482 widget->CloseNow(); 481 widget->CloseNow();
483 } 482 }
484 483
485 } // namespace 484 } // namespace
486 } // namespace views 485 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698