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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 widget->IsActive() ? ui::SHOW_STATE_NORMAL : | 228 widget->IsActive() ? ui::SHOW_STATE_NORMAL : |
229 ui::SHOW_STATE_INACTIVE; | 229 ui::SHOW_STATE_INACTIVE; |
230 } | 230 } |
231 | 231 |
232 TEST_F(WidgetTest, WidgetInitParams) { | 232 TEST_F(WidgetTest, WidgetInitParams) { |
233 // Widgets are not transparent by default. | 233 // Widgets are not transparent by default. |
234 Widget::InitParams init1; | 234 Widget::InitParams init1; |
235 EXPECT_EQ(Widget::InitParams::INFER_OPACITY, init1.opacity); | 235 EXPECT_EQ(Widget::InitParams::INFER_OPACITY, init1.opacity); |
236 } | 236 } |
237 | 237 |
| 238 TEST_F(WidgetTest, NativeWindowProperty) { |
| 239 const char* key = "foo"; |
| 240 int value = 3; |
| 241 |
| 242 Widget* widget = CreateTopLevelPlatformWidget(); |
| 243 EXPECT_EQ(nullptr, widget->GetNativeWindowProperty(key)); |
| 244 |
| 245 widget->SetNativeWindowProperty(key, &value); |
| 246 EXPECT_EQ(&value, widget->GetNativeWindowProperty(key)); |
| 247 |
| 248 widget->SetNativeWindowProperty(key, nullptr); |
| 249 EXPECT_EQ(nullptr, widget->GetNativeWindowProperty(key)); |
| 250 |
| 251 widget->CloseNow(); |
| 252 } |
| 253 |
238 //////////////////////////////////////////////////////////////////////////////// | 254 //////////////////////////////////////////////////////////////////////////////// |
239 // Widget::GetTopLevelWidget tests. | 255 // Widget::GetTopLevelWidget tests. |
240 | 256 |
241 TEST_F(WidgetTest, GetTopLevelWidget_Native) { | 257 TEST_F(WidgetTest, GetTopLevelWidget_Native) { |
242 // Create a hierarchy of native widgets. | 258 // Create a hierarchy of native widgets. |
243 Widget* toplevel = CreateTopLevelPlatformWidget(); | 259 Widget* toplevel = CreateTopLevelPlatformWidget(); |
244 gfx::NativeView parent = toplevel->GetNativeView(); | 260 gfx::NativeView parent = toplevel->GetNativeView(); |
245 Widget* child = CreateChildPlatformWidget(parent); | 261 Widget* child = CreateChildPlatformWidget(parent); |
246 | 262 |
247 EXPECT_EQ(toplevel, toplevel->GetTopLevelWidget()); | 263 EXPECT_EQ(toplevel, toplevel->GetTopLevelWidget()); |
(...skipping 3146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3394 | 3410 |
3395 EXPECT_EQ(test_rect, root_view->bounds()); | 3411 EXPECT_EQ(test_rect, root_view->bounds()); |
3396 widget->ReorderNativeViews(); | 3412 widget->ReorderNativeViews(); |
3397 EXPECT_EQ(test_rect, root_view->bounds()); | 3413 EXPECT_EQ(test_rect, root_view->bounds()); |
3398 | 3414 |
3399 widget->CloseNow(); | 3415 widget->CloseNow(); |
3400 } | 3416 } |
3401 | 3417 |
3402 } // namespace test | 3418 } // namespace test |
3403 } // namespace views | 3419 } // namespace views |
OLD | NEW |