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 79dfec685dabe2c4001a7d7bc32e4c601ef33f02..2e5e59f83014f2034dd7016aee1592f44ca934f9 100644 |
--- a/cc/layers/picture_layer_impl_unittest.cc |
+++ b/cc/layers/picture_layer_impl_unittest.cc |
@@ -636,6 +636,10 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { |
// Add a non-shared tiling on the active tree. |
PictureLayerTiling* tiling = active_layer_->AddTiling(3.f); |
tiling->CreateAllTilesForTesting(); |
+ |
+ // Ensure UpdateTiles won't remove any tilings. |
+ active_layer_->MarkAllTilingsUsed(); |
+ |
// Then setup a new pending tree and activate it. |
SetupTreesWithFixedTileSize(pending_pile, active_pile, gfx::Size(50, 50), |
layer_invalidation); |
@@ -919,6 +923,9 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) { |
EXPECT_BOTH_EQ(tilings()->tiling_at(1)->contents_scale(), |
2.f * low_res_factor); |
+ // Ensure UpdateTiles won't remove any tilings. |
+ active_layer_->MarkAllTilingsUsed(); |
+ |
// Start a pinch gesture. |
host_impl_.PinchGestureBegin(); |
@@ -933,6 +940,9 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) { |
EXPECT_FLOAT_EQ(2.0f * low_res_factor, |
active_layer_->tilings()->tiling_at(2)->contents_scale()); |
+ // Ensure UpdateTiles won't remove any tilings. |
+ active_layer_->MarkAllTilingsUsed(); |
+ |
// Zoom out further, close to our low-res scale factor. We should |
// use that tiling as high-res, and not create a new tiling. |
SetContentsScaleOnBothLayers(low_res_factor * 2.1f, 1.0f, |
@@ -969,6 +979,9 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) { |
EXPECT_FLOAT_EQ(0.0625f, |
active_layer_->tilings()->tiling_at(1)->contents_scale()); |
+ // Ensure UpdateTiles won't remove any tilings. |
+ active_layer_->MarkAllTilingsUsed(); |
+ |
// Start a pinch gesture. |
host_impl_.PinchGestureBegin(); |
@@ -983,6 +996,9 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) { |
EXPECT_FLOAT_EQ(0.0625, |
active_layer_->tilings()->tiling_at(2)->contents_scale()); |
+ // Ensure UpdateTiles won't remove any tilings. |
+ active_layer_->MarkAllTilingsUsed(); |
+ |
// Zoom out further, close to our low-res scale factor. We should |
// use that tiling as high-res, and not create a new tiling. |
SetContentsScaleOnBothLayers(0.1f, 1.0f, 0.1f, 1.0f, false); |
@@ -1022,6 +1038,11 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { |
EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); |
EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale()); |
+ // Ensure UpdateTiles won't remove any tilings. Note this is unrelated to |
+ // |used_tilings| variable, and it's here only to ensure that active_layer_ |
+ // won't remove tilings before the test has a chance to verify behavior. |
+ active_layer_->MarkAllTilingsUsed(); |
+ |
// We only have ideal tilings, so they aren't removed. |
used_tilings.clear(); |
active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
@@ -1054,6 +1075,9 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { |
1.f * low_res_factor, |
active_layer_->tilings()->tiling_at(3)->contents_scale()); |
+ // Ensure UpdateTiles won't remove any tilings. |
+ active_layer_->MarkAllTilingsUsed(); |
+ |
// Mark the non-ideal tilings as used. They won't be removed. |
used_tilings.clear(); |
used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); |
@@ -1146,6 +1170,9 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) { |
EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); |
EXPECT_BOTH_EQ(num_tilings(), 2u); |
+ // Ensure UpdateTiles won't remove any tilings. |
+ active_layer_->MarkAllTilingsUsed(); |
+ |
// Page scale animation, new high res, but no low res. We still have |
// a tiling at the previous scale, it's just not marked as low res on the |
// active layer. The pending layer drops non-ideal tilings. |
@@ -3612,6 +3639,14 @@ TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) { |
SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, false); |
ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); |
+ // Ensure UpdateTiles won't remove any tilings. |
+ active_layer_->MarkAllTilingsUsed(); |
+ |
+ // Ensure UpdateTiles won't remove any tilings. Note this is unrelated to |
+ // |used_tilings| variable, and it's here only to ensure that active_layer_ |
+ // won't remove tilings before the test has a chance to verify behavior. |
+ active_layer_->MarkAllTilingsUsed(); |
danakj
2015/01/28 00:12:20
twice just for sure?
vmpstr
2015/01/28 00:16:07
<_< thanks for catching this.
|
+ |
// We only have ideal tilings, so they aren't removed. |
used_tilings.clear(); |
active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
@@ -3640,6 +3675,9 @@ TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) { |
EXPECT_FLOAT_EQ(1.f, |
active_layer_->tilings()->tiling_at(1)->contents_scale()); |
+ // Ensure UpdateTiles won't remove any tilings. |
+ active_layer_->MarkAllTilingsUsed(); |
+ |
// Mark the non-ideal tilings as used. They won't be removed. |
used_tilings.clear(); |
used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); |