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 753bb985154bedfab3d84afc7b8e116d7503607d..2010175b6cc1b1e115101bf1db8d969ec8f84b46 100644 |
| --- a/cc/layers/picture_layer_impl_unittest.cc |
| +++ b/cc/layers/picture_layer_impl_unittest.cc |
| @@ -2809,7 +2809,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, |
| Tile* tile = *it; |
| // Occluded tiles should not be iterated over. |
| - EXPECT_FALSE(tile->is_occluded()); |
| + EXPECT_FALSE(tile->priority(PENDING_TREE).is_occluded); |
| // Some tiles may not be visible (i.e. outside the viewport). The rest are |
| // visible and at least partially unoccluded, verified by the above expect. |
| @@ -2838,7 +2838,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, |
| ++it) { |
| Tile* tile = *it; |
| - EXPECT_FALSE(tile->is_occluded()); |
| + EXPECT_FALSE(tile->priority(PENDING_TREE).is_occluded); |
| bool tile_is_visible = |
| tile->content_rect().Intersects(pending_layer_->visible_content_rect()); |
| @@ -2859,7 +2859,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, |
| ++it) { |
| Tile* tile = *it; |
| - EXPECT_FALSE(tile->is_occluded()); |
| + EXPECT_FALSE(tile->priority(PENDING_TREE).is_occluded); |
| bool tile_is_visible = |
| tile->content_rect().Intersects(pending_layer_->visible_content_rect()); |
| @@ -2903,7 +2903,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, |
| const Tile* tile = *iter; |
| // Fully occluded tiles are not required for activation. |
| - if (tile->is_occluded()) { |
| + if (tile->priority(PENDING_TREE).is_occluded) { |
| EXPECT_FALSE(tile->required_for_activation()); |
| occluded_tile_count++; |
| } |
| @@ -2936,7 +2936,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, |
| continue; |
| const Tile* tile = *iter; |
| - if (tile->is_occluded()) { |
| + if (tile->priority(PENDING_TREE).is_occluded) { |
| EXPECT_FALSE(tile->required_for_activation()); |
| occluded_tile_count++; |
| } |
| @@ -2963,7 +2963,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, |
| continue; |
| const Tile* tile = *iter; |
| - if (tile->is_occluded()) { |
| + if (tile->priority(PENDING_TREE).is_occluded) { |
| EXPECT_FALSE(tile->required_for_activation()); |
| occluded_tile_count++; |
| } |
| @@ -2971,5 +2971,66 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, |
| } |
| EXPECT_EQ(occluded_tile_count, 100 + 25 + 4); |
| } |
| + |
| +TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) { |
| + gfx::Size tile_size(102, 102); |
| + gfx::Size layer_bounds(1000, 1000); |
| + gfx::Size viewport_size(1000, 1000); |
| + |
| + scoped_refptr<FakePicturePileImpl> pending_pile = |
| + FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| + scoped_refptr<FakePicturePileImpl> active_pile = |
| + FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| + SetupTrees(pending_pile, active_pile); |
| + |
| + // Fully occlude the active layer. |
| + active_layer_->AddChild(LayerImpl::Create(host_impl_.active_tree(), 2)); |
| + LayerImpl* layer1 = active_layer_->children()[0]; |
| + layer1->SetBounds(layer_bounds); |
| + layer1->SetContentBounds(layer_bounds); |
| + layer1->SetDrawsContent(true); |
| + layer1->SetContentsOpaque(true); |
| + |
| + host_impl_.SetViewportSize(viewport_size); |
| + |
| + host_impl_.pending_tree()->UpdateDrawProperties(); |
| + host_impl_.active_tree()->UpdateDrawProperties(); |
| + |
| + for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { |
| + PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); |
| + |
| + for (PictureLayerTiling::CoverageIterator iter( |
| + tiling, |
| + pending_layer_->contents_scale_x(), |
| + gfx::Rect(layer_bounds)); |
| + iter; |
| + ++iter) { |
| + if (!*iter) |
| + continue; |
| + const Tile* tile = *iter; |
|
danakj
2014/06/17 22:29:41
can you show with EXPECT checks that these Tile* a
jbedley
2014/06/18 23:00:39
Actually both loops were doing the same thing beca
|
| + |
| + EXPECT_FALSE(tile->priority(PENDING_TREE).is_occluded); |
| + EXPECT_TRUE(tile->priority(ACTIVE_TREE).is_occluded); |
| + } |
| + } |
| + |
| + for (size_t i = 0; i < active_layer_->num_tilings(); ++i) { |
| + PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i); |
| + |
| + for (PictureLayerTiling::CoverageIterator iter( |
| + tiling, |
| + active_layer_->contents_scale_x(), |
| + gfx::Rect(layer_bounds)); |
| + iter; |
| + ++iter) { |
| + if (!*iter) |
| + continue; |
| + const Tile* tile = *iter; |
| + |
| + EXPECT_FALSE(tile->priority(PENDING_TREE).is_occluded); |
| + EXPECT_TRUE(tile->priority(ACTIVE_TREE).is_occluded); |
| + } |
| + } |
| +} |
| } // namespace |
| } // namespace cc |