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

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: fix trailing_underscore_ and remove duplicated function. 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 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 } 1120 }
1121 1121
1122 EXPECT_TRUE(it); 1122 EXPECT_TRUE(it);
1123 std::set<Tile*> unique_tiles; 1123 std::set<Tile*> unique_tiles;
1124 unique_tiles.insert(*it); 1124 unique_tiles.insert(*it);
1125 Tile* last_tile = *it; 1125 Tile* last_tile = *it;
1126 have_tiles[last_tile->priority(ACTIVE_TREE).priority_bin] = true; 1126 have_tiles[last_tile->priority(ACTIVE_TREE).priority_bin] = true;
1127 1127
1128 // On the second iteration, mark everything as ready to draw (solid color). 1128 // On the second iteration, mark everything as ready to draw (solid color).
1129 if (i == 1) { 1129 if (i == 1) {
1130 ManagedTileState::DrawInfo& draw_info = last_tile->draw_info(); 1130 TileDrawInfo& draw_info = last_tile->draw_info();
1131 draw_info.SetSolidColorForTesting(SK_ColorRED); 1131 draw_info.SetSolidColorForTesting(SK_ColorRED);
1132 } 1132 }
1133 ++it; 1133 ++it;
1134 int eventually_bin_order_correct_count = 0; 1134 int eventually_bin_order_correct_count = 0;
1135 int eventually_bin_order_incorrect_count = 0; 1135 int eventually_bin_order_incorrect_count = 0;
1136 while (it) { 1136 while (it) {
1137 Tile* new_tile = *it; 1137 Tile* new_tile = *it;
1138 ++it; 1138 ++it;
1139 unique_tiles.insert(new_tile); 1139 unique_tiles.insert(new_tile);
1140 1140
(...skipping 15 matching lines...) Expand all
1156 EXPECT_EQ(TilePriority::SOON, new_priority.priority_bin); 1156 EXPECT_EQ(TilePriority::SOON, new_priority.priority_bin);
1157 } 1157 }
1158 } 1158 }
1159 have_tiles[new_priority.priority_bin] = true; 1159 have_tiles[new_priority.priority_bin] = true;
1160 1160
1161 last_tile = new_tile; 1161 last_tile = new_tile;
1162 1162
1163 // On the second iteration, mark everything as ready to draw (solid 1163 // On the second iteration, mark everything as ready to draw (solid
1164 // color). 1164 // color).
1165 if (i == 1) { 1165 if (i == 1) {
1166 ManagedTileState::DrawInfo& draw_info = last_tile->draw_info(); 1166 TileDrawInfo& draw_info = last_tile->draw_info();
1167 draw_info.SetSolidColorForTesting(SK_ColorRED); 1167 draw_info.SetSolidColorForTesting(SK_ColorRED);
1168 } 1168 }
1169 } 1169 }
1170 1170
1171 EXPECT_GT(eventually_bin_order_correct_count, 1171 EXPECT_GT(eventually_bin_order_correct_count,
1172 eventually_bin_order_incorrect_count); 1172 eventually_bin_order_incorrect_count);
1173 1173
1174 // We should have now and eventually tiles, as well as soon tiles from 1174 // We should have now and eventually tiles, as well as soon tiles from
1175 // the border region. 1175 // the border region.
1176 EXPECT_TRUE(have_tiles[TilePriority::NOW]); 1176 EXPECT_TRUE(have_tiles[TilePriority::NOW]);
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 tiling_->Resize(gfx::Size(250, 150)); 2021 tiling_->Resize(gfx::Size(250, 150));
2022 2022
2023 // Tile size in the tiling should be resized to 250x200. 2023 // Tile size in the tiling should be resized to 250x200.
2024 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width()); 2024 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width());
2025 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height()); 2025 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height());
2026 EXPECT_EQ(0u, tiling_->AllRefTilesForTesting().size()); 2026 EXPECT_EQ(0u, tiling_->AllRefTilesForTesting().size());
2027 } 2027 }
2028 2028
2029 } // namespace 2029 } // namespace
2030 } // namespace cc 2030 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698