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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) | 64 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) |
65 : rwh_(RenderWidgetHostImpl::From(rwh)), | 65 : rwh_(RenderWidgetHostImpl::From(rwh)), |
66 is_showing_(false), | 66 is_showing_(false), |
67 is_occluded_(false), | 67 is_occluded_(false), |
68 did_swap_compositor_frame_(false) { | 68 did_swap_compositor_frame_(false) { |
69 #if defined(OS_ANDROID) | 69 #if defined(OS_ANDROID) |
70 // Not all tests initialize or need a context provider factory. | 70 // Not all tests initialize or need a context provider factory. |
71 if (ContextProviderFactoryImpl::GetInstance()) { | 71 if (ContextProviderFactoryImpl::GetInstance()) { |
72 surface_id_allocator_.reset( | 72 surface_id_allocator_.reset( |
73 new cc::SurfaceIdAllocator(AllocateSurfaceClientId())); | 73 new cc::SurfaceIdAllocator(AllocateFrameSinkId())); |
74 GetSurfaceManager()->RegisterSurfaceClientId( | 74 GetSurfaceManager()->RegisterFrameSinkId( |
75 surface_id_allocator_->client_id()); | 75 surface_id_allocator_->frame_sink_id()); |
76 } | 76 } |
77 #else | 77 #else |
78 // Not all tests initialize or need an image transport factory. | 78 // Not all tests initialize or need an image transport factory. |
79 if (ImageTransportFactory::GetInstance()) { | 79 if (ImageTransportFactory::GetInstance()) { |
80 surface_id_allocator_.reset( | 80 surface_id_allocator_.reset( |
81 new cc::SurfaceIdAllocator(AllocateSurfaceClientId())); | 81 new cc::SurfaceIdAllocator(AllocateFrameSinkId())); |
82 GetSurfaceManager()->RegisterSurfaceClientId( | 82 GetSurfaceManager()->RegisterFrameSinkId( |
83 surface_id_allocator_->client_id()); | 83 surface_id_allocator_->frame_sink_id()); |
84 } | 84 } |
85 #endif | 85 #endif |
86 | 86 |
87 rwh_->SetView(this); | 87 rwh_->SetView(this); |
88 } | 88 } |
89 | 89 |
90 TestRenderWidgetHostView::~TestRenderWidgetHostView() { | 90 TestRenderWidgetHostView::~TestRenderWidgetHostView() { |
91 cc::SurfaceManager* manager = nullptr; | 91 cc::SurfaceManager* manager = nullptr; |
92 #if defined(OS_ANDROID) | 92 #if defined(OS_ANDROID) |
93 if (ContextProviderFactoryImpl::GetInstance()) | 93 if (ContextProviderFactoryImpl::GetInstance()) |
94 manager = GetSurfaceManager(); | 94 manager = GetSurfaceManager(); |
95 #else | 95 #else |
96 manager = GetSurfaceManager(); | 96 manager = GetSurfaceManager(); |
97 #endif | 97 #endif |
98 if (manager) { | 98 if (manager) { |
99 manager->InvalidateSurfaceClientId(surface_id_allocator_->client_id()); | 99 manager->InvalidateFrameSinkId(surface_id_allocator_->frame_sink_id()); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { | 103 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { |
104 return rwh_; | 104 return rwh_; |
105 } | 105 } |
106 | 106 |
107 gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const { | 107 gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const { |
108 return gfx::Vector2dF(); | 108 return gfx::Vector2dF(); |
109 } | 109 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 did_swap_compositor_frame_ = true; | 221 did_swap_compositor_frame_ = true; |
222 } | 222 } |
223 | 223 |
224 bool TestRenderWidgetHostView::LockMouse() { | 224 bool TestRenderWidgetHostView::LockMouse() { |
225 return false; | 225 return false; |
226 } | 226 } |
227 | 227 |
228 void TestRenderWidgetHostView::UnlockMouse() { | 228 void TestRenderWidgetHostView::UnlockMouse() { |
229 } | 229 } |
230 | 230 |
231 uint32_t TestRenderWidgetHostView::GetSurfaceClientId() { | 231 cc::FrameSinkId TestRenderWidgetHostView::GetFrameSinkId() { |
232 // See constructor. If a test needs this, its harness needs to construct an | 232 // See constructor. If a test needs this, its harness needs to construct an |
233 // ImageTransportFactory. | 233 // ImageTransportFactory. |
234 DCHECK(surface_id_allocator_); | 234 DCHECK(surface_id_allocator_); |
235 return surface_id_allocator_->client_id(); | 235 return surface_id_allocator_->frame_sink_id(); |
236 } | 236 } |
237 | 237 |
238 TestRenderViewHost::TestRenderViewHost( | 238 TestRenderViewHost::TestRenderViewHost( |
239 SiteInstance* instance, | 239 SiteInstance* instance, |
240 std::unique_ptr<RenderWidgetHostImpl> widget, | 240 std::unique_ptr<RenderWidgetHostImpl> widget, |
241 RenderViewHostDelegate* delegate, | 241 RenderViewHostDelegate* delegate, |
242 int32_t main_frame_routing_id, | 242 int32_t main_frame_routing_id, |
243 bool swapped_out) | 243 bool swapped_out) |
244 : RenderViewHostImpl(instance, | 244 : RenderViewHostImpl(instance, |
245 std::move(widget), | 245 std::move(widget), |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 351 |
352 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { | 352 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { |
353 return contents()->GetMainFrame(); | 353 return contents()->GetMainFrame(); |
354 } | 354 } |
355 | 355 |
356 TestWebContents* RenderViewHostImplTestHarness::contents() { | 356 TestWebContents* RenderViewHostImplTestHarness::contents() { |
357 return static_cast<TestWebContents*>(web_contents()); | 357 return static_cast<TestWebContents*>(web_contents()); |
358 } | 358 } |
359 | 359 |
360 } // namespace content | 360 } // namespace content |
OLD | NEW |