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

Side by Side Diff: cc/resources/picture_layer_tiling_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/picture_layer_tiling.h" 5 #include "cc/resources/picture_layer_tiling.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 9
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 } 1131 }
1132 1132
1133 EXPECT_TRUE(it); 1133 EXPECT_TRUE(it);
1134 std::set<Tile*> unique_tiles; 1134 std::set<Tile*> unique_tiles;
1135 unique_tiles.insert(*it); 1135 unique_tiles.insert(*it);
1136 Tile* last_tile = *it; 1136 Tile* last_tile = *it;
1137 have_tiles[last_tile->priority(ACTIVE_TREE).priority_bin] = true; 1137 have_tiles[last_tile->priority(ACTIVE_TREE).priority_bin] = true;
1138 1138
1139 // On the second iteration, mark everything as ready to draw (solid color). 1139 // On the second iteration, mark everything as ready to draw (solid color).
1140 if (i == 1) { 1140 if (i == 1) {
1141 ManagedTileState::DrawInfo& draw_info = last_tile->draw_info(); 1141 TileDrawInfo& draw_info = last_tile->draw_info();
1142 draw_info.SetSolidColorForTesting(SK_ColorRED); 1142 draw_info.SetSolidColorForTesting(SK_ColorRED);
1143 } 1143 }
1144 ++it; 1144 ++it;
1145 int eventually_bin_order_correct_count = 0; 1145 int eventually_bin_order_correct_count = 0;
1146 int eventually_bin_order_incorrect_count = 0; 1146 int eventually_bin_order_incorrect_count = 0;
1147 while (it) { 1147 while (it) {
1148 Tile* new_tile = *it; 1148 Tile* new_tile = *it;
1149 ++it; 1149 ++it;
1150 unique_tiles.insert(new_tile); 1150 unique_tiles.insert(new_tile);
1151 1151
(...skipping 15 matching lines...) Expand all
1167 EXPECT_EQ(TilePriority::SOON, new_priority.priority_bin); 1167 EXPECT_EQ(TilePriority::SOON, new_priority.priority_bin);
1168 } 1168 }
1169 } 1169 }
1170 have_tiles[new_priority.priority_bin] = true; 1170 have_tiles[new_priority.priority_bin] = true;
1171 1171
1172 last_tile = new_tile; 1172 last_tile = new_tile;
1173 1173
1174 // On the second iteration, mark everything as ready to draw (solid 1174 // On the second iteration, mark everything as ready to draw (solid
1175 // color). 1175 // color).
1176 if (i == 1) { 1176 if (i == 1) {
1177 ManagedTileState::DrawInfo& draw_info = last_tile->draw_info(); 1177 TileDrawInfo& draw_info = last_tile->draw_info();
1178 draw_info.SetSolidColorForTesting(SK_ColorRED); 1178 draw_info.SetSolidColorForTesting(SK_ColorRED);
1179 } 1179 }
1180 } 1180 }
1181 1181
1182 EXPECT_GT(eventually_bin_order_correct_count, 1182 EXPECT_GT(eventually_bin_order_correct_count,
1183 eventually_bin_order_incorrect_count); 1183 eventually_bin_order_incorrect_count);
1184 1184
1185 // We should have now and eventually tiles, as well as soon tiles from 1185 // We should have now and eventually tiles, as well as soon tiles from
1186 // the border region. 1186 // the border region.
1187 EXPECT_TRUE(have_tiles[TilePriority::NOW]); 1187 EXPECT_TRUE(have_tiles[TilePriority::NOW]);
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 tiling_->Resize(gfx::Size(250, 150)); 2081 tiling_->Resize(gfx::Size(250, 150));
2082 2082
2083 // Tile size in the tiling should be resized to 250x200. 2083 // Tile size in the tiling should be resized to 250x200.
2084 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width()); 2084 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width());
2085 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height()); 2085 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height());
2086 EXPECT_EQ(0u, tiling_->AllRefTilesForTesting().size()); 2086 EXPECT_EQ(0u, tiling_->AllRefTilesForTesting().size());
2087 } 2087 }
2088 2088
2089 } // namespace 2089 } // namespace
2090 } // namespace cc 2090 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698