| 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 5999ecd55e7b52b6005dc2faebb323de24e74a52..f7bee1e49c353f18e7370022e5ff3a3300c2bd8c 100644
|
| --- a/cc/resources/picture_layer_tiling_unittest.cc
|
| +++ b/cc/resources/picture_layer_tiling_unittest.cc
|
| @@ -2,12 +2,11 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "cc/resources/picture_layer_tiling.h"
|
| -
|
| #include <limits>
|
| #include <set>
|
|
|
| #include "cc/base/math_util.h"
|
| +#include "cc/resources/picture_layer_tiling.h"
|
| #include "cc/resources/picture_layer_tiling_set.h"
|
| #include "cc/test/fake_output_surface.h"
|
| #include "cc/test/fake_output_surface_client.h"
|
| @@ -89,6 +88,17 @@ class PictureLayerTilingIteratorTest : public testing::Test {
|
| LayerTreeSettings());
|
| }
|
|
|
| + void InitializeActive(const gfx::Size& tile_size,
|
| + float contents_scale,
|
| + const gfx::Size& layer_bounds) {
|
| + client_.SetTileSize(tile_size);
|
| + client_.set_tree(ACTIVE_TREE);
|
| + scoped_refptr<FakePicturePileImpl> pile =
|
| + FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds);
|
| + tiling_ = TestablePictureLayerTiling::Create(contents_scale, pile, &client_,
|
| + LayerTreeSettings());
|
| + }
|
| +
|
| void SetLiveRectAndVerifyTiles(const gfx::Rect& live_tiles_rect) {
|
| tiling_->SetLiveTilesRect(live_tiles_rect);
|
|
|
| @@ -189,7 +199,7 @@ TEST_F(PictureLayerTilingIteratorTest, ResizeDeletesTiles) {
|
| // 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);
|
| + 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.
|
| @@ -405,7 +415,7 @@ TEST_F(PictureLayerTilingIteratorTest, ResizeOverBorderPixelsDeletesTiles) {
|
| // 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);
|
| + 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.
|
| @@ -1885,15 +1895,13 @@ TEST(PictureLayerTilingTest, RecycledTilesCleared) {
|
| active_client.set_recycled_twin_tiling(recycle_tiling.get());
|
| recycle_client.set_twin_tiling(NULL);
|
|
|
| - // Verify that tiles exist and are shared.
|
| EXPECT_TRUE(active_tiling->TileAt(0, 0));
|
| - EXPECT_TRUE(recycle_tiling->TileAt(0, 0));
|
| - EXPECT_EQ(active_tiling->TileAt(0, 0), recycle_tiling->TileAt(0, 0));
|
| + EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
|
|
|
| // Move the viewport far away from the (0, 0) tile.
|
| active_tiling->ComputeTilePriorityRects(gfx::Rect(9000, 9000, 100, 100), 1.0f,
|
| 2.0, Occlusion());
|
| - // Ensure the tile was deleted on both tilings.
|
| + // Ensure the tile was deleted.
|
| EXPECT_FALSE(active_tiling->TileAt(0, 0));
|
| EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
|
|
|
| @@ -1901,9 +1909,9 @@ TEST(PictureLayerTilingTest, RecycledTilesCleared) {
|
| active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 3.0,
|
| Occlusion());
|
|
|
| - // Ensure that we now have a tile here on both tilings again.
|
| + // Ensure that we now have a tile here on both active.
|
| EXPECT_TRUE(active_tiling->TileAt(0, 0));
|
| - EXPECT_TRUE(recycle_tiling->TileAt(0, 0));
|
| + EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
|
| }
|
|
|
| TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) {
|
| @@ -1943,10 +1951,8 @@ TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) {
|
| active_client.set_recycled_twin_tiling(recycle_tiling.get());
|
| recycle_client.set_twin_tiling(NULL);
|
|
|
| - // Verify that tiles exist and are shared.
|
| EXPECT_TRUE(active_tiling->TileAt(0, 0));
|
| - EXPECT_TRUE(recycle_tiling->TileAt(0, 0));
|
| - EXPECT_EQ(active_tiling->TileAt(0, 0), recycle_tiling->TileAt(0, 0));
|
| + EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
|
|
|
| // Reset the active tiling. The recycle tiles should be released too.
|
| active_tiling->Reset();
|
|
|