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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 670773002: cc: Add a unittest for an early out patch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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 | « no previous file | no next file » | 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 73906afdb61812a840c2ef39d88e69967bc6679e..4d399224caec15b1a5f81cc74ea28968e90addc1 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -4490,6 +4490,65 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) {
EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
}
+TEST_F(PictureLayerImplTest, ChangeInViewportAllowsTilingUpdates) {
+ base::TimeTicks time_ticks;
+ time_ticks += base::TimeDelta::FromMilliseconds(1);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
+
+ gfx::Size tile_size(100, 100);
+ gfx::Size layer_bounds(400, 4000);
+
+ scoped_refptr<FakePicturePileImpl> pending_pile =
+ FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
+ scoped_refptr<FakePicturePileImpl> active_pile =
+ FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
+
+ SetupTrees(pending_pile, active_pile);
+
+ Region invalidation;
+ gfx::Rect viewport = gfx::Rect(0, 0, 100, 100);
+ gfx::Transform transform;
+
+ host_impl_.SetRequiresHighResToDraw();
+
+ // Update tiles.
+ pending_layer_->draw_properties().visible_content_rect = viewport;
+ pending_layer_->draw_properties().screen_space_transform = transform;
+ SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, false);
+ pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
+
+ // Ensure we can't activate.
+ EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+
+ // Now in the same frame, move the viewport (this can happen during
+ // animation).
+ viewport = gfx::Rect(0, 2000, 100, 100);
+
+ // Update tiles.
+ pending_layer_->draw_properties().visible_content_rect = viewport;
+ pending_layer_->draw_properties().screen_space_transform = transform;
+ SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, false);
+ pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
+
+ // Make sure all viewport tiles (viewport from the tiling) are ready to draw.
+ std::vector<Tile*> tiles;
+ for (PictureLayerTiling::CoverageIterator iter(
+ pending_layer_->HighResTiling(),
+ 1.f,
+ pending_layer_->HighResTiling()->GetCurrentVisibleRectForTesting());
+ iter;
+ ++iter) {
+ if (*iter)
+ tiles.push_back(*iter);
+ }
+
+ host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles);
+
+ // Ensure we can activate.
+ EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+}
+
class TileSizeSettings : public ImplSidePaintingSettings {
public:
TileSizeSettings() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698