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

Unified Diff: cc/tiles/picture_layer_tiling_unittest.cc

Issue 1381163002: Add a flag to disable partial raster in renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: cc/tiles/picture_layer_tiling_unittest.cc
diff --git a/cc/tiles/picture_layer_tiling_unittest.cc b/cc/tiles/picture_layer_tiling_unittest.cc
index ec3b87024d78931c0df77bd8fef84c3b76646fd1..6a75a6259dbbd8c540f4156926948cf13125db54 100644
--- a/cc/tiles/picture_layer_tiling_unittest.cc
+++ b/cc/tiles/picture_layer_tiling_unittest.cc
@@ -1796,5 +1796,54 @@ TEST_F(PictureLayerTilingIteratorTest, GiantRect) {
VerifyTilesExactlyCoverRect(contents_scale, content_rect);
}
+TEST_F(PictureLayerTilingIteratorTest,
+ InvalidatedIdRespectsEnabledPartialRaster) {
+ // Verifies that a resize with invalidation for newly exposed pixels will
+ // deletes tiles that intersect that invalidation.
+ gfx::Size tile_size(100, 100);
+ gfx::Size original_layer_size(10, 10);
+ client_.SetTileSize(tile_size);
+ scoped_refptr<FakeDisplayListRasterSource> raster_source =
+ FakeDisplayListRasterSource::CreateFilled(original_layer_size);
+ LayerTreeSettings settings;
+ settings.enable_partial_raster = true;
+ tiling_ = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.f, raster_source,
+ &client_, settings);
+ tiling_->set_resolution(HIGH_RESOLUTION);
+ SetLiveRectAndVerifyTiles(gfx::Rect(original_layer_size));
+
+ // Tiling only has one tile, since its total size is less than one.
+ EXPECT_TRUE(tiling_->TileAt(0, 0));
+
+ Region invalidation =
+ SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size));
+
+ EXPECT_TRUE(tiling_->TileAt(0, 0));
+ EXPECT_FALSE(tiling_->TileAt(0, 0)->invalidated_id());
vmpstr 2015/10/06 18:35:49 can you make this EXPECT_EQ(0, ...);
ericrk 2015/10/07 17:59:08 Done.
+ tiling_->Invalidate(invalidation);
+ EXPECT_TRUE(tiling_->TileAt(0, 0)->invalidated_id());
vmpstr 2015/10/06 18:35:49 Can you save off the original tile id and EXPECT_E
ericrk 2015/10/07 17:59:08 Done.
+}
+
+TEST_F(PictureLayerTilingIteratorTest,
+ InvalidatedIdRespectsDisabledPartialRaster) {
+ // Verifies that a resize with invalidation for newly exposed pixels will
+ // deletes tiles that intersect that invalidation.
+ gfx::Size tile_size(100, 100);
+ gfx::Size original_layer_size(10, 10);
+ InitializeActive(tile_size, 1.f, original_layer_size);
+ SetLiveRectAndVerifyTiles(gfx::Rect(original_layer_size));
+
+ // Tiling only has one tile, since its total size is less than one.
+ EXPECT_TRUE(tiling_->TileAt(0, 0));
+
+ Region invalidation =
+ SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size));
+
+ EXPECT_TRUE(tiling_->TileAt(0, 0));
+ EXPECT_FALSE(tiling_->TileAt(0, 0)->invalidated_id());
vmpstr 2015/10/06 18:35:49 Same here.
ericrk 2015/10/07 17:59:08 Done.
+ tiling_->Invalidate(invalidation);
+ EXPECT_FALSE(tiling_->TileAt(0, 0)->invalidated_id());
+}
+
} // namespace
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698