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

Unified Diff: cc/resources/picture_layer_tiling_unittest.cc

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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.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 f793097b7f4b95d0f496b42173add394aa302305..786f943e16727ea452c7a4ded693813911556bf6 100644
--- a/cc/resources/picture_layer_tiling_unittest.cc
+++ b/cc/resources/picture_layer_tiling_unittest.cc
@@ -211,7 +211,7 @@ TEST_F(PictureLayerTilingIteratorTest, ResizeDeletesTiles) {
Region invalidation =
SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size));
- tiling_->UpdateTilesToCurrentPile(invalidation, gfx::Size(200, 200));
+ tiling_->UpdateTilesToCurrentRasterSource(invalidation, gfx::Size(200, 200));
EXPECT_FALSE(tiling_->TileAt(0, 0));
}
@@ -266,8 +266,8 @@ TEST_F(PictureLayerTilingIteratorTest, ResizeTilingOverTileBorders) {
// Shrink the tiling so that the last tile row/column is entirely in the
// border pixels of the interior tiles. That row/column is removed.
Region invalidation;
- tiling_->UpdateTilesToCurrentPile(invalidation,
- gfx::Size(right + 1, bottom + 1));
+ tiling_->UpdateTilesToCurrentRasterSource(invalidation,
+ gfx::Size(right + 1, bottom + 1));
EXPECT_EQ(2, tiling_->TilingDataForTesting().num_tiles_x());
EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_y());
@@ -284,8 +284,8 @@ TEST_F(PictureLayerTilingIteratorTest, ResizeTilingOverTileBorders) {
// Growing outside the current right/bottom tiles border pixels should create
// the tiles again, even though the live rect has not changed size.
- tiling_->UpdateTilesToCurrentPile(invalidation,
- gfx::Size(right + 2, bottom + 2));
+ tiling_->UpdateTilesToCurrentRasterSource(invalidation,
+ gfx::Size(right + 2, bottom + 2));
EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_x());
EXPECT_EQ(4, tiling_->TilingDataForTesting().num_tiles_y());
@@ -421,7 +421,7 @@ TEST_F(PictureLayerTilingIteratorTest, ResizeOverBorderPixelsDeletesTiles) {
Region invalidation =
SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size));
- tiling_->UpdateTilesToCurrentPile(invalidation, gfx::Size(200, 200));
+ tiling_->UpdateTilesToCurrentRasterSource(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
@@ -2178,5 +2178,29 @@ TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) {
EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
}
+TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) {
+ // The tiling has four rows and three columns.
+ Initialize(gfx::Size(150, 100), 1, gfx::Size(250, 150));
+ tiling_->CreateAllTilesForTesting();
+ EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width());
+ EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height());
+ EXPECT_EQ(4u, tiling_->AllRefTilesForTesting().size());
+
+ client_.SetTileSize(gfx::Size(250, 200));
+ client_.set_tree(PENDING_TREE);
+
+ // Tile size in the tiling should still be 150x100.
+ EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width());
+ EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height());
+
+ Region invalidation;
+ tiling_->UpdateTilesToCurrentRasterSource(invalidation, gfx::Size(250, 150));
+
+ // Tile size in the tiling should be resized to 250x200.
+ EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width());
+ EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height());
+ EXPECT_EQ(0u, tiling_->AllRefTilesForTesting().size());
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/resources/picture_layer_tiling_set.cc ('k') | cc/resources/picture_pile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698