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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 parent->SetBounds(gfx::Rect(20, 40, 480, 320)); | 93 parent->SetBounds(gfx::Rect(20, 40, 480, 320)); |
94 scoped_ptr<Widget> widget(new Widget()); | 94 scoped_ptr<Widget> widget(new Widget()); |
95 NativeWidgetAura* window = Init(parent.get(), widget.get()); | 95 NativeWidgetAura* window = Init(parent.get(), widget.get()); |
96 window->CenterWindow(gfx::Size(500, 600)); | 96 window->CenterWindow(gfx::Size(500, 600)); |
97 | 97 |
98 // |window| should be no bigger than |parent|. | 98 // |window| should be no bigger than |parent|. |
99 EXPECT_EQ("20,40 480x320", window->GetNativeWindow()->bounds().ToString()); | 99 EXPECT_EQ("20,40 480x320", window->GetNativeWindow()->bounds().ToString()); |
100 widget->CloseNow(); | 100 widget->CloseNow(); |
101 } | 101 } |
102 | 102 |
| 103 TEST_F(NativeWidgetAuraTest, CreateMinimized) { |
| 104 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); |
| 105 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 106 params.parent = NULL; |
| 107 params.context = root_window(); |
| 108 params.show_state = ui::SHOW_STATE_MINIMIZED; |
| 109 params.bounds.SetRect(0, 0, 1024, 800); |
| 110 scoped_ptr<Widget> widget(new Widget()); |
| 111 widget->Init(params); |
| 112 widget->Show(); |
| 113 |
| 114 EXPECT_TRUE(widget->IsMinimized()); |
| 115 widget->CloseNow(); |
| 116 } |
| 117 |
103 class TestLayoutManagerBase : public aura::LayoutManager { | 118 class TestLayoutManagerBase : public aura::LayoutManager { |
104 public: | 119 public: |
105 TestLayoutManagerBase() {} | 120 TestLayoutManagerBase() {} |
106 ~TestLayoutManagerBase() override {} | 121 ~TestLayoutManagerBase() override {} |
107 | 122 |
108 // aura::LayoutManager: | 123 // aura::LayoutManager: |
109 void OnWindowResized() override {} | 124 void OnWindowResized() override {} |
110 void OnWindowAddedToLayout(aura::Window* child) override {} | 125 void OnWindowAddedToLayout(aura::Window* child) override {} |
111 void OnWillRemoveWindowFromLayout(aura::Window* child) override {} | 126 void OnWillRemoveWindowFromLayout(aura::Window* child) override {} |
112 void OnWindowRemovedFromLayout(aura::Window* child) override {} | 127 void OnWindowRemovedFromLayout(aura::Window* child) override {} |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 delegate->ClearGotMove(); | 480 delegate->ClearGotMove(); |
466 // Simulate a maximize with animation. | 481 // Simulate a maximize with animation. |
467 delete widget->GetNativeView()->RecreateLayer().release(); | 482 delete widget->GetNativeView()->RecreateLayer().release(); |
468 widget->SetBounds(gfx::Rect(0, 0, 500, 500)); | 483 widget->SetBounds(gfx::Rect(0, 0, 500, 500)); |
469 EXPECT_TRUE(delegate->got_move()); | 484 EXPECT_TRUE(delegate->got_move()); |
470 widget->CloseNow(); | 485 widget->CloseNow(); |
471 } | 486 } |
472 | 487 |
473 } // namespace | 488 } // namespace |
474 } // namespace views | 489 } // namespace views |
OLD | NEW |