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 df15258ba1241fc6732fe0975617605dbd67b58c..61f31408c834afa24e19c8c6e1e8a8a767ddbd59 100644 |
| --- a/cc/trees/layer_tree_host_impl_unittest.cc |
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc |
| @@ -1921,6 +1921,11 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) { |
| DidDrawCheckLayer* root = |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| + LayerTreeHostImpl::FrameData frame; |
| + EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| + host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| + host_impl_->DidDrawAllLayers(frame); |
| + |
| bool tile_missing = true; |
| bool had_incomplete_tile = false; |
| bool is_animating = false; |
| @@ -1931,10 +1936,10 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) { |
| had_incomplete_tile, |
| 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); |
| + LayerTreeHostImpl::FrameData frame2; |
| + EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2)); |
| + host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); |
| + host_impl_->DidDrawAllLayers(frame2); |
| } |
| TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) { |
| @@ -1943,6 +1948,11 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) { |
| DidDrawCheckLayer* root = |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| + LayerTreeHostImpl::FrameData frame; |
| + EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| + host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| + host_impl_->DidDrawAllLayers(frame); |
| + |
| bool tile_missing = false; |
| bool had_incomplete_tile = true; |
| bool is_animating = false; |
| @@ -1953,10 +1963,10 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) { |
| had_incomplete_tile, |
| 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); |
| + LayerTreeHostImpl::FrameData frame2; |
| + EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2)); |
| + host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); |
| + host_impl_->DidDrawAllLayers(frame2); |
| } |
| TEST_F(LayerTreeHostImplTest, |
| @@ -1965,6 +1975,12 @@ TEST_F(LayerTreeHostImplTest, |
| DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); |
| DidDrawCheckLayer* root = |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| + |
| + LayerTreeHostImpl::FrameData frame; |
| + EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| + host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| + host_impl_->DidDrawAllLayers(frame); |
| + |
| bool tile_missing = true; |
| bool had_incomplete_tile = false; |
| bool is_animating = true; |
| @@ -1975,11 +1991,11 @@ TEST_F(LayerTreeHostImplTest, |
| had_incomplete_tile, |
| is_animating, |
| host_impl_->resource_provider())); |
| - LayerTreeHostImpl::FrameData frame; |
| + LayerTreeHostImpl::FrameData frame2; |
| EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS, |
| - host_impl_->PrepareToDraw(&frame)); |
| - host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| - host_impl_->DidDrawAllLayers(frame); |
| + host_impl_->PrepareToDraw(&frame2)); |
| + host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); |
| + host_impl_->DidDrawAllLayers(frame2); |
| } |
| TEST_F(LayerTreeHostImplTest, |
| @@ -1988,6 +2004,12 @@ TEST_F(LayerTreeHostImplTest, |
| DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); |
| DidDrawCheckLayer* root = |
| static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| + |
| + LayerTreeHostImpl::FrameData frame; |
| + EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| + host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| + host_impl_->DidDrawAllLayers(frame); |
| + |
| bool tile_missing = false; |
| bool had_incomplete_tile = true; |
| bool is_animating = true; |
| @@ -1998,10 +2020,10 @@ TEST_F(LayerTreeHostImplTest, |
| had_incomplete_tile, |
| 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); |
| + LayerTreeHostImpl::FrameData frame2; |
| + EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2)); |
| + host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); |
| + host_impl_->DidDrawAllLayers(frame2); |
| } |
| TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) { |
| @@ -5884,7 +5906,11 @@ TEST_F(LayerTreeHostImplTest, MemoryPolicy) { |
| TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { |
| ASSERT_TRUE(host_impl_->active_tree()); |
| - EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); |
| + // RequiresHighResToDraw is set when new output surface is used. |
| + EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); |
| + |
| + host_impl_->ActivateSyncTree(); |
|
danakj
2014/09/10 16:03:32
can you change this to just host_impl_->active_tre
sohanjg
2014/09/11 06:07:57
Done.
|
| + |
| host_impl_->SetVisible(false); |
| EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); |
| host_impl_->SetVisible(true); |
| @@ -5904,7 +5930,11 @@ TEST_F(LayerTreeHostImplTest, RequireHighResAfterGpuRasterizationToggles) { |
| ASSERT_TRUE(host_impl_->active_tree()); |
| EXPECT_FALSE(host_impl_->use_gpu_rasterization()); |
| - EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); |
| + // RequiresHighResToDraw is set when new output surface is used. |
| + EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); |
| + |
| + host_impl_->ActivateSyncTree(); |
|
danakj
2014/09/10 16:03:32
can you change this to just host_impl_->active_tre
sohanjg
2014/09/11 06:07:57
Done.
|
| + |
| host_impl_->SetUseGpuRasterization(false); |
| EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); |
| host_impl_->SetUseGpuRasterization(true); |