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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 540663002: cc: Don't require low res to activate for shared ready-to-draw tiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/test/fake_picture_layer_impl.h » ('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 249dcf02f14fa61f4267325475bf4f9f76b41554..ba6c6bbbe2f618ff952b3993f1da87c74ffbf77c 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -2822,7 +2822,7 @@ TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) {
EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
}
-TEST_F(PictureLayerImplTest, HighResReadyToDrawNotEnoughToActivate) {
+TEST_F(PictureLayerImplTest, HighResReadyToDrawEnoughToActivate) {
gfx::Size tile_size(100, 100);
gfx::Size layer_bounds(1000, 1000);
@@ -2841,12 +2841,58 @@ TEST_F(PictureLayerImplTest, HighResReadyToDrawNotEnoughToActivate) {
// Initialize all high-res tiles.
pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
- // High-res tiles should not be enough.
+ // High-res tiles should be enough, since they cover everything visible.
+ EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+}
+
+TEST_F(PictureLayerImplTest,
+ SharedActiveHighResReadyAndPendingLowResReadyNotEnoughToActivate) {
+ gfx::Size tile_size(100, 100);
+ gfx::Size layer_bounds(1000, 1000);
+
+ SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
+
+ // Make sure some tiles are not shared.
+ pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size));
+
+ CreateHighLowResAndSetAllTilesVisible();
+
+ // Initialize all high-res tiles in the active layer.
+ active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling());
+ // And all the low-res tiles in the pending layer.
+ pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling());
+
+ pending_layer_->MarkVisibleResourcesAsRequired();
+
+ // The unshared high-res tiles are not ready, so we cannot activate.
EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
- // Initialize remaining tiles.
- pending_layer_->SetAllTilesReady();
+ // When the unshared pending high-res tiles are ready, we can activate.
+ pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
+ EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+}
+
+TEST_F(PictureLayerImplTest, SharedActiveHighResReadyNotEnoughToActivate) {
+ gfx::Size tile_size(100, 100);
+ gfx::Size layer_bounds(1000, 1000);
+
+ SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
+ // Make sure some tiles are not shared.
+ pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size));
+
+ CreateHighLowResAndSetAllTilesVisible();
+
+ // Initialize all high-res tiles in the active layer.
+ active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling());
+
+ pending_layer_->MarkVisibleResourcesAsRequired();
+
+ // The unshared high-res tiles are not ready, so we cannot activate.
+ EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+
+ // When the unshared pending high-res tiles are ready, we can activate.
+ pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
}
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/test/fake_picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698