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 9716aa91030bf3cf3bfb5094b7c9b7808c9703cc..88ee1e7915aa0477d1ea28443204b7ea06020479 100644 |
| --- a/cc/layers/picture_layer_impl_unittest.cc |
| +++ b/cc/layers/picture_layer_impl_unittest.cc |
| @@ -1200,7 +1200,11 @@ TEST_F(PictureLayerImplTest, HugeMasksDontGetTiles) { |
| // Mask layers have a tiling with a single tile in it. |
| EXPECT_EQ(1u, active_layer_->HighResTiling()->AllTilesForTesting().size()); |
| // The mask resource exists. |
| - EXPECT_NE(0u, active_layer_->ContentsResourceId()); |
| + ResourceProvider::ResourceId mask_resource_id; |
| + gfx::Size mask_texture_size; |
| + active_layer_->ContentsResourceId(&mask_resource_id, &mask_texture_size); |
| + EXPECT_NE(0u, mask_resource_id); |
| + EXPECT_EQ(mask_texture_size, active_layer_->bounds()); |
| // Resize larger than the max texture size. |
| int max_texture_size = host_impl_.GetRendererCapabilities().max_texture_size; |
| @@ -1223,7 +1227,48 @@ TEST_F(PictureLayerImplTest, HugeMasksDontGetTiles) { |
| // Mask layers have a tiling, but there should be no tiles in it. |
| EXPECT_EQ(0u, active_layer_->HighResTiling()->AllTilesForTesting().size()); |
| // The mask resource is empty. |
| - EXPECT_EQ(0u, active_layer_->ContentsResourceId()); |
| + active_layer_->ContentsResourceId(&mask_resource_id, &mask_texture_size); |
| + EXPECT_EQ(0u, mask_resource_id); |
| +} |
| + |
| +TEST_F(PictureLayerImplTest, ScaledMaskLayer) { |
| + gfx::Size tile_size(100, 100); |
| + |
| + scoped_refptr<FakePicturePileImpl> valid_pile = |
| + FakePicturePileImpl::CreateFilledPile(tile_size, gfx::Size(1000, 1000)); |
| + valid_pile->set_is_mask(true); |
| + SetupPendingTree(valid_pile); |
| + |
| + float ideal_contents_scale = 1.3f; |
| + float device_scale = 2.7f; |
|
danakj
2014/10/15 19:37:26
these look fun but you might as well set dsf and p
enne (OOO)
2014/10/15 19:49:03
Done.
|
| + float page_scale = 3.2f; |
| + float maximum_animation_scale = 1.f; |
| + SetupDrawPropertiesAndUpdateTiles(pending_layer_, |
| + ideal_contents_scale, |
| + device_scale, |
| + page_scale, |
| + maximum_animation_scale, |
| + false); |
| + EXPECT_EQ(ideal_contents_scale, |
| + pending_layer_->HighResTiling()->contents_scale()); |
| + EXPECT_EQ(1u, pending_layer_->num_tilings()); |
| + |
| + pending_layer_->HighResTiling()->CreateAllTilesForTesting(); |
| + host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( |
| + pending_layer_->HighResTiling()->AllTilesForTesting()); |
| + |
| + ActivateTree(); |
| + |
| + // Mask layers have a tiling with a single tile in it. |
| + EXPECT_EQ(1u, active_layer_->HighResTiling()->AllTilesForTesting().size()); |
| + // The mask resource exists. |
| + ResourceProvider::ResourceId mask_resource_id; |
| + gfx::Size mask_texture_size; |
| + active_layer_->ContentsResourceId(&mask_resource_id, &mask_texture_size); |
| + EXPECT_NE(0u, mask_resource_id); |
| + gfx::Size expected_mask_texture_size = gfx::ToCeiledSize( |
| + gfx::ScaleSize(active_layer_->bounds(), ideal_contents_scale)); |
| + EXPECT_EQ(mask_texture_size, expected_mask_texture_size); |
| } |
| TEST_F(PictureLayerImplTest, ReleaseResources) { |