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

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

Issue 2079623002: Create only one ContextFactory in content unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add dcheck Created 4 years, 6 months 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 35d4ca6e77d892f42b351e309739d0520510e535..e9e41ab06921b2fd39dc8a11e7be8b63eff51e6d 100644
--- a/content/public/test/test_renderer_host.cc
+++ b/content/public/test/test_renderer_host.cc
@@ -8,6 +8,7 @@
#include "base/run_loop.h"
#include "build/build_config.h"
+#include "content/browser/compositor/test/no_transport_image_transport_factory.h"
#include "content/browser/frame_host/navigation_entry_impl.h"
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
@@ -190,11 +191,13 @@ void RenderViewHostTestHarness::SetUp() {
#if defined(OS_WIN)
ole_initializer_.reset(new ui::ScopedOleInitializer());
#endif
+#if !defined(OS_ANDROID)
+ ImageTransportFactory::InitializeForUnitTests(
+ base::WrapUnique(new NoTransportImageTransportFactory));
+#endif
#if defined(USE_AURA)
- // The ContextFactory must exist before any Compositors are created.
- bool enable_pixel_output = false;
ui::ContextFactory* context_factory =
- ui::InitializeContextFactoryForTests(enable_pixel_output);
+ ImageTransportFactory::GetInstance()->GetContextFactory();
aura_test_helper_.reset(
new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
@@ -242,6 +245,12 @@ 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();
+#endif
}
BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() {
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac_unittest.mm ('k') | content/test/test_render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698