Chromium Code Reviews| 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..b001cb5c44b765bfce64720701d5ba19971cb52e 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,9 @@ 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. |
|
piman
2016/06/20 20:40:27
nit: add DCHECK(surface_id_allocator_);
enne (OOO)
2016/06/20 20:58:41
Done.
|
| + return surface_id_allocator_->id_namespace(); |
| } |
| TestRenderViewHost::TestRenderViewHost( |