| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 params->gesture = NavigationGestureUser; | 51 params->gesture = NavigationGestureUser; |
| 52 params->was_within_same_page = false; | 52 params->was_within_same_page = false; |
| 53 params->method = "GET"; | 53 params->method = "GET"; |
| 54 params->page_state = PageState::CreateFromURL(url); | 54 params->page_state = PageState::CreateFromURL(url); |
| 55 } | 55 } |
| 56 | 56 |
| 57 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) | 57 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) |
| 58 : rwh_(RenderWidgetHostImpl::From(rwh)), | 58 : rwh_(RenderWidgetHostImpl::From(rwh)), |
| 59 is_showing_(false), | 59 is_showing_(false), |
| 60 is_occluded_(false), | 60 is_occluded_(false), |
| 61 did_swap_compositor_frame_(false) { | 61 did_swap_compositor_frame_(false), |
| 62 background_color_(SK_ColorWHITE) { |
| 62 #if defined(OS_ANDROID) | 63 #if defined(OS_ANDROID) |
| 63 frame_sink_id_ = AllocateFrameSinkId(); | 64 frame_sink_id_ = AllocateFrameSinkId(); |
| 64 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); | 65 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); |
| 65 #else | 66 #else |
| 66 // Not all tests initialize or need an image transport factory. | 67 // Not all tests initialize or need an image transport factory. |
| 67 if (ImageTransportFactory::GetInstance()) { | 68 if (ImageTransportFactory::GetInstance()) { |
| 68 frame_sink_id_ = AllocateFrameSinkId(); | 69 frame_sink_id_ = AllocateFrameSinkId(); |
| 69 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); | 70 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); |
| 70 } | 71 } |
| 71 #endif | 72 #endif |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 int error_code) { | 134 int error_code) { |
| 134 delete this; | 135 delete this; |
| 135 } | 136 } |
| 136 | 137 |
| 137 void TestRenderWidgetHostView::Destroy() { delete this; } | 138 void TestRenderWidgetHostView::Destroy() { delete this; } |
| 138 | 139 |
| 139 gfx::Rect TestRenderWidgetHostView::GetViewBounds() const { | 140 gfx::Rect TestRenderWidgetHostView::GetViewBounds() const { |
| 140 return gfx::Rect(); | 141 return gfx::Rect(); |
| 141 } | 142 } |
| 142 | 143 |
| 144 void TestRenderWidgetHostView::SetBackgroundColor(SkColor color) { |
| 145 background_color_ = color; |
| 146 } |
| 147 |
| 148 SkColor TestRenderWidgetHostView::background_color() const { |
| 149 return background_color_; |
| 150 } |
| 151 |
| 143 void TestRenderWidgetHostView::CopyFromCompositingSurface( | 152 void TestRenderWidgetHostView::CopyFromCompositingSurface( |
| 144 const gfx::Rect& src_subrect, | 153 const gfx::Rect& src_subrect, |
| 145 const gfx::Size& dst_size, | 154 const gfx::Size& dst_size, |
| 146 const ReadbackRequestCallback& callback, | 155 const ReadbackRequestCallback& callback, |
| 147 const SkColorType preferred_color_type) { | 156 const SkColorType preferred_color_type) { |
| 148 callback.Run(SkBitmap(), content::READBACK_FAILED); | 157 callback.Run(SkBitmap(), content::READBACK_FAILED); |
| 149 } | 158 } |
| 150 | 159 |
| 151 void TestRenderWidgetHostView::CopyFromCompositingSurfaceToVideoFrame( | 160 void TestRenderWidgetHostView::CopyFromCompositingSurfaceToVideoFrame( |
| 152 const gfx::Rect& src_subrect, | 161 const gfx::Rect& src_subrect, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 336 |
| 328 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { | 337 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { |
| 329 return contents()->GetMainFrame(); | 338 return contents()->GetMainFrame(); |
| 330 } | 339 } |
| 331 | 340 |
| 332 TestWebContents* RenderViewHostImplTestHarness::contents() { | 341 TestWebContents* RenderViewHostImplTestHarness::contents() { |
| 333 return static_cast<TestWebContents*>(web_contents()); | 342 return static_cast<TestWebContents*>(web_contents()); |
| 334 } | 343 } |
| 335 | 344 |
| 336 } // namespace content | 345 } // namespace content |
| OLD | NEW |