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

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

Issue 219963005: cc: Add support for partial swaps when using impl-side painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit tests added + other comments Created 6 years, 8 months 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/tile.h" 5 #include "cc/resources/tile.h"
6 #include "cc/resources/tile_priority.h" 6 #include "cc/resources/tile_priority.h"
7 #include "cc/test/fake_impl_proxy.h" 7 #include "cc/test/fake_impl_proxy.h"
8 #include "cc/test/fake_layer_tree_host_impl.h" 8 #include "cc/test/fake_layer_tree_host_impl.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/test/fake_output_surface_client.h" 10 #include "cc/test/fake_output_surface_client.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 virtual void TearDown() OVERRIDE { 76 virtual void TearDown() OVERRIDE {
77 tile_manager_.reset(NULL); 77 tile_manager_.reset(NULL);
78 picture_pile_ = NULL; 78 picture_pile_ = NULL;
79 79
80 testing::Test::TearDown(); 80 testing::Test::TearDown();
81 } 81 }
82 82
83 // TileManagerClient implementation. 83 // TileManagerClient implementation.
84 virtual void NotifyReadyToActivate() OVERRIDE { ready_to_activate_ = true; } 84 virtual void NotifyReadyToActivate() OVERRIDE { ready_to_activate_ = true; }
85 virtual void NotifyTileInitialized(const Tile* tile) OVERRIDE {}
85 86
86 TileVector CreateTilesWithSize(int count, 87 TileVector CreateTilesWithSize(int count,
87 TilePriority active_priority, 88 TilePriority active_priority,
88 TilePriority pending_priority, 89 TilePriority pending_priority,
89 const gfx::Size& tile_size) { 90 const gfx::Size& tile_size) {
90 TileVector tiles; 91 TileVector tiles;
91 for (int i = 0; i < count; ++i) { 92 for (int i = 0; i < count; ++i) {
92 scoped_refptr<Tile> tile = tile_manager_->CreateTile(picture_pile_.get(), 93 scoped_refptr<Tile> tile = tile_manager_->CreateTile(picture_pile_.get(),
93 tile_size, 94 tile_size,
94 gfx::Rect(), 95 gfx::Rect(),
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 void CreateHighLowResAndSetAllTilesVisible() { 728 void CreateHighLowResAndSetAllTilesVisible() {
728 // Active layer must get updated first so pending layer can share from it. 729 // Active layer must get updated first so pending layer can share from it.
729 active_layer_->CreateDefaultTilingsAndTiles(); 730 active_layer_->CreateDefaultTilingsAndTiles();
730 active_layer_->SetAllTilesVisible(); 731 active_layer_->SetAllTilesVisible();
731 pending_layer_->CreateDefaultTilingsAndTiles(); 732 pending_layer_->CreateDefaultTilingsAndTiles();
732 pending_layer_->SetAllTilesVisible(); 733 pending_layer_->SetAllTilesVisible();
733 } 734 }
734 735
735 // TileManagerClient implementation. 736 // TileManagerClient implementation.
736 virtual void NotifyReadyToActivate() OVERRIDE { ready_to_activate_ = true; } 737 virtual void NotifyReadyToActivate() OVERRIDE { ready_to_activate_ = true; }
738 virtual void NotifyTileInitialized(const Tile* tile) OVERRIDE {}
737 739
738 TileManager* tile_manager() { return host_impl_.tile_manager(); } 740 TileManager* tile_manager() { return host_impl_.tile_manager(); }
739 741
740 protected: 742 protected:
741 GlobalStateThatImpactsTilePriority global_state_; 743 GlobalStateThatImpactsTilePriority global_state_;
742 744
743 TestSharedBitmapManager shared_bitmap_manager_; 745 TestSharedBitmapManager shared_bitmap_manager_;
744 TileMemoryLimitPolicy memory_limit_policy_; 746 TileMemoryLimitPolicy memory_limit_policy_;
745 int max_tiles_; 747 int max_tiles_;
746 bool ready_to_activate_; 748 bool ready_to_activate_;
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 1131
1130 last_tile = tile; 1132 last_tile = tile;
1131 new_content_tiles.insert(tile); 1133 new_content_tiles.insert(tile);
1132 } 1134 }
1133 1135
1134 EXPECT_EQ(tile_count, new_content_tiles.size()); 1136 EXPECT_EQ(tile_count, new_content_tiles.size());
1135 EXPECT_EQ(all_tiles, new_content_tiles); 1137 EXPECT_EQ(all_tiles, new_content_tiles);
1136 } 1138 }
1137 } // namespace 1139 } // namespace
1138 } // namespace cc 1140 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698