Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: ui/views/widget/native_widget_win_unittest.cc

Issue 10892014: Make HWNDMessageHandler subclass WindowImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/native_widget_win.cc ('k') | ui/views/win/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(Widget::InitParams::TYPE_POPUP);
45 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 45 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
46 params.bounds = gfx::Rect(50, 50, 650, 650); 46 params.bounds = gfx::Rect(50, 50, 650, 650);
47 widget->Init(params); 47 widget->Init(params);
48 return static_cast<NativeWidgetWin*>(widget.release()->native_widget()); 48 return static_cast<NativeWidgetWin*>(widget.release()->native_widget());
49 } 49 }
50 50
51 TEST_F(NativeWidgetWinTest, ZoomWindow) { 51 TEST_F(NativeWidgetWinTest, ZoomWindow) {
52 scoped_ptr<NativeWidgetWin> window(CreateNativeWidgetWin()); 52 scoped_ptr<NativeWidgetWin> window(CreateNativeWidgetWin());
53 window->ShowWindow(SW_HIDE); 53 ShowWindow(window->GetNativeView(), SW_HIDE);
54 EXPECT_FALSE(window->IsActive()); 54 EXPECT_FALSE(window->IsActive());
55 window->ShowWindow(SW_MAXIMIZE); 55 ShowWindow(window->GetNativeView(), SW_MAXIMIZE);
56 EXPECT_TRUE(window->IsZoomed()); 56 EXPECT_TRUE(IsZoomed(window->GetNativeView()));
57 window->CloseNow(); 57 window->CloseNow();
58 } 58 }
59 59
60 TEST_F(NativeWidgetWinTest, SetBoundsForZoomedWindow) { 60 TEST_F(NativeWidgetWinTest, SetBoundsForZoomedWindow) {
61 scoped_ptr<NativeWidgetWin> window(CreateNativeWidgetWin()); 61 scoped_ptr<NativeWidgetWin> window(CreateNativeWidgetWin());
62 window->ShowWindow(SW_MAXIMIZE); 62 ShowWindow(window->GetNativeView(), SW_MAXIMIZE);
63 EXPECT_TRUE(window->IsZoomed()); 63 EXPECT_TRUE(IsZoomed(window->GetNativeView()));
64 64
65 // Create another window, so that it will be active. 65 // Create another window, so that it will be active.
66 scoped_ptr<NativeWidgetWin> window2(CreateNativeWidgetWin()); 66 scoped_ptr<NativeWidgetWin> window2(CreateNativeWidgetWin());
67 window2->ShowWindow(SW_MAXIMIZE); 67 ShowWindow(window2->GetNativeView(), SW_MAXIMIZE);
68 EXPECT_TRUE(window2->IsActive()); 68 EXPECT_TRUE(window2->IsActive());
69 EXPECT_FALSE(window->IsActive()); 69 EXPECT_FALSE(window->IsActive());
70 70
71 // Verify that setting the bounds of a zoomed window will unzoom it and not 71 // Verify that setting the bounds of a zoomed window will unzoom it and not
72 // cause it to be activated. 72 // cause it to be activated.
73 window->SetBounds(gfx::Rect(50, 50, 650, 650)); 73 window->SetBounds(gfx::Rect(50, 50, 650, 650));
74 EXPECT_FALSE(window->IsZoomed()); 74 EXPECT_FALSE(IsZoomed(window->GetNativeView()));
75 EXPECT_FALSE(window->IsActive()); 75 EXPECT_FALSE(window->IsActive());
76 76
77 // Cleanup. 77 // Cleanup.
78 window->CloseNow(); 78 window->CloseNow();
79 window2->CloseNow(); 79 window2->CloseNow();
80 } 80 }
81 81
82 } // namespace 82 } // namespace
83 } // namespace views 83 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_win.cc ('k') | ui/views/win/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698