Commit 08c848c4 authored by kylechar's avatar kylechar Committed by Commit Bot

Fix flaky CopyOutRequest tests

SkiaCopyOutputScalingPixelTest.ScaledCopyOfDrawnFrame has been flaky
since https://crrev.com/c/2256225 landed. This change made it so that
CopyOutputResults were serialized on worker threads, which breaks the
ordering the test expects. Switch to using the test main thread to run
the result callbacks to remove data race on |dummy_ran|.

Bug: 1100421
Change-Id: Id19df859ed6af48cce85c16689122fa33e171184
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274257
Commit-Queue: kylechar <kylechar@chromium.org>
Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#783960}
parent 5c8d90e6
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "cc/test/pixel_test.h" #include "cc/test/pixel_test.h"
#include "cc/test/pixel_test_utils.h" #include "cc/test/pixel_test_utils.h"
...@@ -145,6 +146,8 @@ class CopyOutputScalingPixelTest ...@@ -145,6 +146,8 @@ class CopyOutputScalingPixelTest
// results of the main copy request (below) if the GL state is not // results of the main copy request (below) if the GL state is not
// properly restored. // properly restored.
request->SetUniformScaleRatio(1, 10); request->SetUniformScaleRatio(1, 10);
// Ensure the result callback is run on test main thread.
request->set_result_task_runner(base::SequencedTaskRunnerHandle::Get());
list.front()->copy_requests.push_back(std::move(request)); list.front()->copy_requests.push_back(std::move(request));
// Add a copy request to the root RenderPass, to capture the results of // Add a copy request to the root RenderPass, to capture the results of
...@@ -164,6 +167,8 @@ class CopyOutputScalingPixelTest ...@@ -164,6 +167,8 @@ class CopyOutputScalingPixelTest
request->set_result_selection( request->set_result_selection(
copy_output::ComputeResultRect(copy_rect, scale_from_, scale_to_)); copy_output::ComputeResultRect(copy_rect, scale_from_, scale_to_));
request->SetScaleRatio(scale_from_, scale_to_); request->SetScaleRatio(scale_from_, scale_to_);
// Ensure the result callback is run on test main thread.
request->set_result_task_runner(base::SequencedTaskRunnerHandle::Get());
list.back()->copy_requests.push_back(std::move(request)); list.back()->copy_requests.push_back(std::move(request));
renderer()->DecideRenderPassAllocationsForFrame(list); renderer()->DecideRenderPassAllocationsForFrame(list);
......
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