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 1c8a3978eb2d25e6542119937bcdf4abfdfbc456..97f4907f9ef05e9dcfc67ad82c705e9296b1e39f 100644 |
| --- a/cc/tiles/picture_layer_tiling_unittest.cc |
| +++ b/cc/tiles/picture_layer_tiling_unittest.cc |
| @@ -49,7 +49,7 @@ class TestablePictureLayerTiling : public PictureLayerTiling { |
| const LayerTreeSettings& settings) { |
| return make_scoped_ptr(new TestablePictureLayerTiling( |
| tree, contents_scale, raster_source, client, |
| - settings.max_tiles_for_interest_area, |
| + settings.tiling_interest_area_padding, |
| settings.skewport_target_time_in_seconds, |
| settings.skewport_extrapolation_limit_in_content_pixels)); |
| } |
| @@ -64,14 +64,14 @@ class TestablePictureLayerTiling : public PictureLayerTiling { |
| float contents_scale, |
| scoped_refptr<RasterSource> raster_source, |
| PictureLayerTilingClient* client, |
| - size_t max_tiles_for_interest_area, |
| + size_t tiling_interest_area_padding, |
| float skewport_target_time, |
| int skewport_extrapolation_limit) |
| : PictureLayerTiling(tree, |
| contents_scale, |
| raster_source, |
| client, |
| - max_tiles_for_interest_area, |
| + tiling_interest_area_padding, |
| skewport_target_time, |
| skewport_extrapolation_limit) {} |
| }; |
| @@ -550,7 +550,6 @@ TEST(PictureLayerTilingTest, SkewportLimits) { |
| client.SetTileSize(gfx::Size(100, 100)); |
| LayerTreeSettings settings; |
| - settings.max_tiles_for_interest_area = 10000; |
|
weiliangc
2015/07/15 19:56:09
Why can we rm this here? Does it have no effects i
vmpstr
2015/07/16 00:31:03
It's a similar reason as the previous comment. Bef
|
| settings.skewport_extrapolation_limit_in_content_pixels = 75; |
| scoped_refptr<FakePicturePileImpl> pile = |
| @@ -793,7 +792,6 @@ TEST(PictureLayerTilingTest, ViewportDistanceWithScale) { |
| client.SetTileSize(gfx::Size(10, 10)); |
| LayerTreeSettings settings; |
| - settings.max_tiles_for_interest_area = 10000; |
| // Tiling at 0.25 scale: this should create 47x47 tiles of size 10x10. |
| // The reason is that each tile has a one pixel border, so tile at (1, 2) |
| @@ -988,228 +986,6 @@ TEST(PictureLayerTilingTest, ViewportDistanceWithScale) { |
| EXPECT_FLOAT_EQ(30.f, priority.distance_to_visible); |
| } |
| -TEST(PictureLayerTilingTest, ExpandRectEqual) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(-1000, -1000, 10000, 10000); |
| - int64 target_area = 100 * 200; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(in.ToString(), out.ToString()); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectSmaller) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(-1000, -1000, 10000, 10000); |
| - int64 target_area = 100 * 100; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(out.bottom() - in.bottom(), in.y() - out.y()); |
| - EXPECT_EQ(out.right() - in.right(), in.x() - out.x()); |
| - EXPECT_EQ(out.width() - in.width(), out.height() - in.height()); |
| - |
| - // |in| represents the visible rect, and |out| represents the eventually rect. |
| - // If the eventually rect doesn't contain the visible rect, we will start |
| - // losing tiles. |
| - EXPECT_TRUE(out.Contains(in)); |
| - EXPECT_TRUE(bounds.Contains(out)); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectUnbounded) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(-1000, -1000, 10000, 10000); |
| - int64 target_area = 200 * 200; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(out.bottom() - in.bottom(), in.y() - out.y()); |
| - EXPECT_EQ(out.right() - in.right(), in.x() - out.x()); |
| - EXPECT_EQ(out.width() - in.width(), out.height() - in.height()); |
| - EXPECT_NEAR(200 * 200, out.width() * out.height(), 100); |
| - EXPECT_TRUE(bounds.Contains(out)); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectBoundedSmaller) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(50, 60, 40, 30); |
| - int64 target_area = 200 * 200; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(bounds.ToString(), out.ToString()); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectBoundedEqual) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds = in; |
| - int64 target_area = 200 * 200; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(bounds.ToString(), out.ToString()); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectBoundedSmallerStretchVertical) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(45, 0, 90, 300); |
| - int64 target_area = 200 * 200; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(bounds.ToString(), out.ToString()); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectBoundedEqualStretchVertical) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(40, 0, 100, 300); |
| - int64 target_area = 200 * 200; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(bounds.ToString(), out.ToString()); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectBoundedSmallerStretchHorizontal) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(0, 55, 180, 190); |
| - int64 target_area = 200 * 200; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(bounds.ToString(), out.ToString()); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectBoundedEqualStretchHorizontal) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(0, 50, 180, 200); |
| - int64 target_area = 200 * 200; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(bounds.ToString(), out.ToString()); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectBoundedLeft) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(20, -1000, 10000, 10000); |
| - int64 target_area = 200 * 200; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(out.bottom() - in.bottom(), in.y() - out.y()); |
| - EXPECT_EQ(out.bottom() - in.bottom(), out.right() - in.right()); |
| - EXPECT_LE(out.width() * out.height(), target_area); |
| - EXPECT_GT(out.width() * out.height(), |
| - target_area - out.width() - out.height() * 2); |
| - EXPECT_TRUE(bounds.Contains(out)); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectBoundedRight) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(-1000, -1000, 1000+120, 10000); |
| - int64 target_area = 200 * 200; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(out.bottom() - in.bottom(), in.y() - out.y()); |
| - EXPECT_EQ(out.bottom() - in.bottom(), in.x() - out.x()); |
| - EXPECT_LE(out.width() * out.height(), target_area); |
| - EXPECT_GT(out.width() * out.height(), |
| - target_area - out.width() - out.height() * 2); |
| - EXPECT_TRUE(bounds.Contains(out)); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectBoundedTop) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(-1000, 30, 10000, 10000); |
| - int64 target_area = 200 * 200; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(out.right() - in.right(), in.x() - out.x()); |
| - EXPECT_EQ(out.right() - in.right(), out.bottom() - in.bottom()); |
| - EXPECT_LE(out.width() * out.height(), target_area); |
| - EXPECT_GT(out.width() * out.height(), |
| - target_area - out.width() * 2 - out.height()); |
| - EXPECT_TRUE(bounds.Contains(out)); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectBoundedBottom) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(-1000, -1000, 10000, 1000 + 220); |
| - int64 target_area = 200 * 200; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(out.right() - in.right(), in.x() - out.x()); |
| - EXPECT_EQ(out.right() - in.right(), in.y() - out.y()); |
| - EXPECT_LE(out.width() * out.height(), target_area); |
| - EXPECT_GT(out.width() * out.height(), |
| - target_area - out.width() * 2 - out.height()); |
| - EXPECT_TRUE(bounds.Contains(out)); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectSquishedHorizontally) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(0, -4000, 100+40+20, 100000); |
| - int64 target_area = 400 * 400; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(20, out.right() - in.right()); |
| - EXPECT_EQ(40, in.x() - out.x()); |
| - EXPECT_EQ(out.bottom() - in.bottom(), in.y() - out.y()); |
| - EXPECT_LE(out.width() * out.height(), target_area); |
| - EXPECT_GT(out.width() * out.height(), |
| - target_area - out.width() * 2); |
| - EXPECT_TRUE(bounds.Contains(out)); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectSquishedVertically) { |
| - gfx::Rect in(40, 50, 100, 200); |
| - gfx::Rect bounds(-4000, 0, 100000, 200+50+30); |
| - int64 target_area = 400 * 400; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(30, out.bottom() - in.bottom()); |
| - EXPECT_EQ(50, in.y() - out.y()); |
| - EXPECT_EQ(out.right() - in.right(), in.x() - out.x()); |
| - EXPECT_LE(out.width() * out.height(), target_area); |
| - EXPECT_GT(out.width() * out.height(), |
| - target_area - out.height() * 2); |
| - EXPECT_TRUE(bounds.Contains(out)); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectOutOfBoundsFarAway) { |
| - gfx::Rect in(400, 500, 100, 200); |
| - gfx::Rect bounds(0, 0, 10, 10); |
| - int64 target_area = 400 * 400; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_TRUE(out.IsEmpty()); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectOutOfBoundsExpandedFullyCover) { |
| - gfx::Rect in(40, 50, 100, 100); |
| - gfx::Rect bounds(0, 0, 10, 10); |
| - int64 target_area = 400 * 400; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(bounds.ToString(), out.ToString()); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, ExpandRectOutOfBoundsExpandedPartlyCover) { |
| - gfx::Rect in(600, 600, 100, 100); |
| - gfx::Rect bounds(0, 0, 500, 500); |
| - int64 target_area = 400 * 400; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_EQ(bounds.right(), out.right()); |
| - EXPECT_EQ(bounds.bottom(), out.bottom()); |
| - EXPECT_LE(out.width() * out.height(), target_area); |
| - EXPECT_GT(out.width() * out.height(), |
| - target_area - out.width() - out.height()); |
| - EXPECT_TRUE(bounds.Contains(out)); |
| -} |
| - |
| -TEST(PictureLayerTilingTest, EmptyStartingRect) { |
| - // If a layer has a non-invertible transform, then the starting rect |
| - // for the layer would be empty. |
| - gfx::Rect in(40, 40, 0, 0); |
| - gfx::Rect bounds(0, 0, 10, 10); |
| - int64 target_area = 400 * 400; |
| - gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| - in, target_area, bounds, NULL); |
| - EXPECT_TRUE(out.IsEmpty()); |
| -} |
| - |
| static void TileExists(bool exists, Tile* tile, |
| const gfx::Rect& geometry_rect) { |
| EXPECT_EQ(exists, tile != NULL) << geometry_rect.ToString(); |
| @@ -1293,7 +1069,7 @@ TEST_F(PictureLayerTilingIteratorTest, |
| gfx::Size layer_bounds(10000, 10000); |
| client_.SetTileSize(gfx::Size(100, 100)); |
| LayerTreeSettings settings; |
| - settings.max_tiles_for_interest_area = 1; |
| + settings.tiling_interest_area_padding = 1; |
| scoped_refptr<FakePicturePileImpl> pile = |
| FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds); |
| @@ -1750,7 +1526,6 @@ TEST(ComputeTilePriorityRectsTest, BasicMotion) { |
| client.SetTileSize(gfx::Size(100, 100)); |
| LayerTreeSettings settings; |
| - settings.max_tiles_for_interest_area = 10000; |
| scoped_refptr<FakePicturePileImpl> pile = |
| FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( |
| @@ -1880,7 +1655,6 @@ TEST(PictureLayerTilingTest, RecycledTilesCleared) { |
| active_client.SetTileSize(gfx::Size(100, 100)); |
| LayerTreeSettings settings; |
| - settings.max_tiles_for_interest_area = 10; |
| scoped_refptr<FakePicturePileImpl> pile = |
| FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( |
| @@ -1948,7 +1722,6 @@ TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) { |
| recycle_client.set_twin_tiling(active_tiling.get()); |
| LayerTreeSettings settings; |
| - settings.max_tiles_for_interest_area = 10; |
| pile = FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( |
| gfx::Size(100, 100)); |