Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Side by Side Diff: cc/resources/tile_manager_unittest.cc

Issue 793573006: Refactoring for merging ManagedTileState into Tile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename HasResources to HasResource Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/resources/eviction_tile_priority_queue.h" 5 #include "cc/resources/eviction_tile_priority_queue.h"
6 #include "cc/resources/raster_tile_priority_queue.h" 6 #include "cc/resources/raster_tile_priority_queue.h"
7 #include "cc/resources/tile.h" 7 #include "cc/resources/tile.h"
8 #include "cc/resources/tile_priority.h" 8 #include "cc/resources/tile_priority.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 host_impl_.BuildEvictionQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); 413 host_impl_.BuildEvictionQueue(&queue, SMOOTHNESS_TAKES_PRIORITY);
414 EXPECT_FALSE(queue.IsEmpty()); 414 EXPECT_FALSE(queue.IsEmpty());
415 415
416 // Sanity check, all tiles should be visible. 416 // Sanity check, all tiles should be visible.
417 std::set<Tile*> smoothness_tiles; 417 std::set<Tile*> smoothness_tiles;
418 while (!queue.IsEmpty()) { 418 while (!queue.IsEmpty()) {
419 Tile* tile = queue.Top(); 419 Tile* tile = queue.Top();
420 EXPECT_TRUE(tile); 420 EXPECT_TRUE(tile);
421 EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin); 421 EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin);
422 EXPECT_EQ(TilePriority::NOW, tile->priority(PENDING_TREE).priority_bin); 422 EXPECT_EQ(TilePriority::NOW, tile->priority(PENDING_TREE).priority_bin);
423 EXPECT_TRUE(tile->HasResources()); 423 EXPECT_TRUE(tile->HasResource());
424 smoothness_tiles.insert(tile); 424 smoothness_tiles.insert(tile);
425 queue.Pop(); 425 queue.Pop();
426 } 426 }
427 EXPECT_EQ(all_tiles, smoothness_tiles); 427 EXPECT_EQ(all_tiles, smoothness_tiles);
428 428
429 tile_manager()->ReleaseTileResourcesForTesting( 429 tile_manager()->ReleaseTileResourcesForTesting(
430 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); 430 std::vector<Tile*>(all_tiles.begin(), all_tiles.end()));
431 431
432 Region invalidation(gfx::Rect(0, 0, 500, 500)); 432 Region invalidation(gfx::Rect(0, 0, 500, 500));
433 433
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 smoothness_tiles.clear(); 479 smoothness_tiles.clear();
480 tile_count = 0; 480 tile_count = 0;
481 // Here we expect to get increasing ACTIVE_TREE priority_bin. 481 // Here we expect to get increasing ACTIVE_TREE priority_bin.
482 queue.Reset(); 482 queue.Reset();
483 host_impl_.BuildEvictionQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); 483 host_impl_.BuildEvictionQueue(&queue, SMOOTHNESS_TAKES_PRIORITY);
484 int distance_increasing = 0; 484 int distance_increasing = 0;
485 int distance_decreasing = 0; 485 int distance_decreasing = 0;
486 while (!queue.IsEmpty()) { 486 while (!queue.IsEmpty()) {
487 Tile* tile = queue.Top(); 487 Tile* tile = queue.Top();
488 EXPECT_TRUE(tile); 488 EXPECT_TRUE(tile);
489 EXPECT_TRUE(tile->HasResources()); 489 EXPECT_TRUE(tile->HasResource());
490 490
491 if (!last_tile) 491 if (!last_tile)
492 last_tile = tile; 492 last_tile = tile;
493 493
494 EXPECT_GE(last_tile->priority(ACTIVE_TREE).priority_bin, 494 EXPECT_GE(last_tile->priority(ACTIVE_TREE).priority_bin,
495 tile->priority(ACTIVE_TREE).priority_bin); 495 tile->priority(ACTIVE_TREE).priority_bin);
496 if (last_tile->priority(ACTIVE_TREE).priority_bin == 496 if (last_tile->priority(ACTIVE_TREE).priority_bin ==
497 tile->priority(ACTIVE_TREE).priority_bin) { 497 tile->priority(ACTIVE_TREE).priority_bin) {
498 EXPECT_LE(last_tile->required_for_activation(), 498 EXPECT_LE(last_tile->required_for_activation(),
499 tile->required_for_activation()); 499 tile->required_for_activation());
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 all_tiles.insert(queue.Top()); 864 all_tiles.insert(queue.Top());
865 ++tile_count; 865 ++tile_count;
866 queue.Pop(); 866 queue.Pop();
867 } 867 }
868 EXPECT_EQ(tile_count, all_tiles.size()); 868 EXPECT_EQ(tile_count, all_tiles.size());
869 EXPECT_EQ(16u, tile_count); 869 EXPECT_EQ(16u, tile_count);
870 } 870 }
871 871
872 } // namespace 872 } // namespace
873 } // namespace cc 873 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698