diff options
Diffstat (limited to 'chromium/cc/layers/nine_patch_layer_impl_unittest.cc')
-rw-r--r-- | chromium/cc/layers/nine_patch_layer_impl_unittest.cc | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/chromium/cc/layers/nine_patch_layer_impl_unittest.cc b/chromium/cc/layers/nine_patch_layer_impl_unittest.cc index bd853412370..7b22ec44742 100644 --- a/chromium/cc/layers/nine_patch_layer_impl_unittest.cc +++ b/chromium/cc/layers/nine_patch_layer_impl_unittest.cc @@ -12,7 +12,7 @@ #include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_ui_resource_layer_tree_host_impl.h" #include "cc/test/geometry_test_utils.h" -#include "cc/test/layer_test_common.h" +#include "cc/test/layer_tree_impl_test_base.h" #include "cc/trees/single_thread_proxy.h" #include "components/viz/common/quads/texture_draw_quad.h" #include "testing/gmock/include/gmock/gmock.h" @@ -56,7 +56,7 @@ void NinePatchLayerLayoutTest(const gfx::Size& bitmap_size, NinePatchLayerImpl::Create(host_impl.active_tree(), 1); layer->draw_properties().visible_layer_rect = visible_layer_rect; layer->SetBounds(layer_size); - layer->test_properties()->force_render_surface = true; + SetupRootProperties(layer.get()); UIResourceId uid = 1; bool is_opaque = false; @@ -67,11 +67,10 @@ void NinePatchLayerLayoutTest(const gfx::Size& bitmap_size, layer->SetImageBounds(bitmap_size); layer->SetLayout(aperture_rect, border, gfx::Rect(), fill_center, false); host_impl.active_tree()->SetRootLayerForTesting(std::move(layer)); - host_impl.active_tree()->BuildPropertyTreesForTesting(); + UpdateDrawProperties(host_impl.active_tree()); AppendQuadsData data; - host_impl.active_tree()->root_layer_for_testing()->AppendQuads( - render_pass.get(), &data); + host_impl.active_tree()->root_layer()->AppendQuads(render_pass.get(), &data); // Verify quad rects const auto& quads = render_pass->quad_list; @@ -169,7 +168,7 @@ void NinePatchLayerLayoutTestWithOcclusion(const gfx::Size& bitmap_size, NinePatchLayerImpl::Create(host_impl.active_tree(), 1); layer->draw_properties().visible_layer_rect = visible_layer_rect; layer->SetBounds(layer_size); - layer->test_properties()->force_render_surface = true; + SetupRootProperties(layer.get()); UIResourceId uid = 1; bool is_opaque = false; @@ -180,11 +179,10 @@ void NinePatchLayerLayoutTestWithOcclusion(const gfx::Size& bitmap_size, layer->SetImageBounds(bitmap_size); layer->SetLayout(aperture_rect, border, occlusion, false, false); host_impl.active_tree()->SetRootLayerForTesting(std::move(layer)); - host_impl.active_tree()->BuildPropertyTreesForTesting(); + UpdateDrawProperties(host_impl.active_tree()); AppendQuadsData data; - host_impl.active_tree()->root_layer_for_testing()->AppendQuads( - render_pass.get(), &data); + host_impl.active_tree()->root_layer()->AppendQuads(render_pass.get(), &data); // Verify quad rects const auto& quads = render_pass->quad_list; @@ -350,7 +348,7 @@ TEST(NinePatchLayerImplTest, Occlusion) { gfx::Size layer_size(1000, 1000); gfx::Size viewport_size(1000, 1000); - LayerTestCommon::LayerImplTest impl; + LayerTreeImplTestBase impl; SkBitmap sk_bitmap; sk_bitmap.allocN32Pixels(10, 10); @@ -360,11 +358,12 @@ TEST(NinePatchLayerImplTest, Occlusion) { impl.host_impl()->CreateUIResource(uid, bitmap); NinePatchLayerImpl* nine_patch_layer_impl = - impl.AddChildToRoot<NinePatchLayerImpl>(); + impl.AddLayer<NinePatchLayerImpl>(); nine_patch_layer_impl->SetBounds(layer_size); nine_patch_layer_impl->SetDrawsContent(true); nine_patch_layer_impl->SetUIResourceId(uid); nine_patch_layer_impl->SetImageBounds(gfx::Size(10, 10)); + CopyProperties(impl.root_layer(), nine_patch_layer_impl); gfx::Rect aperture = gfx::Rect(3, 3, 4, 4); gfx::Rect border = gfx::Rect(300, 300, 400, 400); @@ -377,8 +376,7 @@ TEST(NinePatchLayerImplTest, Occlusion) { gfx::Rect occluded; impl.AppendQuadsWithOcclusion(nine_patch_layer_impl, occluded); - LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), - gfx::Rect(layer_size)); + VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect(layer_size)); EXPECT_EQ(9u, impl.quad_list().size()); } @@ -387,7 +385,7 @@ TEST(NinePatchLayerImplTest, Occlusion) { gfx::Rect occluded(nine_patch_layer_impl->visible_layer_rect()); impl.AppendQuadsWithOcclusion(nine_patch_layer_impl, occluded); - LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); + VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); EXPECT_EQ(impl.quad_list().size(), 0u); } @@ -397,8 +395,8 @@ TEST(NinePatchLayerImplTest, Occlusion) { impl.AppendQuadsWithOcclusion(nine_patch_layer_impl, occluded); size_t partially_occluded_count = 0; - LayerTestCommon::VerifyQuadsAreOccluded( - impl.quad_list(), occluded, &partially_occluded_count); + VerifyQuadsAreOccluded(impl.quad_list(), occluded, + &partially_occluded_count); // The layer outputs nine quads, three of which are partially occluded, and // three fully occluded. EXPECT_EQ(6u, impl.quad_list().size()); @@ -410,7 +408,7 @@ TEST(NinePatchLayerImplTest, OpaqueRect) { gfx::Size layer_size(1000, 1000); gfx::Size viewport_size(1000, 1000); - LayerTestCommon::LayerImplTest impl; + LayerTreeImplTestBase impl; SkBitmap sk_bitmap_opaque; sk_bitmap_opaque.allocN32Pixels(10, 10); @@ -431,10 +429,11 @@ TEST(NinePatchLayerImplTest, OpaqueRect) { impl.host_impl()->CreateUIResource(uid_alpha, bitmap_alpha); - NinePatchLayerImpl *nine_patch_layer_impl = - impl.AddChildToRoot<NinePatchLayerImpl>(); + NinePatchLayerImpl* nine_patch_layer_impl = + impl.AddLayer<NinePatchLayerImpl>(); nine_patch_layer_impl->SetBounds(layer_size); nine_patch_layer_impl->SetDrawsContent(true); + CopyProperties(impl.root_layer(), nine_patch_layer_impl); impl.CalcDrawProps(viewport_size); |