Chromium Code Reviews| Index: cc/trees/layer_tree_host_impl_unittest.cc |
| diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc |
| index 167b65a0a2ecfb629fab2472949b5bc59ddf238a..e682351fa6ea15bdb848350cd900b0d29b06d43c 100644 |
| --- a/cc/trees/layer_tree_host_impl_unittest.cc |
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc |
| @@ -1879,47 +1879,70 @@ TEST_F(LayerTreeHostImplTest, DidDrawCalledOnAllLayers) { |
| class MissingTextureAnimatingLayer : public DidDrawCheckLayer { |
| public: |
| - static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, |
| - int id, |
| - bool tile_missing, |
| - bool had_incomplete_tile, |
| - bool animating, |
| - ResourceProvider* resource_provider) { |
| - return scoped_ptr<LayerImpl>( |
| - new MissingTextureAnimatingLayer(tree_impl, |
| - id, |
| - tile_missing, |
| - had_incomplete_tile, |
| - animating, |
| - resource_provider)); |
| + static scoped_ptr<LayerImpl> Create( |
| + LayerTreeImpl* tree_impl, |
| + int id, |
| + bool tile_missing, |
| + bool tile_missing_outside_activation_rect, |
| + bool had_incomplete_tile, |
| + bool had_incomplete_tile_outside_activation_rect, |
| + bool animating, |
| + ResourceProvider* resource_provider) { |
| + return scoped_ptr<LayerImpl>(new MissingTextureAnimatingLayer( |
| + tree_impl, |
| + id, |
| + tile_missing, |
| + tile_missing_outside_activation_rect, |
| + had_incomplete_tile, |
| + had_incomplete_tile_outside_activation_rect, |
| + animating, |
| + resource_provider)); |
| } |
| virtual void AppendQuads(RenderPass* render_pass, |
| const OcclusionTracker<LayerImpl>& occlusion_tracker, |
| AppendQuadsData* append_quads_data) OVERRIDE { |
| LayerImpl::AppendQuads(render_pass, occlusion_tracker, append_quads_data); |
| - if (had_incomplete_tile_) |
| + if (had_incomplete_tile_) { |
| append_quads_data->num_incomplete_tiles++; |
| - if (tile_missing_) |
| + append_quads_data->num_incomplete_tiles_inside_activation_rect++; |
| + } |
| + if (had_incomplete_tile_outside_activation_rect_) { |
| + append_quads_data->num_incomplete_tiles++; |
| + } |
| + if (tile_missing_) { |
| append_quads_data->num_missing_tiles++; |
| + append_quads_data->num_missing_tiles_inside_activation_rect++; |
| + } |
| + if (tile_missing_outside_activation_rect_) { |
| + append_quads_data->num_missing_tiles++; |
| + } |
| } |
| private: |
| MissingTextureAnimatingLayer(LayerTreeImpl* tree_impl, |
| int id, |
| bool tile_missing, |
| + bool tile_missing_outside_activation_rect, |
| bool had_incomplete_tile, |
| + bool had_incomplete_tile_outside_activation_rect, |
| bool animating, |
| ResourceProvider* resource_provider) |
| : DidDrawCheckLayer(tree_impl, id), |
| tile_missing_(tile_missing), |
| - had_incomplete_tile_(had_incomplete_tile) { |
| + tile_missing_outside_activation_rect_( |
| + tile_missing_outside_activation_rect), |
| + had_incomplete_tile_(had_incomplete_tile), |
| + had_incomplete_tile_outside_activation_rect_( |
| + had_incomplete_tile_outside_activation_rect) { |
| if (animating) |
| AddAnimatedTransformToLayer(this, 10.0, 3, 0); |
| } |
| bool tile_missing_; |
| + bool tile_missing_outside_activation_rect_; |
| bool had_incomplete_tile_; |
| + bool had_incomplete_tile_outside_activation_rect_; |
| }; |
| TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsOnDefault) { |
| @@ -1929,15 +1952,19 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsOnDefault) { |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| bool tile_missing = false; |
| + bool tile_missing_outside_activation_rect = false; |
| bool had_incomplete_tile = false; |
| + bool had_incomplete_tile_outside_activation_rect = false; |
| bool is_animating = false; |
| - root->AddChild( |
| - MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
| - 2, |
| - tile_missing, |
| - had_incomplete_tile, |
| - is_animating, |
| - host_impl_->resource_provider())); |
| + root->AddChild(MissingTextureAnimatingLayer::Create( |
| + host_impl_->active_tree(), |
| + 2, |
| + tile_missing, |
| + tile_missing_outside_activation_rect, |
| + had_incomplete_tile, |
| + had_incomplete_tile_outside_activation_rect, |
| + is_animating, |
| + host_impl_->resource_provider())); |
| LayerTreeHostImpl::FrameData frame; |
| @@ -1952,15 +1979,19 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithAnimatedLayer) { |
| DidDrawCheckLayer* root = |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| bool tile_missing = false; |
| + bool tile_missing_outside_activation_rect = false; |
| bool had_incomplete_tile = false; |
| + bool had_incomplete_tile_outside_activation_rect = false; |
| bool is_animating = true; |
| - root->AddChild( |
| - MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
| - 2, |
| - tile_missing, |
| - had_incomplete_tile, |
| - is_animating, |
| - host_impl_->resource_provider())); |
| + root->AddChild(MissingTextureAnimatingLayer::Create( |
| + host_impl_->active_tree(), |
| + 2, |
| + tile_missing, |
| + tile_missing_outside_activation_rect, |
| + had_incomplete_tile, |
| + had_incomplete_tile_outside_activation_rect, |
| + is_animating, |
| + host_impl_->resource_provider())); |
| LayerTreeHostImpl::FrameData frame; |
| @@ -1976,15 +2007,19 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) { |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| bool tile_missing = true; |
| + bool tile_missing_outside_activation_rect = false; |
| bool had_incomplete_tile = false; |
| + bool had_incomplete_tile_outside_activation_rect = false; |
| bool is_animating = false; |
| - root->AddChild( |
| - MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
| - 4, |
| - tile_missing, |
| - had_incomplete_tile, |
| - is_animating, |
| - host_impl_->resource_provider())); |
| + root->AddChild(MissingTextureAnimatingLayer::Create( |
| + host_impl_->active_tree(), |
| + 4, |
| + tile_missing, |
| + tile_missing_outside_activation_rect, |
| + had_incomplete_tile, |
| + had_incomplete_tile_outside_activation_rect, |
| + is_animating, |
| + host_impl_->resource_provider())); |
| LayerTreeHostImpl::FrameData frame; |
| EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| @@ -1998,15 +2033,73 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) { |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| bool tile_missing = false; |
| + bool tile_missing_outside_activation_rect = false; |
| bool had_incomplete_tile = true; |
| + bool had_incomplete_tile_outside_activation_rect = false; |
| bool is_animating = false; |
| - root->AddChild( |
| - MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
| - 4, |
| - tile_missing, |
| - had_incomplete_tile, |
| - is_animating, |
| - host_impl_->resource_provider())); |
| + root->AddChild(MissingTextureAnimatingLayer::Create( |
| + host_impl_->active_tree(), |
| + 4, |
| + tile_missing, |
| + tile_missing_outside_activation_rect, |
| + had_incomplete_tile, |
| + had_incomplete_tile_outside_activation_rect, |
| + is_animating, |
| + host_impl_->resource_provider())); |
| + LayerTreeHostImpl::FrameData frame; |
| + EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| + host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| + host_impl_->DidDrawAllLayers(frame); |
| +} |
| + |
| +TEST_F(LayerTreeHostImplTest, |
| + PrepareToDrawSucceedsWithIncompleteTileOutsideActivationRect) { |
| + host_impl_->active_tree()->SetRootLayer( |
| + DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); |
| + DidDrawCheckLayer* root = |
| + static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| + |
| + bool tile_missing = false; |
| + bool tile_missing_outside_activation_rect = false; |
| + bool had_incomplete_tile = true; |
| + bool had_incomplete_tile_outside_activation_rect = true; |
| + bool is_animating = false; |
| + root->AddChild(MissingTextureAnimatingLayer::Create( |
| + host_impl_->active_tree(), |
| + 4, |
| + tile_missing, |
| + tile_missing_outside_activation_rect, |
| + had_incomplete_tile, |
| + had_incomplete_tile_outside_activation_rect, |
| + is_animating, |
| + host_impl_->resource_provider())); |
| + LayerTreeHostImpl::FrameData frame; |
| + EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| + host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| + host_impl_->DidDrawAllLayers(frame); |
| +} |
| + |
| +TEST_F(LayerTreeHostImplTest, |
| + PrepareToDrawSucceedsWithMissingTileOutsideActivationRect) { |
| + host_impl_->active_tree()->SetRootLayer( |
| + DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); |
| + DidDrawCheckLayer* root = |
| + static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| + |
| + bool tile_missing = false; |
|
hush (inactive)
2014/08/18 20:48:16
should this be true?
tile_missing_outside_activati
boliu
2014/08/18 21:32:57
Not as written. But I can see why this is confusin
|
| + bool tile_missing_outside_activation_rect = true; |
| + bool had_incomplete_tile = true; |
| + bool had_incomplete_tile_outside_activation_rect = false; |
|
hush (inactive)
2014/08/18 20:48:16
above 2 lines means there are incomplete tiles ins
boliu
2014/08/18 21:32:57
Done. Good catch.
|
| + bool is_animating = false; |
| + root->AddChild(MissingTextureAnimatingLayer::Create( |
| + host_impl_->active_tree(), |
| + 4, |
| + tile_missing, |
| + tile_missing_outside_activation_rect, |
| + had_incomplete_tile, |
| + had_incomplete_tile_outside_activation_rect, |
| + is_animating, |
| + host_impl_->resource_provider())); |
| LayerTreeHostImpl::FrameData frame; |
| EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| @@ -2020,15 +2113,19 @@ TEST_F(LayerTreeHostImplTest, |
| DidDrawCheckLayer* root = |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| bool tile_missing = true; |
| + bool tile_missing_outside_activation_rect = false; |
| bool had_incomplete_tile = false; |
| + bool had_incomplete_tile_outside_activation_rect = false; |
| bool is_animating = true; |
| - root->AddChild( |
| - MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
| - 6, |
| - tile_missing, |
| - had_incomplete_tile, |
| - is_animating, |
| - host_impl_->resource_provider())); |
| + root->AddChild(MissingTextureAnimatingLayer::Create( |
| + host_impl_->active_tree(), |
| + 6, |
| + tile_missing, |
| + tile_missing_outside_activation_rect, |
| + had_incomplete_tile, |
| + had_incomplete_tile_outside_activation_rect, |
| + is_animating, |
| + host_impl_->resource_provider())); |
| LayerTreeHostImpl::FrameData frame; |
| EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS, |
| host_impl_->PrepareToDraw(&frame)); |
| @@ -2043,15 +2140,19 @@ TEST_F(LayerTreeHostImplTest, |
| DidDrawCheckLayer* root = |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| bool tile_missing = false; |
| + bool tile_missing_outside_activation_rect = false; |
| bool had_incomplete_tile = true; |
| + bool had_incomplete_tile_outside_activation_rect = false; |
| bool is_animating = true; |
| - root->AddChild( |
| - MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
| - 6, |
| - tile_missing, |
| - had_incomplete_tile, |
| - is_animating, |
| - host_impl_->resource_provider())); |
| + root->AddChild(MissingTextureAnimatingLayer::Create( |
| + host_impl_->active_tree(), |
| + 6, |
| + tile_missing, |
| + tile_missing_outside_activation_rect, |
| + had_incomplete_tile, |
| + had_incomplete_tile_outside_activation_rect, |
| + is_animating, |
| + host_impl_->resource_provider())); |
| LayerTreeHostImpl::FrameData frame; |
| EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| @@ -2064,15 +2165,19 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) { |
| DidDrawCheckLayer* root = |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| bool tile_missing = false; |
| + bool tile_missing_outside_activation_rect = false; |
| bool had_incomplete_tile = false; |
| + bool had_incomplete_tile_outside_activation_rect = false; |
| bool is_animating = false; |
| - root->AddChild( |
| - MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
| - 8, |
| - tile_missing, |
| - had_incomplete_tile, |
| - is_animating, |
| - host_impl_->resource_provider())); |
| + root->AddChild(MissingTextureAnimatingLayer::Create( |
| + host_impl_->active_tree(), |
| + 8, |
| + tile_missing, |
| + tile_missing_outside_activation_rect, |
| + had_incomplete_tile, |
| + had_incomplete_tile_outside_activation_rect, |
| + is_animating, |
| + host_impl_->resource_provider())); |
| host_impl_->active_tree()->SetRequiresHighResToDraw(); |
| LayerTreeHostImpl::FrameData frame; |
| EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| @@ -2087,15 +2192,19 @@ TEST_F(LayerTreeHostImplTest, |
| DidDrawCheckLayer* root = |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| bool tile_missing = false; |
| + bool tile_missing_outside_activation_rect = false; |
| bool had_incomplete_tile = true; |
| + bool had_incomplete_tile_outside_activation_rect = false; |
| bool is_animating = false; |
| - root->AddChild( |
| - MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
| - 8, |
| - tile_missing, |
| - had_incomplete_tile, |
| - is_animating, |
| - host_impl_->resource_provider())); |
| + root->AddChild(MissingTextureAnimatingLayer::Create( |
| + host_impl_->active_tree(), |
| + 8, |
| + tile_missing, |
| + tile_missing_outside_activation_rect, |
| + had_incomplete_tile, |
| + had_incomplete_tile_outside_activation_rect, |
| + is_animating, |
| + host_impl_->resource_provider())); |
| host_impl_->active_tree()->SetRequiresHighResToDraw(); |
| LayerTreeHostImpl::FrameData frame; |
| EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, |
| @@ -2111,15 +2220,19 @@ TEST_F(LayerTreeHostImplTest, |
| DidDrawCheckLayer* root = |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| bool tile_missing = true; |
| + bool tile_missing_outside_activation_rect = false; |
| bool had_incomplete_tile = false; |
| + bool had_incomplete_tile_outside_activation_rect = false; |
| bool is_animating = false; |
| - root->AddChild( |
| - MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
| - 8, |
| - tile_missing, |
| - had_incomplete_tile, |
| - is_animating, |
| - host_impl_->resource_provider())); |
| + root->AddChild(MissingTextureAnimatingLayer::Create( |
| + host_impl_->active_tree(), |
| + 8, |
| + tile_missing, |
| + tile_missing_outside_activation_rect, |
| + had_incomplete_tile, |
| + had_incomplete_tile_outside_activation_rect, |
| + is_animating, |
| + host_impl_->resource_provider())); |
| host_impl_->active_tree()->SetRequiresHighResToDraw(); |
| LayerTreeHostImpl::FrameData frame; |
| EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, |