| 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 17 matching lines...) Expand all Loading... |
| 28 internal::NativeWidgetPrivate* get() const { return native_widget_; } | 28 internal::NativeWidgetPrivate* get() const { return native_widget_; } |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 internal::NativeWidgetPrivate* native_widget_; | 31 internal::NativeWidgetPrivate* native_widget_; |
| 32 DISALLOW_COPY_AND_ASSIGN(ScopedTestWidget); | 32 DISALLOW_COPY_AND_ASSIGN(ScopedTestWidget); |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class NativeWidgetTest : public ViewsTestBase { | 35 class NativeWidgetTest : public ViewsTestBase { |
| 36 public: | 36 public: |
| 37 NativeWidgetTest() {} | 37 NativeWidgetTest() {} |
| 38 virtual ~NativeWidgetTest() {} | 38 ~NativeWidgetTest() override {} |
| 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.bounds = gfx::Rect(10, 10, 200, 200); | 45 params.bounds = gfx::Rect(10, 10, 200, 200); |
| 46 widget->Init(params); | 46 widget->Init(params); |
| 47 return widget->native_widget_private(); | 47 return widget->native_widget_private(); |
| 48 } | 48 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // |child_host| owns |child_widget|. | 90 // |child_host| owns |child_widget|. |
| 91 internal::NativeWidgetPrivate* child_widget = CreateNativeSubWidget(); | 91 internal::NativeWidgetPrivate* child_widget = CreateNativeSubWidget(); |
| 92 child_host->Attach(child_widget->GetWidget()->GetNativeView()); | 92 child_host->Attach(child_widget->GetWidget()->GetNativeView()); |
| 93 | 93 |
| 94 EXPECT_EQ(toplevel_widget.get(), | 94 EXPECT_EQ(toplevel_widget.get(), |
| 95 internal::NativeWidgetPrivate::GetTopLevelNativeWidget( | 95 internal::NativeWidgetPrivate::GetTopLevelNativeWidget( |
| 96 child_widget->GetWidget()->GetNativeView())); | 96 child_widget->GetWidget()->GetNativeView())); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace views | 99 } // namespace views |
| OLD | NEW |