summaryrefslogtreecommitdiffstats
path: root/cc/trees/layer_tree_host_unittest_picture.cc
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2015-01-27 15:36:16 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-27 23:38:44 +0000
commitc949ffe0242ad0459c43a5c9f80f6b29ddb5cbec (patch)
treef13cfb4a525f4fd6406a34db31848ecc5a01f95e /cc/trees/layer_tree_host_unittest_picture.cc
parentd9afd5483d99d09ff383d77428195a00141a9d55 (diff)
downloadchromium_src-c949ffe0242ad0459c43a5c9f80f6b29ddb5cbec.zip
chromium_src-c949ffe0242ad0459c43a5c9f80f6b29ddb5cbec.tar.gz
chromium_src-c949ffe0242ad0459c43a5c9f80f6b29ddb5cbec.tar.bz2
cc: Attempt to deflake the LayerTreeHostPictureTestTwinLayer test.
This test has been flaky (see bug), but I am not able to recreate the flake locally. However, this test does PostSetNeedsCommit() from the impl thread while also causing commits from the main thread in DidCommit which could cause an extra commit to happen in theory. This changes the test to stop using PostSetNeedsCommit() and always cause commits from DidCommit on the main thread, to help make the test more deterministic. R=ajuma, enne@chromium.org, vmpstr BUG=451988 Review URL: https://codereview.chromium.org/877213002 Cr-Commit-Position: refs/heads/master@{#313400}
Diffstat (limited to 'cc/trees/layer_tree_host_unittest_picture.cc')
-rw-r--r--cc/trees/layer_tree_host_unittest_picture.cc28
1 files changed, 19 insertions, 9 deletions
diff --git a/cc/trees/layer_tree_host_unittest_picture.cc b/cc/trees/layer_tree_host_unittest_picture.cc
index 773798a..159200a 100644
--- a/cc/trees/layer_tree_host_unittest_picture.cc
+++ b/cc/trees/layer_tree_host_unittest_picture.cc
@@ -44,16 +44,30 @@ class LayerTreeHostPictureTestTwinLayer
void DidCommit() override {
switch (layer_tree_host()->source_frame_number()) {
+ case 1:
+ // Activate while there are pending and active twins in place.
+ layer_tree_host()->SetNeedsCommit();
+ break;
case 2:
- // Drop the picture layer from the tree.
+ // Drop the picture layer from the tree so the activate will have an
+ // active layer without a pending twin.
layer_tree_host()->root_layer()->children()[0]->RemoveFromParent();
break;
- case 3:
- // Add a new picture layer.
+ case 3: {
+ // Add a new picture layer so the activate will have a pending layer
+ // without an active twin.
scoped_refptr<FakePictureLayer> picture =
FakePictureLayer::Create(&client_);
layer_tree_host()->root_layer()->AddChild(picture);
break;
+ }
+ case 4:
+ // Active while there are pending and active twins again.
+ layer_tree_host()->SetNeedsCommit();
+ break;
+ case 5:
+ EndTest();
+ break;
}
}
@@ -87,7 +101,7 @@ class LayerTreeHostPictureTestTwinLayer
// After the first activation, when we commit again, we'll have a pending
// and active layer. Then we recreate a picture layer in the 4th activate
// and the next commit will have a pending and active twin again.
- EXPECT_TRUE(activates_ == 1 || activates_ == 4);
+ EXPECT_TRUE(activates_ == 1 || activates_ == 4) << activates_;
EXPECT_EQ(pending_picture_impl,
active_picture_impl->GetPendingOrActiveTwinLayer());
@@ -114,13 +128,9 @@ class LayerTreeHostPictureTestTwinLayer
}
++activates_;
- if (activates_ <= 4)
- PostSetNeedsCommitToMainThread();
- else
- EndTest();
}
- void AfterTest() override {}
+ void AfterTest() override { EXPECT_EQ(5, activates_); }
int activates_;
};