| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
| 10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 widget->Init(params); | 485 widget->Init(params); |
| 486 | 486 |
| 487 // Now destroy the native widget. | 487 // Now destroy the native widget. |
| 488 widget->CloseNow(); | 488 widget->CloseNow(); |
| 489 | 489 |
| 490 EXPECT_TRUE(state.widget_deleted); | 490 EXPECT_TRUE(state.widget_deleted); |
| 491 EXPECT_TRUE(state.native_widget_deleted); | 491 EXPECT_TRUE(state.native_widget_deleted); |
| 492 } | 492 } |
| 493 | 493 |
| 494 // NativeWidget owns its Widget, part 2: NativeWidget is a NativeWidget. | 494 // NativeWidget owns its Widget, part 2: NativeWidget is a NativeWidget. |
| 495 #if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK) | 495 #if defined(TOOLKIT_USES_GTK) |
| 496 // Temporarily disable the test (http://crbug.com/104945). | 496 // Temporarily disable the test (http://crbug.com/104945). |
| 497 TEST_F(WidgetOwnershipTest, DISABLED_Ownership_ViewsNativeWidgetOwnsWidget) { | 497 TEST_F(WidgetOwnershipTest, DISABLED_Ownership_ViewsNativeWidgetOwnsWidget) { |
| 498 #else | 498 #else |
| 499 TEST_F(WidgetOwnershipTest, Ownership_ViewsNativeWidgetOwnsWidget) { | 499 TEST_F(WidgetOwnershipTest, Ownership_ViewsNativeWidgetOwnsWidget) { |
| 500 #endif | 500 #endif |
| 501 OwnershipTestState state; | 501 OwnershipTestState state; |
| 502 | 502 |
| 503 Widget* toplevel = CreateTopLevelPlatformWidget(); | 503 Widget* toplevel = CreateTopLevelPlatformWidget(); |
| 504 | 504 |
| 505 Widget* widget = new OwnershipTestWidget(&state); | 505 Widget* widget = new OwnershipTestWidget(&state); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 #elif defined(TOOLKIT_USES_GTK) | 540 #elif defined(TOOLKIT_USES_GTK) |
| 541 gtk_widget_destroy(widget->GetNativeView()); | 541 gtk_widget_destroy(widget->GetNativeView()); |
| 542 #endif | 542 #endif |
| 543 | 543 |
| 544 EXPECT_TRUE(state.widget_deleted); | 544 EXPECT_TRUE(state.widget_deleted); |
| 545 EXPECT_TRUE(state.native_widget_deleted); | 545 EXPECT_TRUE(state.native_widget_deleted); |
| 546 } | 546 } |
| 547 | 547 |
| 548 // NativeWidget owns its Widget, part 4: NativeWidget is a NativeWidget, | 548 // NativeWidget owns its Widget, part 4: NativeWidget is a NativeWidget, |
| 549 // destroyed by the view hierarchy that contains it. | 549 // destroyed by the view hierarchy that contains it. |
| 550 #if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK) | 550 #if defined(TOOLKIT_USES_GTK) |
| 551 // Temporarily disable the test (http://crbug.com/104945). | 551 // Temporarily disable the test (http://crbug.com/104945). |
| 552 TEST_F(WidgetOwnershipTest, | 552 TEST_F(WidgetOwnershipTest, |
| 553 DISABLED_Ownership_ViewsNativeWidgetOwnsWidget_NativeDestroy) { | 553 DISABLED_Ownership_ViewsNativeWidgetOwnsWidget_NativeDestroy) { |
| 554 #else | 554 #else |
| 555 TEST_F(WidgetOwnershipTest, | 555 TEST_F(WidgetOwnershipTest, |
| 556 Ownership_ViewsNativeWidgetOwnsWidget_NativeDestroy) { | 556 Ownership_ViewsNativeWidgetOwnsWidget_NativeDestroy) { |
| 557 #endif | 557 #endif |
| 558 OwnershipTestState state; | 558 OwnershipTestState state; |
| 559 | 559 |
| 560 Widget* toplevel = CreateTopLevelPlatformWidget(); | 560 Widget* toplevel = CreateTopLevelPlatformWidget(); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 RunPendingMessages(); | 758 RunPendingMessages(); |
| 759 EXPECT_NE(toplevel->GetWindowScreenBounds().ToString(), | 759 EXPECT_NE(toplevel->GetWindowScreenBounds().ToString(), |
| 760 toplevel->GetRestoredBounds().ToString()); | 760 toplevel->GetRestoredBounds().ToString()); |
| 761 EXPECT_GT(toplevel->GetRestoredBounds().width(), 0); | 761 EXPECT_GT(toplevel->GetRestoredBounds().width(), 0); |
| 762 EXPECT_GT(toplevel->GetRestoredBounds().height(), 0); | 762 EXPECT_GT(toplevel->GetRestoredBounds().height(), 0); |
| 763 } | 763 } |
| 764 #endif | 764 #endif |
| 765 | 765 |
| 766 } // namespace | 766 } // namespace |
| 767 } // namespace views | 767 } // namespace views |
| OLD | NEW |