summaryrefslogtreecommitdiffstats
path: root/cc/layers/picture_layer_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc/layers/picture_layer_unittest.cc')
-rw-r--r--cc/layers/picture_layer_unittest.cc81
1 files changed, 6 insertions, 75 deletions
diff --git a/cc/layers/picture_layer_unittest.cc b/cc/layers/picture_layer_unittest.cc
index dfc24a0..3edb9c8 100644
--- a/cc/layers/picture_layer_unittest.cc
+++ b/cc/layers/picture_layer_unittest.cc
@@ -69,88 +69,19 @@ TEST(PictureLayerTest, NoTilesIfEmptyBounds) {
}
}
-TEST(PictureLayerTest, ForcedCpuRaster) {
+TEST(PictureLayerTest, SuitableForGpuRasterization) {
MockContentLayerClient client;
scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client);
-
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
- host->SetRootLayer(layer);
-
- // The default value is false.
- EXPECT_FALSE(layer->ShouldUseGpuRasterization());
-
- // Gpu rasterization cannot be enabled even with raster hint.
- host->set_has_gpu_rasterization_trigger(true);
- EXPECT_FALSE(layer->ShouldUseGpuRasterization());
-}
-
-TEST(PictureLayerTest, ForceGpuRaster) {
- MockContentLayerClient client;
- scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client);
-
- LayerTreeSettings settings;
- settings.gpu_rasterization_forced = true;
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(settings);
- host->SetRootLayer(layer);
-
- // The default value is true.
- EXPECT_TRUE(layer->ShouldUseGpuRasterization());
-
- // Gpu rasterization cannot be disabled even with raster hint.
- host->set_has_gpu_rasterization_trigger(false);
- EXPECT_TRUE(layer->ShouldUseGpuRasterization());
-
- // Gpu rasterization cannot be disabled even with skia veto.
PicturePile* pile = layer->GetPicturePileForTesting();
- EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization());
- pile->SetUnsuitableForGpuRasterizationForTesting();
- EXPECT_TRUE(layer->ShouldUseGpuRasterization());
-}
-
-TEST(PictureLayerTest, EnableGpuRaster) {
- MockContentLayerClient client;
- scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client);
-
- LayerTreeSettings settings;
- settings.gpu_rasterization_enabled = true;
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(settings);
- host->SetRootLayer(layer);
-
- // The default value is false.
- EXPECT_FALSE(layer->ShouldUseGpuRasterization());
-
- // Gpu rasterization can be enabled.
- host->set_has_gpu_rasterization_trigger(true);
- EXPECT_TRUE(layer->ShouldUseGpuRasterization());
-
- // Gpu rasterization can be disabled.
- host->set_has_gpu_rasterization_trigger(false);
- EXPECT_FALSE(layer->ShouldUseGpuRasterization());
-
- // Gpu rasterization can be enabled again.
- host->set_has_gpu_rasterization_trigger(true);
- EXPECT_TRUE(layer->ShouldUseGpuRasterization());
-}
-TEST(PictureLayerTest, VetoGpuRaster) {
- MockContentLayerClient client;
- scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client);
-
- LayerTreeSettings settings;
- settings.gpu_rasterization_enabled = true;
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(settings);
- host->SetRootLayer(layer);
-
- EXPECT_FALSE(layer->ShouldUseGpuRasterization());
-
- host->set_has_gpu_rasterization_trigger(true);
- EXPECT_TRUE(layer->ShouldUseGpuRasterization());
+ // Layer is suitable for gpu rasterization by default.
+ EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization());
+ EXPECT_TRUE(layer->IsSuitableForGpuRasterization());
// Veto gpu rasterization.
- PicturePile* pile = layer->GetPicturePileForTesting();
- EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization());
pile->SetUnsuitableForGpuRasterizationForTesting();
- EXPECT_FALSE(layer->ShouldUseGpuRasterization());
+ EXPECT_FALSE(pile->is_suitable_for_gpu_rasterization());
+ EXPECT_FALSE(layer->IsSuitableForGpuRasterization());
}
} // namespace