Chromium Code Reviews| Index: cc/layers/solid_color_layer_impl_unittest.cc |
| diff --git a/cc/layers/solid_color_layer_impl_unittest.cc b/cc/layers/solid_color_layer_impl_unittest.cc |
| index d2e2bb86dac9c30a47fa5bccd4fec018da37f473..b5c8dd14d390c5ab280a450a0e1f3c4fe356270c 100644 |
| --- a/cc/layers/solid_color_layer_impl_unittest.cc |
| +++ b/cc/layers/solid_color_layer_impl_unittest.cc |
| @@ -38,9 +38,11 @@ TEST(SolidColorLayerImplTest, VerifyTilingCompleteAndNoOverlap) { |
| layer->draw_properties().visible_layer_rect = visible_layer_rect; |
| layer->SetBounds(layer_size); |
| layer->test_properties()->force_render_surface = true; |
| - |
| + host_impl.active_tree()->SetRootLayerForTesting(std::move(layer)); |
| + host_impl.active_tree()->BuildPropertyTreesForTesting(); |
| AppendQuadsData data; |
| - layer->AppendQuads(render_pass.get(), &data); |
| + host_impl.active_tree()->root_layer_for_testing()->AppendQuads( |
| + render_pass.get(), &data); |
| LayerTestCommon::VerifyQuadsExactlyCoverRect(render_pass->quad_list, |
| visible_layer_rect); |
| @@ -63,9 +65,11 @@ TEST(SolidColorLayerImplTest, VerifyCorrectBackgroundColorInQuad) { |
| layer->SetBounds(layer_size); |
| layer->SetBackgroundColor(test_color); |
| layer->test_properties()->force_render_surface = true; |
| - |
| + host_impl.active_tree()->SetRootLayerForTesting(std::move(layer)); |
| + host_impl.active_tree()->BuildPropertyTreesForTesting(); |
| AppendQuadsData data; |
| - layer->AppendQuads(render_pass.get(), &data); |
| + host_impl.active_tree()->root_layer_for_testing()->AppendQuads( |
| + render_pass.get(), &data); |
| ASSERT_EQ(render_pass->quad_list.size(), 1U); |
| EXPECT_EQ( |
| @@ -90,9 +94,11 @@ TEST(SolidColorLayerImplTest, VerifyCorrectOpacityInQuad) { |
| layer->SetBounds(layer_size); |
| layer->draw_properties().opacity = opacity; |
| layer->test_properties()->force_render_surface = true; |
| - |
| + host_impl.active_tree()->SetRootLayerForTesting(std::move(layer)); |
| + host_impl.active_tree()->BuildPropertyTreesForTesting(); |
| AppendQuadsData data; |
| - layer->AppendQuads(render_pass.get(), &data); |
| + host_impl.active_tree()->root_layer_for_testing()->AppendQuads( |
| + render_pass.get(), &data); |
| ASSERT_EQ(render_pass->quad_list.size(), 1U); |
| EXPECT_EQ(opacity, |
| @@ -100,29 +106,6 @@ TEST(SolidColorLayerImplTest, VerifyCorrectOpacityInQuad) { |
| ->shared_quad_state->opacity); |
| } |
| -TEST(SolidColorLayerImplTest, VerifyCorrectBlendModeInQuad) { |
|
wkorman
2017/01/06 22:50:02
I spent a bunch of time looking at this test and r
ajuma
2017/01/06 23:47:08
Makes sense. See also https://cs.chromium.org/chro
|
| - const SkBlendMode blend_mode = SkBlendMode::kMultiply; |
| - |
| - std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); |
| - |
| - gfx::Size layer_size = gfx::Size(100, 100); |
| - |
| - FakeImplTaskRunnerProvider task_runner_provider; |
| - TestTaskGraphRunner task_graph_runner; |
| - FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| - std::unique_ptr<SolidColorLayerImpl> layer = |
| - SolidColorLayerImpl::Create(host_impl.active_tree(), 1); |
| - layer->SetBounds(layer_size); |
| - layer->set_draw_blend_mode(blend_mode); |
| - |
| - AppendQuadsData data; |
| - layer->AppendQuads(render_pass.get(), &data); |
| - |
| - ASSERT_EQ(render_pass->quad_list.size(), 1U); |
| - EXPECT_EQ(blend_mode, |
| - render_pass->quad_list.front()->shared_quad_state->blend_mode); |
| -} |
| - |
| TEST(SolidColorLayerImplTest, VerifyOpaqueRect) { |
| gfx::Size layer_size = gfx::Size(100, 100); |
| gfx::Rect visible_layer_rect = gfx::Rect(layer_size); |
| @@ -149,10 +132,10 @@ TEST(SolidColorLayerImplTest, VerifyOpaqueRect) { |
| layer->SetBackgroundColor(SkColorSetARGBInline(255, 10, 20, 30)); |
| EXPECT_TRUE(layer->contents_opaque()); |
| { |
| - std::unique_ptr<SolidColorLayerImpl> layer_impl = |
| - SolidColorLayerImpl::Create(host->host_impl()->active_tree(), |
| - layer->id()); |
| - layer->PushPropertiesTo(layer_impl.get()); |
| + DebugScopedSetImplThread scoped_impl_thread(host->GetTaskRunnerProvider()); |
| + host->FinishCommitOnImplThread(host->host_impl()); |
| + LayerImpl* layer_impl = |
| + host->host_impl()->active_tree()->LayerById(layer->id()); |
| // The impl layer should call itself opaque as well. |
| EXPECT_TRUE(layer_impl->contents_opaque()); |
| @@ -175,12 +158,12 @@ TEST(SolidColorLayerImplTest, VerifyOpaqueRect) { |
| layer->SetBackgroundColor(SkColorSetARGBInline(254, 10, 20, 30)); |
| EXPECT_FALSE(layer->contents_opaque()); |
| { |
| - std::unique_ptr<SolidColorLayerImpl> layer_impl = |
| - SolidColorLayerImpl::Create(host->host_impl()->active_tree(), |
| - layer->id()); |
| - layer->PushPropertiesTo(layer_impl.get()); |
| + DebugScopedSetImplThread scoped_impl_thread(host->GetTaskRunnerProvider()); |
| + host->FinishCommitOnImplThread(host->host_impl()); |
| + LayerImpl* layer_impl = |
| + host->host_impl()->active_tree()->LayerById(layer->id()); |
| - // The impl layer should callnot itself opaque anymore. |
| + // The impl layer should not call itself opaque anymore. |
| EXPECT_FALSE(layer_impl->contents_opaque()); |
| // Impl layer has 1 opacity, but the color is not opaque, so the opaque_rect |