Chromium Code Reviews| 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, MinimizedStateTest) { | |
| 104 scoped_ptr<aura::Window> parent(new aura::Window(NULL)); | |
| 105 parent->Init(ui::LAYER_NOT_DRAWN); | |
| 106 parent->SetBounds(gfx::Rect(0, 0, 1024, 800)); | |
| 107 scoped_ptr<Widget> widget(new Widget()); | |
| 108 NativeWidgetAura* window = Init(parent.get(), widget.get()); | |
| 109 window->ShowWithWindowState(ui::SHOW_STATE_MINIMIZED); | |
|
sadrul
2015/06/12 21:53:49
Can you instead do:
Widget::InitParams params(T
joone
2015/06/12 23:51:40
Done.
| |
| 110 | |
| 111 EXPECT_TRUE(window->IsMinimized()); | |
| 112 widget->CloseNow(); | |
| 113 } | |
| 114 | |
| 103 class TestLayoutManagerBase : public aura::LayoutManager { | 115 class TestLayoutManagerBase : public aura::LayoutManager { |
| 104 public: | 116 public: |
| 105 TestLayoutManagerBase() {} | 117 TestLayoutManagerBase() {} |
| 106 ~TestLayoutManagerBase() override {} | 118 ~TestLayoutManagerBase() override {} |
| 107 | 119 |
| 108 // aura::LayoutManager: | 120 // aura::LayoutManager: |
| 109 void OnWindowResized() override {} | 121 void OnWindowResized() override {} |
| 110 void OnWindowAddedToLayout(aura::Window* child) override {} | 122 void OnWindowAddedToLayout(aura::Window* child) override {} |
| 111 void OnWillRemoveWindowFromLayout(aura::Window* child) override {} | 123 void OnWillRemoveWindowFromLayout(aura::Window* child) override {} |
| 112 void OnWindowRemovedFromLayout(aura::Window* child) override {} | 124 void OnWindowRemovedFromLayout(aura::Window* child) override {} |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 delegate->ClearGotMove(); | 477 delegate->ClearGotMove(); |
| 466 // Simulate a maximize with animation. | 478 // Simulate a maximize with animation. |
| 467 delete widget->GetNativeView()->RecreateLayer().release(); | 479 delete widget->GetNativeView()->RecreateLayer().release(); |
| 468 widget->SetBounds(gfx::Rect(0, 0, 500, 500)); | 480 widget->SetBounds(gfx::Rect(0, 0, 500, 500)); |
| 469 EXPECT_TRUE(delegate->got_move()); | 481 EXPECT_TRUE(delegate->got_move()); |
| 470 widget->CloseNow(); | 482 widget->CloseNow(); |
| 471 } | 483 } |
| 472 | 484 |
| 473 } // namespace | 485 } // namespace |
| 474 } // namespace views | 486 } // namespace views |
| OLD | NEW |