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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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/layers/tiled_layer_impl_unittest.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 06f75f0606ffebc7ff72b2daa1334eb6d68aad05..6b2d4c9c6c3438c2c7684675b624903d4b4ed48f 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -1467,15 +1467,47 @@ TEST_F(PictureLayerImplTest, SolidColorLayerHasVisibleFullCoverage) {
active_layer_->DidDraw(nullptr);
Region remaining = visible_rect;
- for (auto& quad : render_pass->quad_list) {
- EXPECT_TRUE(visible_rect.Contains(quad.rect));
- EXPECT_TRUE(remaining.Contains(quad.rect));
- remaining.Subtract(quad.rect);
+ for (const auto& quad : render_pass->quad_list) {
+ EXPECT_TRUE(visible_rect.Contains(quad->rect));
+ EXPECT_TRUE(remaining.Contains(quad->rect));
+ remaining.Subtract(quad->rect);
}
EXPECT_TRUE(remaining.IsEmpty());
}
+TEST_F(PictureLayerImplTest, TileScalesWithSolidColorPile) {
+ gfx::Size layer_bounds(200, 200);
+ gfx::Size tile_size(host_impl_.settings().default_tile_size);
+ scoped_refptr<FakePicturePileImpl> pending_pile =
+ FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
+ tile_size, layer_bounds);
+ scoped_refptr<FakePicturePileImpl> active_pile =
+ FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
+ tile_size, layer_bounds);
+
+ pending_pile->set_is_solid_color(false);
+ active_pile->set_is_solid_color(true);
+ SetupTrees(pending_pile, active_pile);
+ // Solid color layer should not have tilings.
+ ASSERT_FALSE(active_layer_->CanHaveTilings());
+
+ // Update properties with solid color pile should not allow tilings at any
+ // scale.
+ host_impl_.active_tree()->UpdateDrawProperties();
+ EXPECT_FALSE(active_layer_->CanHaveTilings());
+ EXPECT_EQ(0.f, active_layer_->ideal_contents_scale());
+
+ // Push non-solid-color pending pile makes active layer can have tilings.
+ active_layer_->UpdatePile(pending_pile);
+ ASSERT_TRUE(active_layer_->CanHaveTilings());
+
+ // Update properties with non-solid color pile should allow tilings.
+ host_impl_.active_tree()->UpdateDrawProperties();
+ EXPECT_TRUE(active_layer_->CanHaveTilings());
+ EXPECT_GT(active_layer_->ideal_contents_scale(), 0.f);
+}
+
TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) {
gfx::Size tile_size(100, 100);
gfx::Size layer_bounds(200, 200);
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/layers/tiled_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698