Commit 8f76378d authored by kylechar's avatar kylechar Committed by Commit Bot

Check context result in layout tests.

This CL adds a check when initializing the ContextProvider for layout
tests. We should retry the on transient failures but just crash for
fatal failures. There is no compositing mode fallback in layout tests
for simplicity, so we can't do much other than crash here.

The reason for this change is that ClusterFuzz was picking up access to
some uninitialized data in some vaguely related code. This happens
because there is a fatal failure in CreateDisplayOutputSurface() that is
ignored. The crash stack should now pinpoint exactly where the failure
was and make problems easier to diagnose.

Bug: 817758
Change-Id: I766c0526e0e2c01d16be922f78de1b89365ae401
Reviewed-on: https://chromium-review.googlesource.com/980653Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546085}
parent 6dd0abb6
...@@ -382,16 +382,23 @@ class LayoutTestDependenciesImpl : public LayoutTestDependencies, ...@@ -382,16 +382,23 @@ class LayoutTestDependenciesImpl : public LayoutTestDependencies,
const bool automatic_flushes = false; const bool automatic_flushes = false;
const bool support_locking = false; const bool support_locking = false;
auto context_provider = scoped_refptr<viz::ContextProvider> context_provider;
base::MakeRefCounted<ui::ContextProviderCommandBuffer>(
gpu_channel_, gpu_memory_buffer_manager_, kGpuStreamIdDefault, gpu::ContextResult context_result = gpu::ContextResult::kTransientFailure;
kGpuStreamPriorityDefault, gpu::kNullSurfaceHandle, while (context_result != gpu::ContextResult::kSuccess) {
GURL("chrome://gpu/" context_provider = base::MakeRefCounted<ui::ContextProviderCommandBuffer>(
"LayoutTestDependenciesImpl::CreateOutputSurface"), gpu_channel_, gpu_memory_buffer_manager_, kGpuStreamIdDefault,
automatic_flushes, support_locking, gpu::SharedMemoryLimits(), kGpuStreamPriorityDefault, gpu::kNullSurfaceHandle,
attributes, nullptr, GURL("chrome://gpu/"
ui::command_buffer_metrics::OFFSCREEN_CONTEXT_FOR_TESTING); "LayoutTestDependenciesImpl::CreateOutputSurface"),
context_provider->BindToCurrentThread(); automatic_flushes, support_locking, gpu::SharedMemoryLimits(),
attributes, nullptr,
ui::command_buffer_metrics::OFFSCREEN_CONTEXT_FOR_TESTING);
context_result = context_provider->BindToCurrentThread();
// Layout tests can't recover from a fatal failure.
CHECK_NE(context_result, gpu::ContextResult::kFatalFailure);
}
bool flipped_output_surface = false; bool flipped_output_surface = false;
return std::make_unique<cc::PixelTestOutputSurface>( return std::make_unique<cc::PixelTestOutputSurface>(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment