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 70e0bd8bbb96ad3869a018cdebc6619a1055277c..fccd3c86284a34c42357315f6d919b44b2a9d1ab 100644 |
--- a/cc/resources/picture_layer_tiling_unittest.cc |
+++ b/cc/resources/picture_layer_tiling_unittest.cc |
@@ -130,8 +130,6 @@ class PictureLayerTilingIteratorTest : public testing::Test { |
EXPECT_GE(texture_rect.y(), 0); |
EXPECT_LE(texture_rect.right(), client_.TileSize().width()); |
EXPECT_LE(texture_rect.bottom(), client_.TileSize().height()); |
- |
- EXPECT_EQ(iter.texture_size(), client_.TileSize()); |
} |
// The entire rect must be filled by geometry from the tiling. |
@@ -1089,183 +1087,6 @@ TEST(PictureLayerTilingTest, EmptyStartingRect) { |
EXPECT_TRUE(out.IsEmpty()); |
} |
-TEST(PictureLayerTilingTest, TilingRasterTileIteratorStaticViewport) { |
- FakePictureLayerTilingClient client; |
- |
- gfx::Rect viewport(50, 50, 100, 100); |
- gfx::Size layer_bounds(800, 800); |
- |
- gfx::Rect soon_rect = viewport; |
- soon_rect.Inset(-312.f, -312.f, -312.f, -312.f); |
- |
- client.SetTileSize(gfx::Size(30, 30)); |
- client.set_tree(ACTIVE_TREE); |
- LayerTreeSettings settings; |
- settings.max_tiles_for_interest_area = 10000; |
- |
- scoped_refptr<FakePicturePileImpl> pile = |
- FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds); |
- scoped_ptr<TestablePictureLayerTiling> tiling = |
- TestablePictureLayerTiling::Create(1.0f, pile, &client, settings); |
- tiling->ComputeTilePriorityRects(viewport, 1.0f, 1.0, Occlusion()); |
- tiling->UpdateAllTilePrioritiesForTesting(); |
- |
- PictureLayerTiling::TilingRasterTileIterator empty_iterator; |
- EXPECT_FALSE(empty_iterator); |
- |
- std::vector<Tile*> all_tiles = tiling->AllTilesForTesting(); |
- |
- // Sanity check. |
- EXPECT_EQ(841u, all_tiles.size()); |
- |
- // The explanation of each iteration is as follows: |
- // 1. First iteration tests that we can get all of the tiles correctly. |
- // 2. Second iteration ensures that we can get all of the tiles again (first |
- // iteration didn't change any tiles), as well set all tiles to be ready to |
- // draw. |
- // 3. Third iteration ensures that no tiles are returned, since they were all |
- // marked as ready to draw. |
- for (int i = 0; i < 3; ++i) { |
- PictureLayerTiling::TilingRasterTileIterator it(tiling.get()); |
- |
- // There are 3 bins in TilePriority. |
- bool have_tiles[3] = {}; |
- |
- // On the third iteration, we should get no tiles since everything was |
- // marked as ready to draw. |
- if (i == 2) { |
- EXPECT_FALSE(it); |
- continue; |
- } |
- |
- EXPECT_TRUE(it); |
- std::set<Tile*> unique_tiles; |
- unique_tiles.insert(*it); |
- Tile* last_tile = *it; |
- have_tiles[last_tile->priority(ACTIVE_TREE).priority_bin] = true; |
- |
- // On the second iteration, mark everything as ready to draw (solid color). |
- if (i == 1) { |
- TileDrawInfo& draw_info = last_tile->draw_info(); |
- draw_info.SetSolidColorForTesting(SK_ColorRED); |
- } |
- ++it; |
- int eventually_bin_order_correct_count = 0; |
- int eventually_bin_order_incorrect_count = 0; |
- while (it) { |
- Tile* new_tile = *it; |
- ++it; |
- unique_tiles.insert(new_tile); |
- |
- TilePriority last_priority = last_tile->priority(ACTIVE_TREE); |
- TilePriority new_priority = new_tile->priority(ACTIVE_TREE); |
- EXPECT_LE(last_priority.priority_bin, new_priority.priority_bin); |
- if (last_priority.priority_bin == new_priority.priority_bin) { |
- if (last_priority.priority_bin == TilePriority::EVENTUALLY) { |
- bool order_correct = last_priority.distance_to_visible <= |
- new_priority.distance_to_visible; |
- eventually_bin_order_correct_count += order_correct; |
- eventually_bin_order_incorrect_count += !order_correct; |
- } else if (!soon_rect.Intersects(new_tile->content_rect()) && |
- !soon_rect.Intersects(last_tile->content_rect())) { |
- EXPECT_LE(last_priority.distance_to_visible, |
- new_priority.distance_to_visible); |
- EXPECT_EQ(TilePriority::NOW, new_priority.priority_bin); |
- } else if (new_priority.distance_to_visible > 0.f) { |
- EXPECT_EQ(TilePriority::SOON, new_priority.priority_bin); |
- } |
- } |
- have_tiles[new_priority.priority_bin] = true; |
- |
- last_tile = new_tile; |
- |
- // On the second iteration, mark everything as ready to draw (solid |
- // color). |
- if (i == 1) { |
- TileDrawInfo& draw_info = last_tile->draw_info(); |
- draw_info.SetSolidColorForTesting(SK_ColorRED); |
- } |
- } |
- |
- EXPECT_GT(eventually_bin_order_correct_count, |
- eventually_bin_order_incorrect_count); |
- |
- // We should have now and eventually tiles, as well as soon tiles from |
- // the border region. |
- EXPECT_TRUE(have_tiles[TilePriority::NOW]); |
- EXPECT_TRUE(have_tiles[TilePriority::SOON]); |
- EXPECT_TRUE(have_tiles[TilePriority::EVENTUALLY]); |
- |
- EXPECT_EQ(unique_tiles.size(), all_tiles.size()); |
- } |
-} |
- |
-TEST(PictureLayerTilingTest, TilingRasterTileIteratorMovingViewport) { |
- FakePictureLayerTilingClient client; |
- |
- gfx::Rect viewport(50, 0, 100, 100); |
- gfx::Rect moved_viewport(50, 0, 100, 500); |
- gfx::Size layer_bounds(1000, 1000); |
- |
- client.SetTileSize(gfx::Size(30, 30)); |
- client.set_tree(ACTIVE_TREE); |
- LayerTreeSettings settings; |
- settings.max_tiles_for_interest_area = 10000; |
- |
- scoped_refptr<FakePicturePileImpl> pile = |
- FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds); |
- scoped_ptr<TestablePictureLayerTiling> tiling = |
- TestablePictureLayerTiling::Create(1.f, pile, &client, settings); |
- tiling->ComputeTilePriorityRects(viewport, 1.0f, 1.0, Occlusion()); |
- tiling->ComputeTilePriorityRects(moved_viewport, 1.0f, 2.0, Occlusion()); |
- tiling->UpdateAllTilePrioritiesForTesting(); |
- |
- gfx::Rect soon_rect = moved_viewport; |
- soon_rect.Inset(-312.f, -312.f, -312.f, -312.f); |
- |
- // There are 3 bins in TilePriority. |
- bool have_tiles[3] = {}; |
- Tile* last_tile = NULL; |
- int eventually_bin_order_correct_count = 0; |
- int eventually_bin_order_incorrect_count = 0; |
- for (PictureLayerTiling::TilingRasterTileIterator it(tiling.get()); it; |
- ++it) { |
- if (!last_tile) |
- last_tile = *it; |
- |
- Tile* new_tile = *it; |
- |
- TilePriority last_priority = last_tile->priority(ACTIVE_TREE); |
- TilePriority new_priority = new_tile->priority(ACTIVE_TREE); |
- |
- have_tiles[new_priority.priority_bin] = true; |
- |
- EXPECT_LE(last_priority.priority_bin, new_priority.priority_bin); |
- if (last_priority.priority_bin == new_priority.priority_bin) { |
- if (last_priority.priority_bin == TilePriority::EVENTUALLY) { |
- bool order_correct = last_priority.distance_to_visible <= |
- new_priority.distance_to_visible; |
- eventually_bin_order_correct_count += order_correct; |
- eventually_bin_order_incorrect_count += !order_correct; |
- } else if (!soon_rect.Intersects(new_tile->content_rect()) && |
- !soon_rect.Intersects(last_tile->content_rect())) { |
- EXPECT_LE(last_priority.distance_to_visible, |
- new_priority.distance_to_visible); |
- } else if (new_priority.distance_to_visible > 0.f) { |
- EXPECT_EQ(TilePriority::SOON, new_priority.priority_bin); |
- } |
- } |
- last_tile = new_tile; |
- } |
- |
- EXPECT_GT(eventually_bin_order_correct_count, |
- eventually_bin_order_incorrect_count); |
- |
- EXPECT_TRUE(have_tiles[TilePriority::NOW]); |
- EXPECT_TRUE(have_tiles[TilePriority::SOON]); |
- EXPECT_TRUE(have_tiles[TilePriority::EVENTUALLY]); |
-} |
- |
static void TileExists(bool exists, Tile* tile, |
const gfx::Rect& geometry_rect) { |
EXPECT_EQ(exists, tile != NULL) << geometry_rect.ToString(); |