| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/views/controls/native/native_view_host_aura.h" | 5 #include "ui/views/controls/native/native_view_host_aura.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/macros.h" | 9 #include "base/macros.h" |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| 10 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
| 11 #include "ui/base/cursor/cursor.h" | 12 #include "ui/base/cursor/cursor.h" |
| 12 #include "ui/events/event_utils.h" | 13 #include "ui/events/event_utils.h" |
| 13 #include "ui/views/controls/native/native_view_host.h" | 14 #include "ui/views/controls/native/native_view_host.h" |
| 14 #include "ui/views/controls/native/native_view_host_test_base.h" | 15 #include "ui/views/controls/native/native_view_host_test_base.h" |
| 15 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
| 16 #include "ui/views/view_constants_aura.h" | 17 #include "ui/views/view_constants_aura.h" |
| 17 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
| 18 | 19 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void CreateHost() { | 99 void CreateHost() { |
| 99 CreateTopLevel(); | 100 CreateTopLevel(); |
| 100 CreateTestingHost(); | 101 CreateTestingHost(); |
| 101 child_.reset(CreateChildForHost(toplevel()->GetNativeView(), | 102 child_.reset(CreateChildForHost(toplevel()->GetNativeView(), |
| 102 toplevel()->GetRootView(), | 103 toplevel()->GetRootView(), |
| 103 new View, | 104 new View, |
| 104 host())); | 105 host())); |
| 105 } | 106 } |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 scoped_ptr<Widget> child_; | 109 std::unique_ptr<Widget> child_; |
| 109 | 110 |
| 110 DISALLOW_COPY_AND_ASSIGN(NativeViewHostAuraTest); | 111 DISALLOW_COPY_AND_ASSIGN(NativeViewHostAuraTest); |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 // Verifies NativeViewHostAura stops observing native view on destruction. | 114 // Verifies NativeViewHostAura stops observing native view on destruction. |
| 114 TEST_F(NativeViewHostAuraTest, StopObservingNativeViewOnDestruct) { | 115 TEST_F(NativeViewHostAuraTest, StopObservingNativeViewOnDestruct) { |
| 115 CreateHost(); | 116 CreateHost(); |
| 116 aura::Window* child_win = child()->GetNativeView(); | 117 aura::Window* child_win = child()->GetNativeView(); |
| 117 NativeViewHostAura* aura_host = native_host(); | 118 NativeViewHostAura* aura_host = native_host(); |
| 118 | 119 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 363 |
| 363 host()->SetVisible(false); | 364 host()->SetVisible(false); |
| 364 EXPECT_FALSE(clipping_window()->IsVisible()); | 365 EXPECT_FALSE(clipping_window()->IsVisible()); |
| 365 EXPECT_FALSE(child()->IsVisible()); | 366 EXPECT_FALSE(child()->IsVisible()); |
| 366 | 367 |
| 367 DestroyHost(); | 368 DestroyHost(); |
| 368 DestroyTopLevel(); | 369 DestroyTopLevel(); |
| 369 } | 370 } |
| 370 | 371 |
| 371 } // namespace views | 372 } // namespace views |
| OLD | NEW |