Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 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.
| |
| 3107 root_view->SetBoundsRect(kTestRect); | |
| 3108 | |
| 3109 EXPECT_NE(kTestRect.size(), widget->GetWindowBoundsInScreen().size()); | |
| 3110 | |
| 3111 EXPECT_EQ(kTestRect, root_view->bounds()); | |
| 3112 widget->ReorderNativeViews(); | |
| 3113 EXPECT_EQ(kTestRect, root_view->bounds()); | |
| 3114 | |
| 3115 widget->CloseNow(); | |
| 3116 } | |
| 3117 | |
| 3097 } // namespace test | 3118 } // namespace test |
| 3098 } // namespace views | 3119 } // namespace views |
| OLD | NEW |