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

Side by Side Diff: views/focus/focus_manager_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 | « chrome/browser/ui/views/tabs/dragged_tab_view.cc ('k') | views/view_unittest.cc » ('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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 1588
1589 // Create a native dialog window. 1589 // Create a native dialog window.
1590 HWND hwnd = CreateWindowEx(0, class_ex.lpszClassName, NULL, 1590 HWND hwnd = CreateWindowEx(0, class_ex.lpszClassName, NULL,
1591 WS_OVERLAPPEDWINDOW, 0, 0, 200, 200, 1591 WS_OVERLAPPEDWINDOW, 0, 0, 200, 200,
1592 NULL, NULL, NULL, NULL); 1592 NULL, NULL, NULL, NULL);
1593 ASSERT_TRUE(hwnd); 1593 ASSERT_TRUE(hwnd);
1594 1594
1595 // Create a view window parented to native dialog. 1595 // Create a view window parented to native dialog.
1596 scoped_ptr<Widget> widget1(new Widget); 1596 scoped_ptr<Widget> widget1(new Widget);
1597 Widget::InitParams params(Widget::InitParams::TYPE_CONTROL); 1597 Widget::InitParams params(Widget::InitParams::TYPE_CONTROL);
1598 params.delete_on_destroy = false; 1598 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
1599 params.parent = hwnd; 1599 params.parent = hwnd;
1600 params.bounds = gfx::Rect(0, 0, 100, 100); 1600 params.bounds = gfx::Rect(0, 0, 100, 100);
1601 widget1->Init(params); 1601 widget1->Init(params);
1602 1602
1603 // Get the focus manager directly from the first window. Should exist 1603 // Get the focus manager directly from the first window. Should exist
1604 // because the first window is the root widget. 1604 // because the first window is the root widget.
1605 views::FocusManager* focus_manager_member1 = widget1->GetFocusManager(); 1605 views::FocusManager* focus_manager_member1 = widget1->GetFocusManager();
1606 EXPECT_TRUE(focus_manager_member1); 1606 EXPECT_TRUE(focus_manager_member1);
1607 1607
1608 // Create another view window parented to the first view window. 1608 // Create another view window parented to the first view window.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 1722
1723 // Focus manager should be the last one to destruct. 1723 // Focus manager should be the last one to destruct.
1724 ASSERT_STREQ("FocusManagerDtorTracked", dtor_tracker_[2].c_str()); 1724 ASSERT_STREQ("FocusManagerDtorTracked", dtor_tracker_[2].c_str());
1725 1725
1726 // Clear window_ so that we don't try to close it again. 1726 // Clear window_ so that we don't try to close it again.
1727 window_ = NULL; 1727 window_ = NULL;
1728 } 1728 }
1729 1729
1730 1730
1731 } // namespace views 1731 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/dragged_tab_view.cc ('k') | views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698