| 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 #include "ui/views/controls/native/native_view_host.h" | 6 #include "ui/views/controls/native/native_view_host.h" |
| 7 #include "ui/views/test/views_test_base.h" | 7 #include "ui/views/test/views_test_base.h" |
| 8 #include "ui/views/view.h" | 8 #include "ui/views/view.h" |
| 9 #include "ui/views/widget/native_widget_private.h" | 9 #include "ui/views/widget/native_widget_private.h" |
| 10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class NativeWidgetTest : public ViewsTestBase { | 35 class NativeWidgetTest : public ViewsTestBase { |
| 36 public: | 36 public: |
| 37 NativeWidgetTest() {} | 37 NativeWidgetTest() {} |
| 38 virtual ~NativeWidgetTest() {} | 38 virtual ~NativeWidgetTest() {} |
| 39 | 39 |
| 40 internal::NativeWidgetPrivate* CreateNativeWidgetOfType( | 40 internal::NativeWidgetPrivate* CreateNativeWidgetOfType( |
| 41 Widget::InitParams::Type type) { | 41 Widget::InitParams::Type type) { |
| 42 Widget* widget = new Widget; | 42 Widget* widget = new Widget; |
| 43 Widget::InitParams params = CreateParams(type); | 43 Widget::InitParams params = CreateParams(type); |
| 44 params.ownership = views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET; | 44 params.ownership = views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET; |
| 45 params.child = false; // Implicitly set to true by ctor with TYPE_CONTROL. | |
| 46 params.bounds = gfx::Rect(10, 10, 200, 200); | 45 params.bounds = gfx::Rect(10, 10, 200, 200); |
| 47 widget->Init(params); | 46 widget->Init(params); |
| 48 return widget->native_widget_private(); | 47 return widget->native_widget_private(); |
| 49 } | 48 } |
| 50 | 49 |
| 51 internal::NativeWidgetPrivate* CreateNativeWidget() { | 50 internal::NativeWidgetPrivate* CreateNativeWidget() { |
| 52 return CreateNativeWidgetOfType(Widget::InitParams::TYPE_POPUP); | 51 return CreateNativeWidgetOfType(Widget::InitParams::TYPE_POPUP); |
| 53 } | 52 } |
| 54 | 53 |
| 55 internal::NativeWidgetPrivate* CreateNativeSubWidget() { | 54 internal::NativeWidgetPrivate* CreateNativeSubWidget() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // |child_host| owns |child_widget|. | 90 // |child_host| owns |child_widget|. |
| 92 internal::NativeWidgetPrivate* child_widget = CreateNativeSubWidget(); | 91 internal::NativeWidgetPrivate* child_widget = CreateNativeSubWidget(); |
| 93 child_host->Attach(child_widget->GetWidget()->GetNativeView()); | 92 child_host->Attach(child_widget->GetWidget()->GetNativeView()); |
| 94 | 93 |
| 95 EXPECT_EQ(toplevel_widget.get(), | 94 EXPECT_EQ(toplevel_widget.get(), |
| 96 internal::NativeWidgetPrivate::GetTopLevelNativeWidget( | 95 internal::NativeWidgetPrivate::GetTopLevelNativeWidget( |
| 97 child_widget->GetWidget()->GetNativeView())); | 96 child_widget->GetWidget()->GetNativeView())); |
| 98 } | 97 } |
| 99 | 98 |
| 100 } // namespace views | 99 } // namespace views |
| OLD | NEW |