Index: cc/layers/picture_layer_impl_unittest.cc |
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc |
index 8ccd54f37c3e02411aafee13f56dfc524b080aa4..f4187e9ace0d235fadfed218b7335898eef60fea 100644 |
--- a/cc/layers/picture_layer_impl_unittest.cc |
+++ b/cc/layers/picture_layer_impl_unittest.cc |
@@ -53,7 +53,10 @@ class PictureLayerImplTest : public testing::Test { |
host_impl_(ImplSidePaintingSettings(), |
&proxy_, |
&shared_bitmap_manager_), |
- id_(7) {} |
+ id_(7), |
+ pending_layer_(NULL), |
+ old_pending_layer_(NULL), |
+ active_layer_(NULL) {} |
explicit PictureLayerImplTest(const LayerTreeSettings& settings) |
: proxy_(base::MessageLoopProxy::current()), |
@@ -86,6 +89,8 @@ class PictureLayerImplTest : public testing::Test { |
void ActivateTree() { |
host_impl_.ActivateSyncTree(); |
CHECK(!host_impl_.pending_tree()); |
+ CHECK(host_impl_.recycle_tree()); |
+ old_pending_layer_ = pending_layer_; |
pending_layer_ = NULL; |
active_layer_ = static_cast<FakePictureLayerImpl*>( |
host_impl_.active_tree()->LayerById(id_)); |
@@ -266,6 +271,7 @@ class PictureLayerImplTest : public testing::Test { |
FakeLayerTreeHostImpl host_impl_; |
int id_; |
FakePictureLayerImpl* pending_layer_; |
+ FakePictureLayerImpl* old_pending_layer_; |
FakePictureLayerImpl* active_layer_; |
private: |
@@ -4145,5 +4151,31 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, |
VerifyEvictionConsidersOcclusion(active_layer_, |
total_expected_occluded_tile_count); |
} |
+ |
+TEST_F(PictureLayerImplTest, RecycledTwinLayer) { |
+ gfx::Size tile_size(102, 102); |
+ gfx::Size layer_bounds(1000, 1000); |
+ |
+ scoped_refptr<FakePicturePileImpl> pile = |
+ FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
+ SetupPendingTree(pile); |
+ EXPECT_FALSE(pending_layer_->GetRecycledTwinLayer()); |
+ |
+ ActivateTree(); |
+ EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); |
+ EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); |
+ |
+ SetupPendingTree(pile); |
+ EXPECT_FALSE(pending_layer_->GetRecycledTwinLayer()); |
+ EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); |
+ |
+ ActivateTree(); |
+ EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); |
+ EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); |
+ |
+ host_impl_.ResetRecycleTreeForTesting(); |
+ EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); |
+} |
+ |
} // namespace |
} // namespace cc |