Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: content/test/layouttest_support.cc

Issue 2075343003: Use a cc::Display for layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mailbox-test
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/public/test/layouttest_support.h" 5 #include "content/public/test/layouttest_support.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "cc/test/pixel_test_delegating_output_surface.h"
15 #include "components/scheduler/test/renderer_scheduler_test_support.h" 16 #include "components/scheduler/test/renderer_scheduler_test_support.h"
16 #include "components/test_runner/test_common.h" 17 #include "components/test_runner/test_common.h"
17 #include "components/test_runner/web_frame_test_proxy.h" 18 #include "components/test_runner/web_frame_test_proxy.h"
18 #include "components/test_runner/web_test_proxy.h" 19 #include "components/test_runner/web_test_proxy.h"
19 #include "content/browser/bluetooth/bluetooth_adapter_factory_wrapper.h" 20 #include "content/browser/bluetooth/bluetooth_adapter_factory_wrapper.h"
20 #include "content/browser/renderer_host/render_process_host_impl.h" 21 #include "content/browser/renderer_host/render_process_host_impl.h"
21 #include "content/browser/renderer_host/render_widget_host_impl.h" 22 #include "content/browser/renderer_host/render_widget_host_impl.h"
23 #include "content/common/gpu/client/context_provider_command_buffer.h"
22 #include "content/common/site_isolation_policy.h" 24 #include "content/common/site_isolation_policy.h"
23 #include "content/public/common/page_state.h" 25 #include "content/public/common/page_state.h"
24 #include "content/public/renderer/renderer_gamepad_provider.h" 26 #include "content/public/renderer/renderer_gamepad_provider.h"
25 #include "content/renderer/fetchers/manifest_fetcher.h" 27 #include "content/renderer/fetchers/manifest_fetcher.h"
26 #include "content/renderer/history_entry.h" 28 #include "content/renderer/history_entry.h"
27 #include "content/renderer/history_serialization.h" 29 #include "content/renderer/history_serialization.h"
28 #include "content/renderer/layout_test_dependencies.h" 30 #include "content/renderer/layout_test_dependencies.h"
29 #include "content/renderer/render_frame_impl.h" 31 #include "content/renderer/render_frame_impl.h"
30 #include "content/renderer/render_thread_impl.h" 32 #include "content/renderer/render_thread_impl.h"
31 #include "content/renderer/render_view_impl.h" 33 #include "content/renderer/render_view_impl.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 RendererBlinkPlatformImpl::SetMockDeviceMotionDataForTesting(data); 172 RendererBlinkPlatformImpl::SetMockDeviceMotionDataForTesting(data);
171 } 173 }
172 174
173 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) { 175 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) {
174 RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting(data); 176 RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting(data);
175 } 177 }
176 178
177 class LayoutTestDependenciesImpl : public LayoutTestDependencies { 179 class LayoutTestDependenciesImpl : public LayoutTestDependencies {
178 public: 180 public:
179 std::unique_ptr<cc::OutputSurface> CreateOutputSurface( 181 std::unique_ptr<cc::OutputSurface> CreateOutputSurface(
180 uint32_t output_surface_id, 182 scoped_refptr<gpu::GpuChannelHost> gpu_channel,
181 scoped_refptr<cc::ContextProvider> context_provider, 183 scoped_refptr<cc::ContextProvider> compositor_context_provider,
182 scoped_refptr<cc::ContextProvider> worker_context_provider) override { 184 scoped_refptr<cc::ContextProvider> worker_context_provider,
185 CompositorDependencies* deps) override {
186 // This is for an offscreen context for the compositor. So the default
187 // framebuffer doesn't need alpha, depth, stencil, antialiasing.
188 gpu::gles2::ContextCreationAttribHelper attributes;
189 attributes.alpha_size = -1;
190 attributes.depth_size = 0;
191 attributes.stencil_size = 0;
192 attributes.samples = 0;
193 attributes.sample_buffers = 0;
194 attributes.bind_generates_resource = false;
195 attributes.lose_context_when_out_of_memory = true;
196 const bool automatic_flushes = false;
197 const bool support_locking = false;
198
199 scoped_refptr<cc::ContextProvider> display_context_provider(
200 new ContextProviderCommandBuffer(
201 std::move(gpu_channel), gpu::GPU_STREAM_DEFAULT,
202 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle,
203 GURL(
204 "chrome://gpu/LayoutTestDependenciesImpl::CreateOutputSurface"),
205 gl::PreferIntegratedGpu, automatic_flushes, support_locking,
206 gpu::SharedMemoryLimits(), attributes, nullptr,
207 command_buffer_metrics::OFFSCREEN_CONTEXT_FOR_TESTING));
208
209 return base::MakeUnique<cc::PixelTestDelegatingOutputSurface>(
210 std::move(compositor_context_provider),
211 std::move(worker_context_provider), std::move(display_context_provider),
212 deps->GetSharedBitmapManager(), deps->GetGpuMemoryBufferManager(),
213 false, !deps->GetCompositorImplThreadTaskRunner());
214 /*
183 return base::MakeUnique<MailboxOutputSurface>( 215 return base::MakeUnique<MailboxOutputSurface>(
184 output_surface_id, std::move(context_provider), 216 output_surface_id, std::move(context_provider),
185 std::move(worker_context_provider)); 217 std::move(worker_context_provider));
218 */
piman 2016/06/20 16:45:07 nit: remove
danakj 2016/06/20 23:21:00 Done.
186 } 219 }
187 }; 220 };
188 221
189 void EnableRendererLayoutTestMode() { 222 void EnableRendererLayoutTestMode() {
190 RenderThreadImpl::current()->set_layout_test_dependencies( 223 RenderThreadImpl::current()->set_layout_test_dependencies(
191 base::MakeUnique<LayoutTestDependenciesImpl>()); 224 base::MakeUnique<LayoutTestDependenciesImpl>());
192 225
193 #if defined(OS_WIN) 226 #if defined(OS_WIN)
194 RegisterSideloadedTypefaces(SkFontMgr_New_DirectWrite()); 227 RegisterSideloadedTypefaces(SkFontMgr_New_DirectWrite());
195 #endif 228 #endif
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 return result; 486 return result;
454 } 487 }
455 488
456 void SchedulerRunIdleTasks(const base::Closure& callback) { 489 void SchedulerRunIdleTasks(const base::Closure& callback) {
457 scheduler::RendererScheduler* scheduler = 490 scheduler::RendererScheduler* scheduler =
458 content::RenderThreadImpl::current()->GetRendererScheduler(); 491 content::RenderThreadImpl::current()->GetRendererScheduler();
459 scheduler::RunIdleTasksForTesting(scheduler, callback); 492 scheduler::RunIdleTasksForTesting(scheduler, callback);
460 } 493 }
461 494
462 } // namespace content 495 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698