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..33bbfb71ce789e9d060d554ec36a4ec8af8add44 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 kTestRect(0, 0, 500, 500); |
sky
2014/09/10 14:48:36
nit: k is only for global or constants defined wit
tapted
2014/09/11 00:17:16
Done.
|
+ root_view->SetBoundsRect(kTestRect); |
+ |
+ EXPECT_NE(kTestRect.size(), widget->GetWindowBoundsInScreen().size()); |
+ |
+ EXPECT_EQ(kTestRect, root_view->bounds()); |
+ widget->ReorderNativeViews(); |
+ EXPECT_EQ(kTestRect, root_view->bounds()); |
+ |
+ widget->CloseNow(); |
+} |
+ |
} // namespace test |
} // namespace views |