Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1759)

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 290573007: cc: Move gpu rasterization flag from tree-impl to tree-host-impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9085a71a1e42c9e2febe59149a7b51553973da73..3fc94b17ace072ac26148d9a45b77d85c2f94815 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -1727,6 +1727,34 @@ TEST_F(PictureLayerImplTest, SyncTilingAfterReleaseResource) {
EXPECT_EQ(HIGH_RESOLUTION, high_res->resolution());
}
+TEST_F(PictureLayerImplTest, SyncTilingAfterGpuRasterizationToggles) {
+ SetupDefaultTrees(gfx::Size(10, 10));
+
+ const float kScale = 1.f;
+ pending_layer_->AddTiling(kScale);
+ EXPECT_TRUE(pending_layer_->tilings()->TilingAtScale(kScale));
+ EXPECT_TRUE(active_layer_->tilings()->TilingAtScale(kScale));
+
+ // Gpu rasterization is disabled by default.
+ EXPECT_FALSE(host_impl_.use_gpu_rasterization());
+ // Toggling the gpu rasterization clears all tilings on both trees.
+ host_impl_.SetUseGpuRasterization(true);
+ EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
+ EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
+
+ // Make sure that we can still add tiling to the pending layer,
+ // that gets synced to the active layer.
+ pending_layer_->AddTiling(kScale);
+ EXPECT_TRUE(pending_layer_->tilings()->TilingAtScale(kScale));
+ EXPECT_TRUE(active_layer_->tilings()->TilingAtScale(kScale));
+
+ // Toggling the gpu rasterization clears all tilings on both trees.
+ EXPECT_TRUE(host_impl_.use_gpu_rasterization());
+ host_impl_.SetUseGpuRasterization(false);
+ EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
+ EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
+}
+
TEST_F(PictureLayerImplTest, HighResCreatedWhenBoundsShrink) {
SetupDefaultTrees(gfx::Size(10, 10));
host_impl_.active_tree()->UpdateDrawProperties();
@@ -1789,7 +1817,7 @@ TEST_F(PictureLayerImplTest, NoLowResTilingWithGpuRasterization) {
gfx::Size result_bounds;
SetupDefaultTrees(layer_bounds);
- EXPECT_FALSE(pending_layer_->use_gpu_rasterization());
+ EXPECT_FALSE(host_impl_.use_gpu_rasterization());
EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
pending_layer_->CalculateContentsScale(1.f,
1.f,
@@ -1804,8 +1832,8 @@ TEST_F(PictureLayerImplTest, NoLowResTilingWithGpuRasterization) {
ResetTilingsAndRasterScales();
- host_impl_.pending_tree()->SetUseGpuRasterization(true);
- EXPECT_TRUE(pending_layer_->use_gpu_rasterization());
+ host_impl_.SetUseGpuRasterization(true);
+ EXPECT_TRUE(host_impl_.use_gpu_rasterization());
pending_layer_->CalculateContentsScale(1.f,
1.f,
1.f,
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698