OLD | NEW |
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 "views/widget/native_widget_views.h" | 5 #include "views/widget/native_widget_views.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return static_cast<const internal::NativeWidgetPrivate*>(widget-> | 150 return static_cast<const internal::NativeWidgetPrivate*>(widget-> |
151 native_widget())-> HasMouseCapture(); | 151 native_widget())-> HasMouseCapture(); |
152 } | 152 } |
153 | 153 |
154 //////////////////////////////////////////////////////////////////////////////// | 154 //////////////////////////////////////////////////////////////////////////////// |
155 // Widget::GetTopLevelWidget tests. | 155 // Widget::GetTopLevelWidget tests. |
156 | 156 |
157 TEST_F(WidgetTest, GetTopLevelWidget_Native) { | 157 TEST_F(WidgetTest, GetTopLevelWidget_Native) { |
158 // Create a hierarchy of native widgets. | 158 // Create a hierarchy of native widgets. |
159 Widget* toplevel = CreateTopLevelPlatformWidget(); | 159 Widget* toplevel = CreateTopLevelPlatformWidget(); |
160 #if defined(OS_WIN) | 160 #if defined(TOOLKIT_USES_GTK) |
161 gfx::NativeView parent = toplevel->GetNativeView(); | |
162 #elif defined(TOOLKIT_USES_GTK) | |
163 NativeWidgetGtk* native_widget = | 161 NativeWidgetGtk* native_widget = |
164 static_cast<NativeWidgetGtk*>(toplevel->native_widget()); | 162 static_cast<NativeWidgetGtk*>(toplevel->native_widget()); |
165 gfx::NativeView parent = native_widget->window_contents(); | 163 gfx::NativeView parent = native_widget->window_contents(); |
| 164 #else |
| 165 gfx::NativeView parent = toplevel->GetNativeView(); |
166 #endif | 166 #endif |
167 Widget* child = CreateChildPlatformWidget(parent); | 167 Widget* child = CreateChildPlatformWidget(parent); |
168 | 168 |
169 EXPECT_EQ(toplevel, toplevel->GetTopLevelWidget()); | 169 EXPECT_EQ(toplevel, toplevel->GetTopLevelWidget()); |
170 EXPECT_EQ(toplevel, child->GetTopLevelWidget()); | 170 EXPECT_EQ(toplevel, child->GetTopLevelWidget()); |
171 | 171 |
172 toplevel->CloseNow(); | 172 toplevel->CloseNow(); |
173 // |child| should be automatically destroyed with |toplevel|. | 173 // |child| should be automatically destroyed with |toplevel|. |
174 } | 174 } |
175 | 175 |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 | 708 |
709 child1->Show(); | 709 child1->Show(); |
710 EXPECT_EQ(child1, widget_shown()); | 710 EXPECT_EQ(child1, widget_shown()); |
711 | 711 |
712 child2->Show(); | 712 child2->Show(); |
713 EXPECT_EQ(child2, widget_shown()); | 713 EXPECT_EQ(child2, widget_shown()); |
714 } | 714 } |
715 | 715 |
716 } // namespace | 716 } // namespace |
717 } // namespace views | 717 } // namespace views |
OLD | NEW |