| 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_win.h" | 5 #include "ui/views/widget/native_widget_win.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 MessageLoopForUI message_loop_; | 36 MessageLoopForUI message_loop_; |
| 37 ui::ScopedOleInitializer ole_initializer_; | 37 ui::ScopedOleInitializer ole_initializer_; |
| 38 | 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWinTest); | 39 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWinTest); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 NativeWidgetWin* NativeWidgetWinTest::CreateNativeWidgetWin() { | 42 NativeWidgetWin* NativeWidgetWinTest::CreateNativeWidgetWin() { |
| 43 scoped_ptr<Widget> widget(new Widget); | 43 scoped_ptr<Widget> widget(new Widget); |
| 44 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); | 44 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); |
| 45 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | |
| 46 params.bounds = gfx::Rect(50, 50, 650, 650); | 45 params.bounds = gfx::Rect(50, 50, 650, 650); |
| 47 widget->Init(params); | 46 widget->Init(params); |
| 48 return static_cast<NativeWidgetWin*>(widget.release()->native_widget()); | 47 return static_cast<NativeWidgetWin*>(widget.release()->native_widget()); |
| 49 } | 48 } |
| 50 | 49 |
| 51 TEST_F(NativeWidgetWinTest, ZoomWindow) { | 50 TEST_F(NativeWidgetWinTest, ZoomWindow) { |
| 52 scoped_ptr<NativeWidgetWin> window(CreateNativeWidgetWin()); | 51 scoped_ptr<NativeWidgetWin> window(CreateNativeWidgetWin()); |
| 53 ShowWindow(window->GetNativeView(), SW_HIDE); | 52 ShowWindow(window->GetNativeView(), SW_HIDE); |
| 54 EXPECT_FALSE(window->IsActive()); | 53 EXPECT_FALSE(window->IsActive()); |
| 55 ShowWindow(window->GetNativeView(), SW_MAXIMIZE); | 54 ShowWindow(window->GetNativeView(), SW_MAXIMIZE); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 74 EXPECT_FALSE(IsZoomed(window->GetNativeView())); | 73 EXPECT_FALSE(IsZoomed(window->GetNativeView())); |
| 75 EXPECT_FALSE(window->IsActive()); | 74 EXPECT_FALSE(window->IsActive()); |
| 76 | 75 |
| 77 // Cleanup. | 76 // Cleanup. |
| 78 window->CloseNow(); | 77 window->CloseNow(); |
| 79 window2->CloseNow(); | 78 window2->CloseNow(); |
| 80 } | 79 } |
| 81 | 80 |
| 82 } // namespace | 81 } // namespace |
| 83 } // namespace views | 82 } // namespace views |
| OLD | NEW |