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

Unified Diff: cc/trees/layer_tree_host_unittest_copyrequest.cc

Issue 888663003: cc: Fix flakiness in LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest_copyrequest.cc
diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc
index 4d3a4be911a3244e599f6c238da07076bdcc7a9f..5766a192106ae001a53df07f64c1d7c258da0f85 100644
--- a/cc/trees/layer_tree_host_unittest_copyrequest.cc
+++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc
@@ -967,7 +967,7 @@ class LayerTreeHostCopyRequestTestShutdownBeforeCopy
SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
LayerTreeHostCopyRequestTestShutdownBeforeCopy);
-class LayerTreeHostCopyRequestTestMultipleDrawsWithHiddenCopyRequest
+class LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest
: public LayerTreeHostCopyRequestTest {
protected:
void SetupTree() override {
@@ -986,6 +986,7 @@ class LayerTreeHostCopyRequestTestMultipleDrawsWithHiddenCopyRequest
void BeginTest() override {
num_draws_ = 0;
copy_happened_ = false;
+ draw_happened_ = false;
PostSetNeedsCommitToMainThread();
}
@@ -994,7 +995,7 @@ class LayerTreeHostCopyRequestTestMultipleDrawsWithHiddenCopyRequest
if (layer_tree_host()->source_frame_number() == 1) {
child_->RequestCopyOfOutput(
CopyOutputRequest::CreateBitmapRequest(base::Bind(
- &LayerTreeHostCopyRequestTestMultipleDrawsWithHiddenCopyRequest::
+ &LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest::
CopyOutputCallback,
base::Unretained(this))));
}
@@ -1047,8 +1048,13 @@ class LayerTreeHostCopyRequestTestMultipleDrawsWithHiddenCopyRequest
// End the test! Don't race with copy request callbacks, so post the end
// to the main thread.
- EXPECT_TRUE(copy_happened_);
- PostEndTestToMainThread();
+ draw_happened_ = true;
+ MainThreadTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(
+ &LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest::
+ TryEndTest,
+ base::Unretained(this)));
break;
}
return draw_result;
@@ -1057,6 +1063,12 @@ class LayerTreeHostCopyRequestTestMultipleDrawsWithHiddenCopyRequest
void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
EXPECT_FALSE(TestEnded());
copy_happened_ = true;
+ TryEndTest();
+ }
+
+ void TryEndTest() {
+ if (draw_happened_ && copy_happened_)
+ EndTest();
}
void AfterTest() override {}
@@ -1065,10 +1077,11 @@ class LayerTreeHostCopyRequestTestMultipleDrawsWithHiddenCopyRequest
FakeContentLayerClient client_;
int num_draws_;
bool copy_happened_;
+ bool draw_happened_;
};
-SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(
- LayerTreeHostCopyRequestTestMultipleDrawsWithHiddenCopyRequest);
+SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
+ LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest);
} // namespace
} // namespace cc
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698