Chromium Code Reviews| 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 147f836a5974171a3951cb7ebbde6dea00928981..3913c105193198ae386a1d05f626a02ed79d2c23 100644 |
| --- a/cc/tiles/picture_layer_tiling_unittest.cc |
| +++ b/cc/tiles/picture_layer_tiling_unittest.cc |
| @@ -61,9 +61,13 @@ class TestablePictureLayerTiling : public PictureLayerTiling { |
| } |
| gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } |
| + PriorityRectType visible_rect_type() const { |
| + return PriorityRectType::VISIBLE_RECT; |
| + } |
| using PictureLayerTiling::RemoveTileAt; |
| using PictureLayerTiling::RemoveTilesInRegion; |
| + using PictureLayerTiling::ComputePriorityRectTypeForTile; |
| protected: |
| TestablePictureLayerTiling(WhichTree tree, |
| @@ -955,6 +959,30 @@ TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) { |
| EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); |
| } |
| +TEST(PictureLayerTilingTest, EdgeCaseTileNowAndRequired) { |
| + FakePictureLayerTilingClient pending_client; |
| + pending_client.SetTileSize(gfx::Size(100, 100)); |
| + |
| + scoped_refptr<FakeRasterSource> raster_source = |
| + FakeRasterSource::CreateFilled(gfx::Size(500, 500)); |
| + std::unique_ptr<TestablePictureLayerTiling> pending_tiling = |
| + TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, |
| + &pending_client, LayerTreeSettings()); |
| + pending_tiling->set_resolution(HIGH_RESOLUTION); |
| + pending_tiling->set_can_require_tiles_for_activation(true); |
| + |
| + gfx::Rect visible_rect = gfx::Rect(0, 0, 99, 99); |
|
danakj
2017/01/30 16:55:18
Can you also test what happens when the tile is 1p
vmpstr
2017/01/30 19:38:20
Done.
|
| + gfx::Rect eventually_rect = gfx::Rect(0, 0, 500, 500); |
| + pending_tiling->ComputeTilePriorityRects(visible_rect, visible_rect, |
| + visible_rect, eventually_rect, 1.f, |
| + Occlusion()); |
| + |
| + Tile* tile = pending_tiling->TileAt(1, 0); |
|
danakj
2017/01/30 16:55:18
Can you do some expectations to prove that the til
vmpstr
2017/01/30 19:38:20
Done.
|
| + EXPECT_NE(pending_tiling->visible_rect_type(), |
| + pending_tiling->ComputePriorityRectTypeForTile(tile)); |
| + EXPECT_FALSE(pending_tiling->IsTileRequiredForActivation(tile)); |
| +} |
| + |
| TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) { |
| // The tiling has four rows and three columns. |
| Initialize(gfx::Size(150, 100), 1.f, gfx::Size(250, 150)); |