OLD | NEW |
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 TileVector never_bin = CreateTiles(1, TilePriority(), TilePriority()); | 195 TileVector never_bin = CreateTiles(1, TilePriority(), TilePriority()); |
196 | 196 |
197 tile_manager()->AssignMemoryToTiles(global_state_); | 197 tile_manager()->AssignMemoryToTiles(global_state_); |
198 | 198 |
199 EXPECT_EQ(3, AssignedMemoryCount(active_now)); | 199 EXPECT_EQ(3, AssignedMemoryCount(active_now)); |
200 EXPECT_EQ(3, AssignedMemoryCount(pending_now)); | 200 EXPECT_EQ(3, AssignedMemoryCount(pending_now)); |
201 EXPECT_EQ(3, AssignedMemoryCount(active_pending_soon)); | 201 EXPECT_EQ(3, AssignedMemoryCount(active_pending_soon)); |
202 EXPECT_EQ(0, AssignedMemoryCount(never_bin)); | 202 EXPECT_EQ(0, AssignedMemoryCount(never_bin)); |
203 } | 203 } |
204 | 204 |
| 205 TEST_P(TileManagerTest, EnoughMemoryPendingLowResAllowAbsoluteMinimum) { |
| 206 // A few low-res tiles required for activation, with enough memory for all |
| 207 // tiles. |
| 208 |
| 209 Initialize(5, ALLOW_ABSOLUTE_MINIMUM, SAME_PRIORITY_FOR_BOTH_TREES); |
| 210 TileVector pending_low_res = |
| 211 CreateTiles(5, TilePriority(), TilePriorityLowRes()); |
| 212 |
| 213 tile_manager()->AssignMemoryToTiles(global_state_); |
| 214 |
| 215 EXPECT_EQ(5, AssignedMemoryCount(pending_low_res)); |
| 216 } |
| 217 |
205 TEST_P(TileManagerTest, EnoughMemoryAllowAbsoluteMinimum) { | 218 TEST_P(TileManagerTest, EnoughMemoryAllowAbsoluteMinimum) { |
206 // A few tiles of each type of priority, with enough memory for all tiles, | 219 // A few tiles of each type of priority, with enough memory for all tiles, |
207 // with the exception of never and soon bins. | 220 // with the exception of never and soon bins. |
208 | 221 |
209 Initialize(10, ALLOW_ABSOLUTE_MINIMUM, SMOOTHNESS_TAKES_PRIORITY); | 222 Initialize(10, ALLOW_ABSOLUTE_MINIMUM, SMOOTHNESS_TAKES_PRIORITY); |
210 TileVector active_now = | 223 TileVector active_now = |
211 CreateTiles(3, TilePriorityForNowBin(), TilePriority()); | 224 CreateTiles(3, TilePriorityForNowBin(), TilePriority()); |
212 TileVector pending_now = | 225 TileVector pending_now = |
213 CreateTiles(3, TilePriority(), TilePriorityForNowBin()); | 226 CreateTiles(3, TilePriority(), TilePriorityForNowBin()); |
214 TileVector active_pending_soon = | 227 TileVector active_pending_soon = |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 | 1146 |
1134 last_tile = tile; | 1147 last_tile = tile; |
1135 new_content_tiles.insert(tile); | 1148 new_content_tiles.insert(tile); |
1136 } | 1149 } |
1137 | 1150 |
1138 EXPECT_EQ(tile_count, new_content_tiles.size()); | 1151 EXPECT_EQ(tile_count, new_content_tiles.size()); |
1139 EXPECT_EQ(all_tiles, new_content_tiles); | 1152 EXPECT_EQ(all_tiles, new_content_tiles); |
1140 } | 1153 } |
1141 } // namespace | 1154 } // namespace |
1142 } // namespace cc | 1155 } // namespace cc |
OLD | NEW |