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 d919298d97106c61a9f32a2feeb199af0258087b..64454aec33a35c0fad2eb51780ce7a85be821007 100644 |
--- a/cc/layers/picture_layer_impl_unittest.cc |
+++ b/cc/layers/picture_layer_impl_unittest.cc |
@@ -2391,5 +2391,61 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) { |
EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
} |
+TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) { |
+ gfx::Size tile_size(100, 100); |
+ gfx::Size layer_bounds(1000, 1000); |
+ |
+ SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
+ |
+ // Make sure some tiles are not shared. |
+ pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); |
+ |
+ CreateHighLowResAndSetAllTilesVisible(); |
+ active_layer_->SetAllTilesReady(); |
+ pending_layer_->MarkVisibleResourcesAsRequired(); |
+ |
+ // All pending layer tiles required are not ready. |
+ EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
+ |
+ // Initialize all low-res tiles. |
+ pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling()); |
+ |
+ // Low-res tiles should not be enough. |
+ EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
+ |
+ // Initialize remaining tiles. |
+ pending_layer_->SetAllTilesReady(); |
+ |
+ EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
+} |
+ |
+TEST_F(PictureLayerImplTest, HighResReadyToDrawNotEnoughToActivate) { |
+ gfx::Size tile_size(100, 100); |
+ gfx::Size layer_bounds(1000, 1000); |
+ |
+ SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
+ |
+ // Make sure some tiles are not shared. |
+ pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); |
+ |
+ CreateHighLowResAndSetAllTilesVisible(); |
+ active_layer_->SetAllTilesReady(); |
+ pending_layer_->MarkVisibleResourcesAsRequired(); |
+ |
+ // All pending layer tiles required are not ready. |
+ EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
+ |
+ // Initialize all high-res tiles. |
+ pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling()); |
+ |
+ // High-res tiles should not be enough. |
+ EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
+ |
+ // Initialize remaining tiles. |
+ pending_layer_->SetAllTilesReady(); |
+ |
+ EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
+} |
+ |
} // namespace |
} // namespace cc |