summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-16 18:21:03 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-16 18:21:03 +0000
commite9c7f0553447bb4127a5f3231b035ce8db6e7e08 (patch)
tree4bf780ebf13486289d72abbdb87a28c6e9c65a5b /cc
parent92e867b810c1231a8c941456abb43c4e107fd149 (diff)
downloadchromium_src-e9c7f0553447bb4127a5f3231b035ce8db6e7e08.zip
chromium_src-e9c7f0553447bb4127a5f3231b035ce8db6e7e08.tar.gz
chromium_src-e9c7f0553447bb4127a5f3231b035ce8db6e7e08.tar.bz2
cc: Fix flaky LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
Single thread and threaded mode pass back the requirement to commit after changing memory policy differently, which makes this test flaky if it wants to test both. We want to post the commit/invalidate once the first frame has been drawn, so use DidCommitAndDrawFrame() on the main thread. Because the impl thread posts a SetNeedsCommit, it can get three updates instead of two, so handle that in the test and ignore the followup if it occurs. R=jamesr@chromium.org BUG=260114 Review URL: https://codereview.chromium.org/19389002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211814 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/trees/layer_tree_host_unittest.cc43
1 files changed, 20 insertions, 23 deletions
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index b6a7806..a1b981b 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -1486,40 +1486,38 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestCompositeAndReadbackCleanup);
class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
: public LayerTreeHostTest {
- public:
- LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit()
- : root_layer_(FakeContentLayer::Create(&client_)),
- surface_layer1_(
- FakeContentLayer::Create(&client_)),
- replica_layer1_(
- FakeContentLayer::Create(&client_)),
- surface_layer2_(
- FakeContentLayer::Create(&client_)),
- replica_layer2_(
- FakeContentLayer::Create(&client_)) {}
-
+ protected:
virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
settings->cache_render_pass_contents = true;
}
- virtual void BeginTest() OVERRIDE {
- layer_tree_host()->SetViewportSize(gfx::Size(100, 100));
-
+ virtual void SetupTree() OVERRIDE {
+ root_layer_ = FakeContentLayer::Create(&client_);
root_layer_->SetBounds(gfx::Size(100, 100));
+
+ surface_layer1_ = FakeContentLayer::Create(&client_);
surface_layer1_->SetBounds(gfx::Size(100, 100));
surface_layer1_->SetForceRenderSurface(true);
surface_layer1_->SetOpacity(0.5f);
+ root_layer_->AddChild(surface_layer1_);
+
+ surface_layer2_ = FakeContentLayer::Create(&client_);
surface_layer2_->SetBounds(gfx::Size(100, 100));
surface_layer2_->SetForceRenderSurface(true);
surface_layer2_->SetOpacity(0.5f);
+ surface_layer1_->AddChild(surface_layer2_);
+ replica_layer1_ = FakeContentLayer::Create(&client_);
surface_layer1_->SetReplicaLayer(replica_layer1_.get());
+
+ replica_layer2_ = FakeContentLayer::Create(&client_);
surface_layer2_->SetReplicaLayer(replica_layer2_.get());
- root_layer_->AddChild(surface_layer1_);
- surface_layer1_->AddChild(surface_layer2_);
layer_tree_host()->SetRootLayer(root_layer_);
+ LayerTreeHostTest::SetupTree();
+ }
+ virtual void BeginTest() OVERRIDE {
PostSetNeedsCommitToMainThread();
}
@@ -1555,18 +1553,17 @@ class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
}
}
- virtual void DidCommit() OVERRIDE {
+ virtual void DidCommitAndDrawFrame() OVERRIDE {
if (layer_tree_host()->commit_number() < 2)
root_layer_->SetNeedsDisplay();
}
virtual void AfterTest() OVERRIDE {
- EXPECT_EQ(2u, root_layer_->update_count());
- EXPECT_EQ(2u, surface_layer1_->update_count());
- EXPECT_EQ(2u, surface_layer2_->update_count());
+ EXPECT_LE(2u, root_layer_->update_count());
+ EXPECT_LE(2u, surface_layer1_->update_count());
+ EXPECT_LE(2u, surface_layer2_->update_count());
}
- private:
FakeContentLayerClient client_;
scoped_refptr<FakeContentLayer> root_layer_;
scoped_refptr<FakeContentLayer> surface_layer1_;
@@ -1575,7 +1572,7 @@ class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
scoped_refptr<FakeContentLayer> replica_layer2_;
};
- // Surfaces don't exist with a delegated renderer.
+// Surfaces don't exist with a delegated renderer.
SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit);