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

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

Issue 7031053: Make Widget ownership a little clearer by expressing it in terms of an enum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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 | « views/widget/native_widget_win.cc ('k') | views/widget/widget.h » ('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) 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/native_widget_win.h" 5 #include "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 27 matching lines...) Expand all
38 38
39 private: 39 private:
40 MessageLoopForUI message_loop_; 40 MessageLoopForUI message_loop_;
41 41
42 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWinTest); 42 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWinTest);
43 }; 43 };
44 44
45 NativeWidgetWin* NativeWidgetWinTest::CreateNativeWidgetWin() { 45 NativeWidgetWin* NativeWidgetWinTest::CreateNativeWidgetWin() {
46 scoped_ptr<Widget> widget(new Widget); 46 scoped_ptr<Widget> widget(new Widget);
47 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); 47 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW);
48 params.delete_on_destroy = false; 48 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
49 params.bounds = gfx::Rect(50, 50, 650, 650); 49 params.bounds = gfx::Rect(50, 50, 650, 650);
50 widget->Init(params); 50 widget->Init(params);
51 return static_cast<NativeWidgetWin*>(widget.release()->native_widget()); 51 return static_cast<NativeWidgetWin*>(widget.release()->native_widget());
52 } 52 }
53 53
54 TEST_F(NativeWidgetWinTest, ZoomWindow) { 54 TEST_F(NativeWidgetWinTest, ZoomWindow) {
55 scoped_ptr<NativeWidgetWin> window(CreateNativeWidgetWin()); 55 scoped_ptr<NativeWidgetWin> window(CreateNativeWidgetWin());
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);
(...skipping 18 matching lines...) Expand all
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 }
84 84
85 } // namespace 85 } // namespace
86 } // namespace views 86 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/native_widget_win.cc ('k') | views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698