| OLD | NEW |
| 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 Loading... |
| 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)); |
| 196 EXPECT_TRUE(child->GetProperty(aura::client::kCanResizeKey)); | 197 EXPECT_TRUE(child->GetProperty(aura::client::kCanResizeKey)); |
| 197 added_ = true; | 198 added_ = true; |
| 198 } | 199 } |
| 199 | 200 |
| 200 bool added_; | 201 bool added_; |
| 201 | 202 |
| 202 DISALLOW_COPY_AND_ASSIGN(PropertyTestLayoutManager); | 203 DISALLOW_COPY_AND_ASSIGN(PropertyTestLayoutManager); |
| 203 }; | 204 }; |
| 204 | 205 |
| 205 class PropertyTestWidgetDelegate : public views::WidgetDelegate { | 206 class PropertyTestWidgetDelegate : public views::WidgetDelegate { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 225 return widget_; | 226 return widget_; |
| 226 } | 227 } |
| 227 virtual const Widget* GetWidget() const OVERRIDE { | 228 virtual const Widget* GetWidget() const OVERRIDE { |
| 228 return widget_; | 229 return widget_; |
| 229 } | 230 } |
| 230 | 231 |
| 231 Widget* widget_; | 232 Widget* widget_; |
| 232 DISALLOW_COPY_AND_ASSIGN(PropertyTestWidgetDelegate); | 233 DISALLOW_COPY_AND_ASSIGN(PropertyTestWidgetDelegate); |
| 233 }; | 234 }; |
| 234 | 235 |
| 235 // Verifies that the kCanMaximizeKey/kCanReizeKey have the correct | 236 // Verifies that the kCanMaximizeKey/kCanMinimizeKey/kCanResizeKey have the |
| 236 // value when added to the layout manager. | 237 // correct value when added to the layout manager. |
| 237 TEST_F(NativeWidgetAuraTest, TestPropertiesWhenAddedToLayout) { | 238 TEST_F(NativeWidgetAuraTest, TestPropertiesWhenAddedToLayout) { |
| 238 root_window()->SetBounds(gfx::Rect(0, 0, 640, 480)); | 239 root_window()->SetBounds(gfx::Rect(0, 0, 640, 480)); |
| 239 PropertyTestLayoutManager* layout_manager = new PropertyTestLayoutManager(); | 240 PropertyTestLayoutManager* layout_manager = new PropertyTestLayoutManager(); |
| 240 root_window()->SetLayoutManager(layout_manager); | 241 root_window()->SetLayoutManager(layout_manager); |
| 241 scoped_ptr<TestWidget> widget(new TestWidget()); | 242 scoped_ptr<TestWidget> widget(new TestWidget()); |
| 242 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); | 243 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); |
| 243 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 244 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 244 params.delegate = new PropertyTestWidgetDelegate(widget.get()); | 245 params.delegate = new PropertyTestWidgetDelegate(widget.get()); |
| 245 params.parent = NULL; | 246 params.parent = NULL; |
| 246 params.context = root_window(); | 247 params.context = root_window(); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 delegate->ClearGotMove(); | 477 delegate->ClearGotMove(); |
| 477 // Simulate a maximize with animation. | 478 // Simulate a maximize with animation. |
| 478 delete widget->GetNativeView()->RecreateLayer().release(); | 479 delete widget->GetNativeView()->RecreateLayer().release(); |
| 479 widget->SetBounds(gfx::Rect(0, 0, 500, 500)); | 480 widget->SetBounds(gfx::Rect(0, 0, 500, 500)); |
| 480 EXPECT_TRUE(delegate->got_move()); | 481 EXPECT_TRUE(delegate->got_move()); |
| 481 widget->CloseNow(); | 482 widget->CloseNow(); |
| 482 } | 483 } |
| 483 | 484 |
| 484 } // namespace | 485 } // namespace |
| 485 } // namespace views | 486 } // namespace views |
| OLD | NEW |