| 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_ = |
| 68 base::WrapUnique(new cc::SurfaceIdAllocator(AllocateSurfaceClientId())); |
| 68 #else | 69 #else |
| 69 // Not all tests initialize or need an image transport factory. | 70 // Not all tests initialize or need an image transport factory. |
| 70 if (ImageTransportFactory::GetInstance()) | 71 if (ImageTransportFactory::GetInstance()) |
| 71 surface_id_allocator_ = CreateSurfaceIdAllocator(); | 72 surface_id_allocator_ = |
| 73 base::WrapUnique(new cc::SurfaceIdAllocator(AllocateSurfaceClientId())); |
| 72 #endif | 74 #endif |
| 73 | 75 |
| 74 rwh_->SetView(this); | 76 rwh_->SetView(this); |
| 75 } | 77 } |
| 76 | 78 |
| 77 TestRenderWidgetHostView::~TestRenderWidgetHostView() { | 79 TestRenderWidgetHostView::~TestRenderWidgetHostView() { |
| 78 } | 80 } |
| 79 | 81 |
| 80 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { | 82 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { |
| 81 return rwh_; | 83 return rwh_; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 189 } |
| 188 | 190 |
| 189 #endif | 191 #endif |
| 190 | 192 |
| 191 gfx::Rect TestRenderWidgetHostView::GetBoundsInRootWindow() { | 193 gfx::Rect TestRenderWidgetHostView::GetBoundsInRootWindow() { |
| 192 return gfx::Rect(); | 194 return gfx::Rect(); |
| 193 } | 195 } |
| 194 | 196 |
| 195 void TestRenderWidgetHostView::OnSwapCompositorFrame( | 197 void TestRenderWidgetHostView::OnSwapCompositorFrame( |
| 196 uint32_t output_surface_id, | 198 uint32_t output_surface_id, |
| 199 const cc::SurfaceId& surface_id, |
| 197 cc::CompositorFrame frame) { | 200 cc::CompositorFrame frame) { |
| 198 did_swap_compositor_frame_ = true; | 201 did_swap_compositor_frame_ = true; |
| 199 } | 202 } |
| 200 | 203 |
| 201 bool TestRenderWidgetHostView::LockMouse() { | 204 bool TestRenderWidgetHostView::LockMouse() { |
| 202 return false; | 205 return false; |
| 203 } | 206 } |
| 204 | 207 |
| 205 void TestRenderWidgetHostView::UnlockMouse() { | 208 void TestRenderWidgetHostView::UnlockMouse() { |
| 206 } | 209 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 331 |
| 329 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { | 332 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { |
| 330 return contents()->GetMainFrame(); | 333 return contents()->GetMainFrame(); |
| 331 } | 334 } |
| 332 | 335 |
| 333 TestWebContents* RenderViewHostImplTestHarness::contents() { | 336 TestWebContents* RenderViewHostImplTestHarness::contents() { |
| 334 return static_cast<TestWebContents*>(web_contents()); | 337 return static_cast<TestWebContents*>(web_contents()); |
| 335 } | 338 } |
| 336 | 339 |
| 337 } // namespace content | 340 } // namespace content |
| OLD | NEW |