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 bdbe172213f67d122434c37a303c3dcd07c8a83e..786b1895885f6d9ee8889f5ca7b877951964767f 100644 |
| --- a/cc/layers/picture_layer_impl_unittest.cc |
| +++ b/cc/layers/picture_layer_impl_unittest.cc |
| @@ -1727,6 +1727,53 @@ TEST_F(PictureLayerImplTest, SyncTilingAfterReleaseResource) { |
| EXPECT_EQ(HIGH_RESOLUTION, high_res->resolution()); |
| } |
| +TEST_F(PictureLayerImplTest, HighResCreatedWhenBoundsShrink) { |
| + SetupDefaultTrees(gfx::Size(10, 10)); |
| + host_impl_.active_tree()->UpdateDrawProperties(); |
| + EXPECT_FALSE(host_impl_.active_tree()->needs_update_draw_properties()); |
| + |
| + float result_scale_x; |
| + float result_scale_y; |
| + gfx::Size result_bounds; |
| + active_layer_->CalculateContentsScale(0.5f, |
| + 0.5f, |
| + 0.5f, |
| + 0.5f, |
| + false, |
| + &result_scale_x, |
| + &result_scale_y, |
| + &result_bounds); |
| + active_layer_->tilings()->RemoveAllTilings(); |
| + PictureLayerTiling* tiling = active_layer_->tilings()->AddTiling(0.5f); |
| + active_layer_->tilings()->AddTiling(1.5f); |
| + active_layer_->tilings()->AddTiling(0.25f); |
| + tiling->set_resolution(HIGH_RESOLUTION); |
| + |
| + // Sanity checks. |
| + ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); |
| + ASSERT_EQ(tiling, active_layer_->tilings()->TilingAtScale(0.5f)); |
| + |
| + // Ensure we need post commit initialization on the pending layer. |
|
enne (OOO)
2014/05/19 22:27:36
This is a very informative comment. Maybe say you
vmpstr
2014/05/19 22:46:28
Done.
|
| + pending_layer_->SetNeedsPostCommitInitialization(); |
| + pending_layer_->set_twin_layer(NULL); |
| + active_layer_->set_twin_layer(NULL); |
| + EXPECT_TRUE(pending_layer_->needs_post_commit_initialization()); |
| + |
| + pending_layer_->SetBounds(gfx::Size(1, 1)); |
| + host_impl_.pending_tree()->UpdateDrawProperties(); |
| + |
| + // Another sanity check. |
| + ASSERT_EQ(1.f, pending_layer_->MinimumContentsScale()); |
| + |
| + EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings()); |
| + ASSERT_TRUE(pending_layer_->tilings()->TilingAtScale(1.0f)); |
| + EXPECT_EQ(HIGH_RESOLUTION, |
| + pending_layer_->tilings()->TilingAtScale(1.0f)->resolution()); |
| + ASSERT_TRUE(pending_layer_->tilings()->TilingAtScale(1.5f)); |
| + EXPECT_EQ(NON_IDEAL_RESOLUTION, |
| + pending_layer_->tilings()->TilingAtScale(1.5f)->resolution()); |
| +} |
| + |
| TEST_F(PictureLayerImplTest, NoLowResTilingWithGpuRasterization) { |
| gfx::Size default_tile_size(host_impl_.settings().default_tile_size); |
| gfx::Size layer_bounds(default_tile_size.width() * 4, |