| 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 "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #include <Cocoa/Cocoa.h> | 7 #include <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|. | 211 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|. |
| 212 rwhv_mac_ = new RenderWidgetHostViewMac(rvh()->GetWidget(), false); | 212 rwhv_mac_ = new RenderWidgetHostViewMac(rvh()->GetWidget(), false); |
| 213 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]); | 213 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]); |
| 214 } | 214 } |
| 215 void TearDown() override { | 215 void TearDown() override { |
| 216 // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs. | 216 // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs. |
| 217 rwhv_cocoa_.reset(); | 217 rwhv_cocoa_.reset(); |
| 218 RecycleAndWait(); | 218 RecycleAndWait(); |
| 219 | 219 |
| 220 // See comment in SetUp(). | 220 // See comment in SetUp(). |
| 221 test_rvh()->SetView(static_cast<RenderWidgetHostViewBase*>(old_rwhv_)); | 221 test_rvh()->GetWidget()->SetView( |
| 222 static_cast<RenderWidgetHostViewBase*>(old_rwhv_)); |
| 222 | 223 |
| 223 ImageTransportFactory::Terminate(); | 224 ImageTransportFactory::Terminate(); |
| 224 RenderViewHostImplTestHarness::TearDown(); | 225 RenderViewHostImplTestHarness::TearDown(); |
| 225 } | 226 } |
| 226 | 227 |
| 227 void RecycleAndWait() { | 228 void RecycleAndWait() { |
| 228 pool_.Recycle(); | 229 pool_.Recycle(); |
| 229 base::MessageLoop::current()->RunUntilIdle(); | 230 base::MessageLoop::current()->RunUntilIdle(); |
| 230 pool_.Recycle(); | 231 pool_.Recycle(); |
| 231 } | 232 } |
| 232 | 233 |
| 233 void DestroyHostViewRetainCocoaView() { | 234 void DestroyHostViewRetainCocoaView() { |
| 234 test_rvh()->SetView(nullptr); | 235 test_rvh()->GetWidget()->SetView(nullptr); |
| 235 rwhv_mac_->Destroy(); | 236 rwhv_mac_->Destroy(); |
| 236 } | 237 } |
| 237 | 238 |
| 238 private: | 239 private: |
| 239 // This class isn't derived from PlatformTest. | 240 // This class isn't derived from PlatformTest. |
| 240 base::mac::ScopedNSAutoreleasePool pool_; | 241 base::mac::ScopedNSAutoreleasePool pool_; |
| 241 | 242 |
| 242 RenderWidgetHostView* old_rwhv_; | 243 RenderWidgetHostView* old_rwhv_; |
| 243 | 244 |
| 244 protected: | 245 protected: |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 EXPECT_EQ(1U, process_host_->sink().message_count()); | 1055 EXPECT_EQ(1U, process_host_->sink().message_count()); |
| 1055 process_host_->sink().ClearMessages(); | 1056 process_host_->sink().ClearMessages(); |
| 1056 } | 1057 } |
| 1057 | 1058 |
| 1058 // Clean up. | 1059 // Clean up. |
| 1059 host->Shutdown(); | 1060 host->Shutdown(); |
| 1060 } | 1061 } |
| 1061 | 1062 |
| 1062 | 1063 |
| 1063 } // namespace content | 1064 } // namespace content |
| OLD | NEW |