Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Unified Diff: content/public/test/test_renderer_host.cc

Issue 2496233003: Destroy the old RenderWidgetHostView when swapping out a main frame. (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/test/test_renderer_host.cc
diff --git a/content/public/test/test_renderer_host.cc b/content/public/test/test_renderer_host.cc
index 01f729a9be75d29c009f325f8508ddaff9b662f6..81063c6e21e7d3bf779e8119aa8b055dbb848405 100644
--- a/content/public/test/test_renderer_host.cc
+++ b/content/public/test/test_renderer_host.cc
@@ -127,9 +127,28 @@ bool RenderViewHostTester::HasTouchEventHandler(RenderViewHost* rvh) {
RenderViewHostTestEnabler::RenderViewHostTestEnabler()
: rph_factory_(new MockRenderProcessHostFactory()),
rvh_factory_(new TestRenderViewHostFactory(rph_factory_.get())),
- rfh_factory_(new TestRenderFrameHostFactory()) {}
+ rfh_factory_(new TestRenderFrameHostFactory()) {
+#if !defined(OS_ANDROID)
+ ImageTransportFactory::InitializeForUnitTests(
+ base::WrapUnique(new NoTransportImageTransportFactory));
+#else
+ gpu_channel_factory_ = base::MakeUnique<MockGpuChannelEstablishFactory>();
+ ContextProviderFactoryImpl::Initialize(gpu_channel_factory_.get());
+ ui::ContextProviderFactory::SetInstance(
+ ContextProviderFactoryImpl::GetInstance());
+#endif
+}
RenderViewHostTestEnabler::~RenderViewHostTestEnabler() {
+#if !defined(OS_ANDROID)
+ // RenderWidgetHostView holds on to a reference to SurfaceManager, so it
+ // must be shut down before the ImageTransportFactory.
+ ImageTransportFactory::Terminate();
+#else
+ ui::ContextProviderFactory::SetInstance(nullptr);
+ ContextProviderFactoryImpl::Terminate();
+ gpu_channel_factory_.reset();
+#endif
}
@@ -235,15 +254,6 @@ void RenderViewHostTestHarness::SetUp() {
#if defined(OS_WIN)
ole_initializer_.reset(new ui::ScopedOleInitializer());
#endif
-#if !defined(OS_ANDROID)
- ImageTransportFactory::InitializeForUnitTests(
- base::WrapUnique(new NoTransportImageTransportFactory));
-#else
- gpu_channel_factory_ = base::MakeUnique<MockGpuChannelEstablishFactory>();
- ContextProviderFactoryImpl::Initialize(gpu_channel_factory_.get());
- ui::ContextProviderFactory::SetInstance(
- ContextProviderFactoryImpl::GetInstance());
-#endif
#if defined(USE_AURA)
ui::ContextFactory* context_factory =
ImageTransportFactory::GetInstance()->GetContextFactory();
@@ -302,16 +312,6 @@ void RenderViewHostTestHarness::TearDown() {
FROM_HERE,
browser_context_.release());
thread_bundle_.reset();
-
-#if !defined(OS_ANDROID)
- // RenderWidgetHostView holds on to a reference to SurfaceManager, so it
- // must be shut down before the ImageTransportFactory.
- ImageTransportFactory::Terminate();
-#else
- ui::ContextProviderFactory::SetInstance(nullptr);
- ContextProviderFactoryImpl::Terminate();
- gpu_channel_factory_.reset();
-#endif
}
BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() {
« content/public/test/test_renderer_host.h ('K') | « content/public/test/test_renderer_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698