Chromium Code Reviews| 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 9085a71a1e42c9e2febe59149a7b51553973da73..1a237af586f8f2e6c8cad8fd92f4bdfa35e4183f 100644 |
| --- a/cc/layers/picture_layer_impl_unittest.cc |
| +++ b/cc/layers/picture_layer_impl_unittest.cc |
| @@ -2361,5 +2361,64 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) { |
| EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
| } |
| +TEST_F(PictureLayerImplTest, AllTilesRequiredForActivationAreReadyToDraw) { |
|
vmpstr
2014/05/21 22:28:30
Can you add a similar test where you first mark al
reveman
2014/05/22 20:47:49
Done.
|
| + gfx::Size tile_size(100, 100); |
| + gfx::Size layer_bounds(1000, 1000); |
| + |
| + scoped_refptr<FakePicturePileImpl> pending_pile = |
| + FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| + |
| + SetupPendingTree(pending_pile); |
| + pending_layer_->SetBounds(layer_bounds); |
| + |
| + ASSERT_TRUE(pending_layer_->CanHaveTilings()); |
| + |
| + float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
| + |
| + pending_layer_->AddTiling(low_res_factor); |
| + pending_layer_->AddTiling(0.3f); |
| + pending_layer_->AddTiling(0.7f); |
| + pending_layer_->AddTiling(1.0f); |
| + pending_layer_->AddTiling(2.0f); |
| + |
| + host_impl_.SetViewportSize(gfx::Size(500, 500)); |
| + host_impl_.pending_tree()->UpdateDrawProperties(); |
| + |
| + // Initialize all low-res tiles. |
| + for (PictureLayerImpl::LayerRasterTileIterator it( |
| + pending_layer_, SAME_PRIORITY_FOR_BOTH_TREES); |
| + it; |
| + ++it) { |
| + Tile* tile = *it; |
| + TilePriority priority = tile->priority(PENDING_TREE); |
| + |
| + if (priority.resolution != LOW_RESOLUTION) |
| + continue; |
| + |
| + ManagedTileState::TileVersion& tile_version = |
| + tile->GetTileVersionForTesting( |
| + tile->DetermineRasterModeForTree(PENDING_TREE)); |
| + tile_version.SetSolidColorForTesting(SK_ColorRED); |
| + } |
| + |
| + // Low-res tiles should not be enough. |
| + EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
| + |
| + // Initialize all tiles. |
| + for (PictureLayerImpl::LayerRasterTileIterator it( |
| + pending_layer_, SAME_PRIORITY_FOR_BOTH_TREES); |
| + it; |
| + ++it) { |
| + Tile* tile = *it; |
| + |
| + ManagedTileState::TileVersion& tile_version = |
| + tile->GetTileVersionForTesting( |
| + tile->DetermineRasterModeForTree(PENDING_TREE)); |
| + tile_version.SetSolidColorForTesting(SK_ColorRED); |
| + } |
| + |
| + EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
| +} |
| + |
| } // namespace |
| } // namespace cc |