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

Unified Diff: content/test/test_render_view_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
« no previous file with comments | « content/test/test_render_view_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/test_render_view_host.cc
diff --git a/content/test/test_render_view_host.cc b/content/test/test_render_view_host.cc
index 8b174bebe455f58b0724b1eb5340883b9e66f59f..f750ca8c5b8af639af819451d8f63142f459b82a 100644
--- a/content/test/test_render_view_host.cc
+++ b/content/test/test_render_view_host.cc
@@ -8,6 +8,9 @@
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
+#include "cc/surfaces/surface_manager.h"
+#include "content/browser/compositor/image_transport_factory.h"
+#include "content/browser/compositor/surface_utils.h"
#include "content/browser/dom_storage/dom_storage_context_wrapper.h"
#include "content/browser/dom_storage/session_storage_namespace_impl.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h"
@@ -26,12 +29,10 @@
#include "content/test/test_render_frame_host.h"
#include "content/test/test_web_contents.h"
#include "media/base/video_frame.h"
+#include "ui/aura/env.h"
+#include "ui/compositor/compositor.h"
#include "ui/gfx/geometry/rect.h"
-namespace {
-static uint32_t s_next_surface_id_namespace = 1;
-}
-
namespace content {
void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params,
@@ -59,10 +60,17 @@ void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params,
TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh)
: rwh_(RenderWidgetHostImpl::From(rwh)),
- surface_id_namespace_(s_next_surface_id_namespace++),
is_showing_(false),
is_occluded_(false),
did_swap_compositor_frame_(false) {
+#if defined(OS_ANDROID)
+ surface_id_allocator_ = CreateSurfaceIdAllocator();
+#else
+ // Not all tests initialize or need an image transport factory.
+ if (ImageTransportFactory::GetInstance())
+ surface_id_allocator_ = CreateSurfaceIdAllocator();
+#endif
+
rwh_->SetView(this);
}
@@ -204,7 +212,10 @@ void TestRenderWidgetHostView::UnlockMouse() {
}
uint32_t TestRenderWidgetHostView::GetSurfaceIdNamespace() {
- return surface_id_namespace_;
+ // See constructor. If a test needs this, its harness needs to construct an
+ // ImageTransportFactory.
+ DCHECK(surface_id_allocator_);
+ return surface_id_allocator_->id_namespace();
}
TestRenderViewHost::TestRenderViewHost(
« no previous file with comments | « content/test/test_render_view_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698