| 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/test/test_render_view_host.h" | 5 #include "content/test/test_render_view_host.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 params->method = "GET"; | 57 params->method = "GET"; |
| 58 params->page_state = PageState::CreateFromURL(url); | 58 params->page_state = PageState::CreateFromURL(url); |
| 59 } | 59 } |
| 60 | 60 |
| 61 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) | 61 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) |
| 62 : rwh_(RenderWidgetHostImpl::From(rwh)), | 62 : rwh_(RenderWidgetHostImpl::From(rwh)), |
| 63 is_showing_(false), | 63 is_showing_(false), |
| 64 is_occluded_(false), | 64 is_occluded_(false), |
| 65 did_swap_compositor_frame_(false) { | 65 did_swap_compositor_frame_(false) { |
| 66 #if defined(OS_ANDROID) | 66 #if defined(OS_ANDROID) |
| 67 surface_id_allocator_ = CreateSurfaceIdAllocator(); | 67 surface_id_allocator_.reset( |
| 68 new cc::SurfaceIdAllocator(AllocateSurfaceClientId())); |
| 69 GetSurfaceManager()->RegisterSurfaceClientId( |
| 70 surface_id_allocator_->client_id()); |
| 68 #else | 71 #else |
| 69 // Not all tests initialize or need an image transport factory. | 72 // Not all tests initialize or need an image transport factory. |
| 70 if (ImageTransportFactory::GetInstance()) | 73 if (ImageTransportFactory::GetInstance()) { |
| 71 surface_id_allocator_ = CreateSurfaceIdAllocator(); | 74 surface_id_allocator_.reset( |
| 75 new cc::SurfaceIdAllocator(AllocateSurfaceClientId())); |
| 76 GetSurfaceManager()->RegisterSurfaceClientId( |
| 77 surface_id_allocator_->client_id()); |
| 78 } |
| 72 #endif | 79 #endif |
| 73 | 80 |
| 74 rwh_->SetView(this); | 81 rwh_->SetView(this); |
| 75 } | 82 } |
| 76 | 83 |
| 77 TestRenderWidgetHostView::~TestRenderWidgetHostView() { | 84 TestRenderWidgetHostView::~TestRenderWidgetHostView() { |
| 85 if (GetSurfaceManager()) { |
| 86 GetSurfaceManager()->InvalidateSurfaceClientId( |
| 87 surface_id_allocator_->client_id()); |
| 88 } |
| 78 } | 89 } |
| 79 | 90 |
| 80 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { | 91 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { |
| 81 return rwh_; | 92 return rwh_; |
| 82 } | 93 } |
| 83 | 94 |
| 84 gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const { | 95 gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const { |
| 85 return gfx::Vector2dF(); | 96 return gfx::Vector2dF(); |
| 86 } | 97 } |
| 87 | 98 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 339 |
| 329 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { | 340 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { |
| 330 return contents()->GetMainFrame(); | 341 return contents()->GetMainFrame(); |
| 331 } | 342 } |
| 332 | 343 |
| 333 TestWebContents* RenderViewHostImplTestHarness::contents() { | 344 TestWebContents* RenderViewHostImplTestHarness::contents() { |
| 334 return static_cast<TestWebContents*>(web_contents()); | 345 return static_cast<TestWebContents*>(web_contents()); |
| 335 } | 346 } |
| 336 | 347 |
| 337 } // namespace content | 348 } // namespace content |
| OLD | NEW |