Index: cc/resources/tile_manager_unittest.cc |
diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc |
index cce307ce4fe79f622dc4665f839da1e0fbc0b7ed..37575031c7aa0ae8392d49de533e17fa19b52081 100644 |
--- a/cc/resources/tile_manager_unittest.cc |
+++ b/cc/resources/tile_manager_unittest.cc |
@@ -183,7 +183,6 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { |
Tile* tile = queue->Top(); |
EXPECT_TRUE(tile); |
EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin); |
- EXPECT_EQ(TilePriority::NOW, tile->priority(PENDING_TREE).priority_bin); |
if (tile->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) |
had_low_res = true; |
else |
@@ -433,19 +432,19 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueInvalidation) { |
// Use a tile's content rect as an invalidation. We should inset it a bit to |
// ensure that border math doesn't invalidate neighbouring tiles. |
gfx::Rect invalidation = |
- pending_layer_->HighResTiling()->TileAt(1, 0)->content_rect(); |
+ active_layer_->HighResTiling()->TileAt(1, 0)->content_rect(); |
invalidation.Inset(2, 2); |
pending_layer_->set_invalidation(invalidation); |
pending_layer_->HighResTiling()->Invalidate(invalidation); |
+ pending_layer_->HighResTiling()->CreateMissingTilesInLiveTilesRect(); |
pending_layer_->LowResTiling()->Invalidate(invalidation); |
+ pending_layer_->LowResTiling()->CreateMissingTilesInLiveTilesRect(); |
- // Sanity checks: Tile at 0, 0 should be the same on both trees, tile at 1, 0 |
- // should be different. |
- EXPECT_TRUE(pending_layer_->HighResTiling()->TileAt(0, 0)); |
+ // Sanity checks: Tile at 0, 0 not exist on the pending tree (it's not |
+ // invalidated). Tile 1, 0 should exist on both. |
+ EXPECT_FALSE(pending_layer_->HighResTiling()->TileAt(0, 0)); |
EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(0, 0)); |
- EXPECT_EQ(pending_layer_->HighResTiling()->TileAt(0, 0), |
- active_layer_->HighResTiling()->TileAt(0, 0)); |
EXPECT_TRUE(pending_layer_->HighResTiling()->TileAt(1, 0)); |
EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(1, 0)); |
EXPECT_NE(pending_layer_->HighResTiling()->TileAt(1, 0), |
@@ -456,13 +455,20 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueInvalidation) { |
std::set<Tile*> expected_required_for_activation_tiles; |
for (int i = 0; i <= 1; ++i) { |
for (int j = 0; j <= 1; ++j) { |
- expected_now_tiles.insert(pending_layer_->HighResTiling()->TileAt(i, j)); |
- expected_now_tiles.insert(active_layer_->HighResTiling()->TileAt(i, j)); |
- |
- expected_required_for_activation_tiles.insert( |
- pending_layer_->HighResTiling()->TileAt(i, j)); |
- expected_required_for_draw_tiles.insert( |
- active_layer_->HighResTiling()->TileAt(i, j)); |
+ bool have_pending_tile = false; |
+ if (pending_layer_->HighResTiling()->TileAt(i, j)) { |
+ expected_now_tiles.insert( |
+ pending_layer_->HighResTiling()->TileAt(i, j)); |
+ expected_required_for_activation_tiles.insert( |
+ pending_layer_->HighResTiling()->TileAt(i, j)); |
+ have_pending_tile = true; |
+ } |
+ Tile* active_tile = active_layer_->HighResTiling()->TileAt(i, j); |
+ EXPECT_TRUE(active_tile); |
+ expected_now_tiles.insert(active_tile); |
+ expected_required_for_draw_tiles.insert(active_tile); |
+ if (!have_pending_tile) |
+ expected_required_for_activation_tiles.insert(active_tile); |
} |
} |
// Expect 3 shared tiles and 1 unshared tile in total. |
@@ -476,7 +482,10 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueInvalidation) { |
std::set<Tile*> expected_all_tiles; |
for (int i = 0; i <= 3; ++i) { |
for (int j = 0; j <= 3; ++j) { |
- expected_all_tiles.insert(pending_layer_->HighResTiling()->TileAt(i, j)); |
+ if (pending_layer_->HighResTiling()->TileAt(i, j)) |
+ expected_all_tiles.insert( |
+ pending_layer_->HighResTiling()->TileAt(i, j)); |
+ EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(i, j)); |
expected_all_tiles.insert(active_layer_->HighResTiling()->TileAt(i, j)); |
} |
} |
@@ -611,7 +620,6 @@ TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueue) { |
Tile* tile = queue->Top(); |
EXPECT_TRUE(tile); |
EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin); |
- EXPECT_EQ(TilePriority::NOW, tile->priority(PENDING_TREE).priority_bin); |
EXPECT_TRUE(tile->HasResource()); |
smoothness_tiles.insert(tile); |
queue->Pop(); |
@@ -706,7 +714,7 @@ TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueue) { |
// Ensure that the distance is decreasing many more times than increasing. |
EXPECT_EQ(3, distance_increasing); |
- EXPECT_EQ(17, distance_decreasing); |
+ EXPECT_EQ(12, distance_decreasing); |
enne (OOO)
2015/04/13 22:36:02
What's up with this change?
vmpstr
2015/04/13 23:52:13
Oops. This was a wrong fix for the test. Changed.
|
EXPECT_EQ(tile_count, smoothness_tiles.size()); |
EXPECT_EQ(all_tiles, smoothness_tiles); |
@@ -746,7 +754,7 @@ TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueue) { |
// Ensure that the distance is decreasing many more times than increasing. |
EXPECT_EQ(3, distance_increasing); |
- EXPECT_EQ(17, distance_decreasing); |
+ EXPECT_EQ(12, distance_decreasing); |
EXPECT_EQ(tile_count, new_content_tiles.size()); |
EXPECT_EQ(all_tiles, new_content_tiles); |
} |