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

Unified Diff: ui/views/widget/widget_unittest.cc

Issue 559873002: MacViews: Ensure the RootView is in place before the first call to ReorderNativeViews (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20140909-MacViews-Everything-Compiles
Patch Set: kTestRect -> test_rect Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/native_widget_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget_unittest.cc
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc
index 6cc7d1aaeb0aea3220af87e5b745115e25b26a82..acd8ae8f7cc7e5fde0c28052eee43463a21cbf40 100644
--- a/ui/views/widget/widget_unittest.cc
+++ b/ui/views/widget/widget_unittest.cc
@@ -3094,5 +3094,26 @@ TEST_F(WidgetTest, MouseEventTypesViaGenerator) {
widget->CloseNow();
}
+// Tests that the root view is correctly set up for Widget types that do not
+// require a non-client view, before any other views are added to the widget.
+// That is, before Widget::ReorderNativeViews() is called which, if called with
+// a root view not set, could cause the root view to get resized to the widget.
+TEST_F(WidgetTest, NonClientWindowValidAfterInit) {
+ Widget* widget = CreateTopLevelFramelessPlatformWidget();
+ View* root_view = widget->GetRootView();
+
+ // Size the root view to exceed the widget bounds.
+ const gfx::Rect test_rect(0, 0, 500, 500);
+ root_view->SetBoundsRect(test_rect);
+
+ EXPECT_NE(test_rect.size(), widget->GetWindowBoundsInScreen().size());
+
+ EXPECT_EQ(test_rect, root_view->bounds());
+ widget->ReorderNativeViews();
+ EXPECT_EQ(test_rect, root_view->bounds());
+
+ widget->CloseNow();
+}
+
} // namespace test
} // namespace views
« no previous file with comments | « ui/views/widget/native_widget_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698