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

Unified Diff: cc/resources/picture_layer_tiling_unittest.cc

Issue 375923005: cc: Explicitly invalidate all dropped recordings on the main thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: invalid-resize: resizedeletestiles Created 6 years, 5 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/resources/picture_layer_tiling_set_unittest.cc ('k') | cc/resources/picture_pile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_layer_tiling_unittest.cc
diff --git a/cc/resources/picture_layer_tiling_unittest.cc b/cc/resources/picture_layer_tiling_unittest.cc
index 9743a8239cd02e0af64544c0f9e0f86c481de38b..96862ec3118b828cf909f603e4d22e4822bc8b7d 100644
--- a/cc/resources/picture_layer_tiling_unittest.cc
+++ b/cc/resources/picture_layer_tiling_unittest.cc
@@ -190,7 +190,8 @@ class PictureLayerTilingIteratorTest : public testing::Test {
};
TEST_F(PictureLayerTilingIteratorTest, ResizeDeletesTiles) {
- // Verifies that a resize deletes tiles that used to be on the edge.
+ // 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);
Initialize(tile_size, 1.f, original_layer_size);
@@ -202,10 +203,37 @@ TEST_F(PictureLayerTilingIteratorTest, ResizeDeletesTiles) {
// Stop creating tiles so that any invalidations are left as holes.
client_.set_allow_create_tile(false);
- tiling_->SetLayerBounds(gfx::Size(200, 200));
+ Region invalidation =
+ SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size));
+ tiling_->UpdateTilesToCurrentPile(invalidation, gfx::Size(200, 200));
EXPECT_FALSE(tiling_->TileAt(0, 0));
}
+TEST_F(PictureLayerTilingIteratorTest, ResizeOverBorderPixelsDeletesTiles) {
+ // 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(99, 99);
+ Initialize(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));
+
+ // Stop creating tiles so that any invalidations are left as holes.
+ client_.set_allow_create_tile(false);
+
+ Region invalidation =
+ SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size));
+ tiling_->UpdateTilesToCurrentPile(invalidation, gfx::Size(200, 200));
+ EXPECT_FALSE(tiling_->TileAt(0, 0));
+
+ // The original tile was the same size after resize, but it would include new
+ // border pixels.
+ EXPECT_EQ(gfx::Rect(original_layer_size),
+ tiling_->TilingDataForTesting().TileBounds(0, 0));
+}
+
TEST_F(PictureLayerTilingIteratorTest, LiveTilesExactlyCoverLiveTileRect) {
Initialize(gfx::Size(100, 100), 1, gfx::Size(1099, 801));
SetLiveRectAndVerifyTiles(gfx::Rect(100, 100));
« no previous file with comments | « cc/resources/picture_layer_tiling_set_unittest.cc ('k') | cc/resources/picture_pile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698