| 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_document = false; | 52 params->was_within_same_document = 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 int error_code) { | 130 int error_code) { |
| 130 delete this; | 131 delete this; |
| 131 } | 132 } |
| 132 | 133 |
| 133 void TestRenderWidgetHostView::Destroy() { delete this; } | 134 void TestRenderWidgetHostView::Destroy() { delete this; } |
| 134 | 135 |
| 135 gfx::Rect TestRenderWidgetHostView::GetViewBounds() const { | 136 gfx::Rect TestRenderWidgetHostView::GetViewBounds() const { |
| 136 return gfx::Rect(); | 137 return gfx::Rect(); |
| 137 } | 138 } |
| 138 | 139 |
| 140 void TestRenderWidgetHostView::SetBackgroundColor(SkColor color) { |
| 141 background_color_ = color; |
| 142 } |
| 143 |
| 144 SkColor TestRenderWidgetHostView::background_color() const { |
| 145 return background_color_; |
| 146 } |
| 147 |
| 139 bool TestRenderWidgetHostView::HasAcceleratedSurface( | 148 bool TestRenderWidgetHostView::HasAcceleratedSurface( |
| 140 const gfx::Size& desired_size) { | 149 const gfx::Size& desired_size) { |
| 141 return false; | 150 return false; |
| 142 } | 151 } |
| 143 | 152 |
| 144 #if defined(OS_MACOSX) | 153 #if defined(OS_MACOSX) |
| 145 | 154 |
| 146 ui::AcceleratedWidgetMac* TestRenderWidgetHostView::GetAcceleratedWidgetMac() | 155 ui::AcceleratedWidgetMac* TestRenderWidgetHostView::GetAcceleratedWidgetMac() |
| 147 const { | 156 const { |
| 148 return nullptr; | 157 return nullptr; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 317 |
| 309 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { | 318 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { |
| 310 return contents()->GetMainFrame(); | 319 return contents()->GetMainFrame(); |
| 311 } | 320 } |
| 312 | 321 |
| 313 TestWebContents* RenderViewHostImplTestHarness::contents() { | 322 TestWebContents* RenderViewHostImplTestHarness::contents() { |
| 314 return static_cast<TestWebContents*>(web_contents()); | 323 return static_cast<TestWebContents*>(web_contents()); |
| 315 } | 324 } |
| 316 | 325 |
| 317 } // namespace content | 326 } // namespace content |
| OLD | NEW |