| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 params->gesture = NavigationGestureUser; | 55 params->gesture = NavigationGestureUser; |
| 56 params->was_within_same_page = false; | 56 params->was_within_same_page = false; |
| 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 background_color_(SK_ColorWHITE) { |
| 66 #if defined(OS_ANDROID) | 67 #if defined(OS_ANDROID) |
| 67 // Not all tests initialize or need a context provider factory. | 68 // Not all tests initialize or need a context provider factory. |
| 68 if (ContextProviderFactoryImpl::GetInstance()) { | 69 if (ContextProviderFactoryImpl::GetInstance()) { |
| 69 frame_sink_id_ = AllocateFrameSinkId(); | 70 frame_sink_id_ = AllocateFrameSinkId(); |
| 70 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); | 71 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); |
| 71 } | 72 } |
| 72 #else | 73 #else |
| 73 // Not all tests initialize or need an image transport factory. | 74 // Not all tests initialize or need an image transport factory. |
| 74 if (ImageTransportFactory::GetInstance()) { | 75 if (ImageTransportFactory::GetInstance()) { |
| 75 frame_sink_id_ = AllocateFrameSinkId(); | 76 frame_sink_id_ = AllocateFrameSinkId(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 int error_code) { | 147 int error_code) { |
| 147 delete this; | 148 delete this; |
| 148 } | 149 } |
| 149 | 150 |
| 150 void TestRenderWidgetHostView::Destroy() { delete this; } | 151 void TestRenderWidgetHostView::Destroy() { delete this; } |
| 151 | 152 |
| 152 gfx::Rect TestRenderWidgetHostView::GetViewBounds() const { | 153 gfx::Rect TestRenderWidgetHostView::GetViewBounds() const { |
| 153 return gfx::Rect(); | 154 return gfx::Rect(); |
| 154 } | 155 } |
| 155 | 156 |
| 157 void TestRenderWidgetHostView::SetBackgroundColor(SkColor color) { |
| 158 background_color_ = color; |
| 159 } |
| 160 |
| 161 SkColor TestRenderWidgetHostView::background_color() const { |
| 162 return background_color_; |
| 163 } |
| 164 |
| 156 void TestRenderWidgetHostView::CopyFromCompositingSurface( | 165 void TestRenderWidgetHostView::CopyFromCompositingSurface( |
| 157 const gfx::Rect& src_subrect, | 166 const gfx::Rect& src_subrect, |
| 158 const gfx::Size& dst_size, | 167 const gfx::Size& dst_size, |
| 159 const ReadbackRequestCallback& callback, | 168 const ReadbackRequestCallback& callback, |
| 160 const SkColorType preferred_color_type) { | 169 const SkColorType preferred_color_type) { |
| 161 callback.Run(SkBitmap(), content::READBACK_FAILED); | 170 callback.Run(SkBitmap(), content::READBACK_FAILED); |
| 162 } | 171 } |
| 163 | 172 |
| 164 void TestRenderWidgetHostView::CopyFromCompositingSurfaceToVideoFrame( | 173 void TestRenderWidgetHostView::CopyFromCompositingSurfaceToVideoFrame( |
| 165 const gfx::Rect& src_subrect, | 174 const gfx::Rect& src_subrect, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 349 |
| 341 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { | 350 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { |
| 342 return contents()->GetMainFrame(); | 351 return contents()->GetMainFrame(); |
| 343 } | 352 } |
| 344 | 353 |
| 345 TestWebContents* RenderViewHostImplTestHarness::contents() { | 354 TestWebContents* RenderViewHostImplTestHarness::contents() { |
| 346 return static_cast<TestWebContents*>(web_contents()); | 355 return static_cast<TestWebContents*>(web_contents()); |
| 347 } | 356 } |
| 348 | 357 |
| 349 } // namespace content | 358 } // namespace content |
| OLD | NEW |