| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/widget_win.h" | 5 #include "views/widget/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 25 matching lines...) Expand all Loading... |
| 36 } | 36 } |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 MessageLoopForUI message_loop_; | 39 MessageLoopForUI message_loop_; |
| 40 | 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(WidgetWinTest); | 41 DISALLOW_COPY_AND_ASSIGN(WidgetWinTest); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 | 44 |
| 45 WidgetWin* WidgetWinTest::CreateWidgetWin() { | 45 WidgetWin* WidgetWinTest::CreateWidgetWin() { |
| 46 scoped_ptr<WidgetWin> widget(new WidgetWin()); | 46 scoped_ptr<Widget> widget(Widget::CreateWidget()); |
| 47 Widget::CreateParams params(Widget::CreateParams::TYPE_WINDOW); | 47 Widget::CreateParams params(Widget::CreateParams::TYPE_WINDOW); |
| 48 params.delete_on_destroy = false; | 48 params.delete_on_destroy = false; |
| 49 widget->SetCreateParams(params); | 49 params.bounds = gfx::Rect(50, 50, 650, 650); |
| 50 widget->Init(NULL, gfx::Rect(50, 50, 650, 650)); | 50 widget->Init(params); |
| 51 return widget.release(); | 51 return static_cast<WidgetWin*>(widget.release()->native_widget()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 TEST_F(WidgetWinTest, ZoomWindow) { | 54 TEST_F(WidgetWinTest, ZoomWindow) { |
| 55 scoped_ptr<WidgetWin> window(CreateWidgetWin()); | 55 scoped_ptr<WidgetWin> window(CreateWidgetWin()); |
| 56 window->ShowWindow(SW_HIDE); | 56 window->ShowWindow(SW_HIDE); |
| 57 EXPECT_FALSE(window->IsActive()); | 57 EXPECT_FALSE(window->IsActive()); |
| 58 window->ShowWindow(SW_MAXIMIZE); | 58 window->ShowWindow(SW_MAXIMIZE); |
| 59 EXPECT_TRUE(window->IsZoomed()); | 59 EXPECT_TRUE(window->IsZoomed()); |
| 60 window->CloseNow(); | 60 window->CloseNow(); |
| 61 } | 61 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 74 // Verify that setting the bounds of a zoomed window will unzoom it and not | 74 // Verify that setting the bounds of a zoomed window will unzoom it and not |
| 75 // cause it to be activated. | 75 // cause it to be activated. |
| 76 window->SetBounds(gfx::Rect(50, 50, 650, 650)); | 76 window->SetBounds(gfx::Rect(50, 50, 650, 650)); |
| 77 EXPECT_FALSE(window->IsZoomed()); | 77 EXPECT_FALSE(window->IsZoomed()); |
| 78 EXPECT_FALSE(window->IsActive()); | 78 EXPECT_FALSE(window->IsActive()); |
| 79 | 79 |
| 80 // Cleanup. | 80 // Cleanup. |
| 81 window->CloseNow(); | 81 window->CloseNow(); |
| 82 window2->CloseNow(); | 82 window2->CloseNow(); |
| 83 } | 83 } |
| OLD | NEW |