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

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: layouttests-display2: rebase Created 4 years, 5 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') | third_party/WebKit/LayoutTests/NeverFixTests » ('j') | 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"
28 #include "content/renderer/gpu/render_widget_compositor.h"
26 #include "content/renderer/history_entry.h" 29 #include "content/renderer/history_entry.h"
27 #include "content/renderer/history_serialization.h" 30 #include "content/renderer/history_serialization.h"
28 #include "content/renderer/layout_test_dependencies.h" 31 #include "content/renderer/layout_test_dependencies.h"
29 #include "content/renderer/render_frame_impl.h" 32 #include "content/renderer/render_frame_impl.h"
30 #include "content/renderer/render_thread_impl.h" 33 #include "content/renderer/render_thread_impl.h"
31 #include "content/renderer/render_view_impl.h" 34 #include "content/renderer/render_view_impl.h"
32 #include "content/renderer/renderer_blink_platform_impl.h" 35 #include "content/renderer/renderer_blink_platform_impl.h"
33 #include "content/shell/common/shell_switches.h" 36 #include "content/shell/common/shell_switches.h"
34 #include "content/test/mailbox_output_surface.h" 37 #include "content/test/mailbox_output_surface.h"
35 #include "device/bluetooth/bluetooth_adapter.h" 38 #include "device/bluetooth/bluetooth_adapter.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 RendererBlinkPlatformImpl::SetMockDeviceMotionDataForTesting(data); 174 RendererBlinkPlatformImpl::SetMockDeviceMotionDataForTesting(data);
172 } 175 }
173 176
174 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) { 177 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) {
175 RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting(data); 178 RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting(data);
176 } 179 }
177 180
178 class LayoutTestDependenciesImpl : public LayoutTestDependencies { 181 class LayoutTestDependenciesImpl : public LayoutTestDependencies {
179 public: 182 public:
180 std::unique_ptr<cc::OutputSurface> CreateOutputSurface( 183 std::unique_ptr<cc::OutputSurface> CreateOutputSurface(
181 uint32_t output_surface_id, 184 scoped_refptr<gpu::GpuChannelHost> gpu_channel,
182 scoped_refptr<cc::ContextProvider> context_provider, 185 scoped_refptr<cc::ContextProvider> compositor_context_provider,
183 scoped_refptr<cc::ContextProvider> worker_context_provider) override { 186 scoped_refptr<cc::ContextProvider> worker_context_provider,
184 return base::MakeUnique<MailboxOutputSurface>( 187 CompositorDependencies* deps) override {
185 output_surface_id, std::move(context_provider), 188 // This is for an offscreen context for the compositor. So the default
186 std::move(worker_context_provider)); 189 // framebuffer doesn't need alpha, depth, stencil, antialiasing.
190 gpu::gles2::ContextCreationAttribHelper attributes;
191 attributes.alpha_size = -1;
192 attributes.depth_size = 0;
193 attributes.stencil_size = 0;
194 attributes.samples = 0;
195 attributes.sample_buffers = 0;
196 attributes.bind_generates_resource = false;
197 attributes.lose_context_when_out_of_memory = true;
198 const bool automatic_flushes = false;
199 const bool support_locking = false;
200
201 scoped_refptr<cc::ContextProvider> display_context_provider(
202 new ContextProviderCommandBuffer(
203 std::move(gpu_channel), gpu::GPU_STREAM_DEFAULT,
204 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle,
205 GURL(
206 "chrome://gpu/LayoutTestDependenciesImpl::CreateOutputSurface"),
207 gl::PreferIntegratedGpu, automatic_flushes, support_locking,
208 gpu::SharedMemoryLimits(), attributes, nullptr,
209 command_buffer_metrics::OFFSCREEN_CONTEXT_FOR_TESTING));
210
211 cc::LayerTreeSettings settings =
212 RenderWidgetCompositor::GenerateLayerTreeSettings(
213 *base::CommandLine::ForCurrentProcess(), deps, 1.f);
214
215 return base::MakeUnique<cc::PixelTestDelegatingOutputSurface>(
216 std::move(compositor_context_provider),
217 std::move(worker_context_provider), std::move(display_context_provider),
218 settings.renderer_settings, deps->GetSharedBitmapManager(),
219 deps->GetGpuMemoryBufferManager(), gfx::Size(), false,
220 !deps->GetCompositorImplThreadTaskRunner());
187 } 221 }
188 }; 222 };
189 223
190 void EnableRendererLayoutTestMode() { 224 void EnableRendererLayoutTestMode() {
191 RenderThreadImpl::current()->set_layout_test_dependencies( 225 RenderThreadImpl::current()->set_layout_test_dependencies(
192 base::MakeUnique<LayoutTestDependenciesImpl>()); 226 base::MakeUnique<LayoutTestDependenciesImpl>());
193 227
194 #if defined(OS_WIN) 228 #if defined(OS_WIN)
195 RegisterSideloadedTypefaces(SkFontMgr_New_DirectWrite()); 229 RegisterSideloadedTypefaces(SkFontMgr_New_DirectWrite());
196 #endif 230 #endif
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 return result; 494 return result;
461 } 495 }
462 496
463 void SchedulerRunIdleTasks(const base::Closure& callback) { 497 void SchedulerRunIdleTasks(const base::Closure& callback) {
464 scheduler::RendererScheduler* scheduler = 498 scheduler::RendererScheduler* scheduler =
465 content::RenderThreadImpl::current()->GetRendererScheduler(); 499 content::RenderThreadImpl::current()->GetRendererScheduler();
466 scheduler::RunIdleTasksForTesting(scheduler, callback); 500 scheduler::RunIdleTasksForTesting(scheduler, callback);
467 } 501 }
468 502
469 } // namespace content 503 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | third_party/WebKit/LayoutTests/NeverFixTests » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698