| 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 62edc57131fcc636ec672d77b191cd74fc166954..e2675b28df3680d2fe3921421007aae7ab137c67 100644
|
| --- a/cc/layers/picture_layer_impl_unittest.cc
|
| +++ b/cc/layers/picture_layer_impl_unittest.cc
|
| @@ -15,9 +15,11 @@
|
| #include "cc/test/fake_picture_layer_impl.h"
|
| #include "cc/test/fake_picture_pile_impl.h"
|
| #include "cc/test/geometry_test_utils.h"
|
| +#include "cc/test/hybrid_gpu_rasterization_settings.h"
|
| #include "cc/test/impl_side_painting_settings.h"
|
| #include "cc/test/mock_quad_culler.h"
|
| #include "cc/test/test_web_graphics_context_3d.h"
|
| +#include "cc/test/universal_gpu_rasterization_settings.h"
|
| #include "cc/trees/layer_tree_impl.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "ui/gfx/rect_conversions.h"
|
| @@ -1416,28 +1418,20 @@ TEST_F(PictureLayerImplTest, SyncTilingAfterReleaseResource) {
|
| EXPECT_TRUE(active_layer_->tilings()->TilingAtScale(tile_scale));
|
| }
|
|
|
| -TEST_F(PictureLayerImplTest, TilingGpuRasterization) {
|
| +TEST_F(PictureLayerImplTest, TilingWithoutGpuRasterization) {
|
| gfx::Size default_tile_size(host_impl_.settings().default_tile_size);
|
| gfx::Size layer_bounds(default_tile_size.width() * 4,
|
| default_tile_size.height() * 4);
|
| float result_scale_x, result_scale_y;
|
| gfx::Size result_bounds;
|
|
|
| - // Layers without GPU rasterization (default).
|
| SetupDefaultTrees(layer_bounds);
|
| + EXPECT_FALSE(pending_layer_->ShouldUseGpuRasterization());
|
| EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
|
| pending_layer_->CalculateContentsScale(
|
| 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds);
|
| // Should have a low-res and a high-res tiling.
|
| ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
|
| -
|
| - // Tell the layer to use GPU rasterization.
|
| - pending_layer_->SetShouldUseGpuRasterization(true);
|
| - EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
|
| - pending_layer_->CalculateContentsScale(
|
| - 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds);
|
| - // Should only have the high-res tiling.
|
| - ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, NoTilingIfDoesNotDrawContent) {
|
| @@ -1556,5 +1550,68 @@ TEST_F(DeferredInitPictureLayerImplTest,
|
| host_impl_.active_tree()->UpdateDrawProperties();
|
| }
|
|
|
| +class HybridGpuRasterizationPictureLayerImplTest : public PictureLayerImplTest {
|
| + public:
|
| + HybridGpuRasterizationPictureLayerImplTest()
|
| + : PictureLayerImplTest(HybridGpuRasterizationSettings()) {}
|
| +};
|
| +
|
| +TEST_F(HybridGpuRasterizationPictureLayerImplTest, Tiling) {
|
| + gfx::Size default_tile_size(host_impl_.settings().default_tile_size);
|
| + gfx::Size layer_bounds(default_tile_size.width() * 4,
|
| + default_tile_size.height() * 4);
|
| + float result_scale_x, result_scale_y;
|
| + gfx::Size result_bounds;
|
| +
|
| + SetupDefaultTrees(layer_bounds);
|
| + EXPECT_FALSE(pending_layer_->ShouldUseGpuRasterization());
|
| + EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
|
| + pending_layer_->CalculateContentsScale(
|
| + 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds);
|
| + // Should have a low-res and a high-res tiling.
|
| + ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
|
| +
|
| + pending_layer_->SetHasGpuRasterizationHint(true);
|
| + EXPECT_TRUE(pending_layer_->ShouldUseGpuRasterization());
|
| + EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
|
| + pending_layer_->CalculateContentsScale(
|
| + 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds);
|
| + // Should only have the high-res tiling.
|
| + ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
|
| +}
|
| +
|
| +class UniversalGpuRasterizationPictureLayerImplTest
|
| + : public PictureLayerImplTest {
|
| + public:
|
| + UniversalGpuRasterizationPictureLayerImplTest()
|
| + : PictureLayerImplTest(UniversalGpuRasterizationSettings()) {}
|
| +};
|
| +
|
| +TEST_F(UniversalGpuRasterizationPictureLayerImplTest, Tiling) {
|
| + gfx::Size default_tile_size(host_impl_.settings().default_tile_size);
|
| + gfx::Size layer_bounds(default_tile_size.width() * 4,
|
| + default_tile_size.height() * 4);
|
| + float result_scale_x, result_scale_y;
|
| + gfx::Size result_bounds;
|
| +
|
| + SetupDefaultTrees(layer_bounds);
|
| + pending_layer_->SetHasGpuRasterizationHint(true);
|
| + EXPECT_TRUE(pending_layer_->ShouldUseGpuRasterization());
|
| + EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
|
| + pending_layer_->CalculateContentsScale(
|
| + 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds);
|
| + // Should only have the high-res tiling.
|
| + ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
|
| +
|
| + pending_layer_->SetHasGpuRasterizationHint(false);
|
| + EXPECT_TRUE(pending_layer_->ShouldUseGpuRasterization());
|
| + // Should still have the high-res tiling.
|
| + EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
|
| + pending_layer_->CalculateContentsScale(
|
| + 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds);
|
| + // Should still only have the high-res tiling.
|
| + ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
|
| +}
|
| +
|
| } // namespace
|
| } // namespace cc
|
|
|