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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « ui/views/widget/native_widget_mac.mm ('k') | no next file » | 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 3076 matching lines...) Expand 10 before | Expand all | Expand 10 after
3087 // Drargging. Cover HasCapture() and NativeWidgetPrivate::IsMouseButtonDown(). 3087 // Drargging. Cover HasCapture() and NativeWidgetPrivate::IsMouseButtonDown().
3088 generator.DragMouseTo(gfx::Point(40, 40)); 3088 generator.DragMouseTo(gfx::Point(40, 40));
3089 EXPECT_EQ(3, view->GetEventCount(ui::ET_MOUSE_PRESSED)); 3089 EXPECT_EQ(3, view->GetEventCount(ui::ET_MOUSE_PRESSED));
3090 EXPECT_EQ(3, view->GetEventCount(ui::ET_MOUSE_RELEASED)); 3090 EXPECT_EQ(3, view->GetEventCount(ui::ET_MOUSE_RELEASED));
3091 EXPECT_EQ(1, view->GetEventCount(ui::ET_MOUSE_DRAGGED)); 3091 EXPECT_EQ(1, view->GetEventCount(ui::ET_MOUSE_DRAGGED));
3092 EXPECT_EQ(ui::EF_LEFT_MOUSE_BUTTON, view->last_flags()); 3092 EXPECT_EQ(ui::EF_LEFT_MOUSE_BUTTON, view->last_flags());
3093 3093
3094 widget->CloseNow(); 3094 widget->CloseNow();
3095 } 3095 }
3096 3096
3097 // Tests that the root view is correctly set up for Widget types that do not
3098 // require a non-client view, before any other views are added to the widget.
3099 // That is, before Widget::ReorderNativeViews() is called which, if called with
3100 // a root view not set, could cause the root view to get resized to the widget.
3101 TEST_F(WidgetTest, NonClientWindowValidAfterInit) {
3102 Widget* widget = CreateTopLevelFramelessPlatformWidget();
3103 View* root_view = widget->GetRootView();
3104
3105 // Size the root view to exceed the widget bounds.
3106 const gfx::Rect test_rect(0, 0, 500, 500);
3107 root_view->SetBoundsRect(test_rect);
3108
3109 EXPECT_NE(test_rect.size(), widget->GetWindowBoundsInScreen().size());
3110
3111 EXPECT_EQ(test_rect, root_view->bounds());
3112 widget->ReorderNativeViews();
3113 EXPECT_EQ(test_rect, root_view->bounds());
3114
3115 widget->CloseNow();
3116 }
3117
3097 } // namespace test 3118 } // namespace test
3098 } // namespace views 3119 } // namespace views
OLDNEW
« 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