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

Unified Diff: cc/resources/picture_layer_tiling_set_unittest.cc

Issue 820703002: c:: Give the raster source to the PictureLayerTilings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/picture_layer_tiling_set.cc ('k') | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_layer_tiling_set_unittest.cc
diff --git a/cc/resources/picture_layer_tiling_set_unittest.cc b/cc/resources/picture_layer_tiling_set_unittest.cc
index 40b566a0672fc9629606f35a8f5130626cef5436..1745d47819b38db95790e1c75cf5790a5541154c 100644
--- a/cc/resources/picture_layer_tiling_set_unittest.cc
+++ b/cc/resources/picture_layer_tiling_set_unittest.cc
@@ -34,9 +34,12 @@ TEST(PictureLayerTilingSetTest, NoResources) {
auto set = CreateTilingSet(&client);
client.SetTileSize(gfx::Size(256, 256));
- set->AddTiling(1.0, layer_bounds);
- set->AddTiling(1.5, layer_bounds);
- set->AddTiling(2.0, layer_bounds);
+ auto pile =
tfarina 2014/12/19 17:18:11 I know auto is allowed now that we are using C++11
danakj 2014/12/19 17:22:07 FWIW Foo::Create() methods always return smart poi
enne (OOO) 2014/12/19 18:02:55 +1 to auto
tfarina 2014/12/19 18:11:34 Ouch :(
danakj 2014/12/19 18:26:11 Sorry :/ Thank you for bringing it up, we need to
+ FakePicturePileImpl::CreateEmptyPileWithDefaultTileSize(layer_bounds);
+
+ set->AddTiling(1.0, pile);
+ set->AddTiling(1.5, pile);
+ set->AddTiling(2.0, pile);
float contents_scale = 2.0;
gfx::Size content_bounds(
@@ -69,14 +72,17 @@ TEST(PictureLayerTilingSetTest, TilingRange) {
PictureLayerTiling* high_res_tiling;
PictureLayerTiling* low_res_tiling;
+ auto pile =
+ FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds);
+
auto set = CreateTilingSet(&client);
- set->AddTiling(2.0, layer_bounds);
- high_res_tiling = set->AddTiling(1.0, layer_bounds);
+ set->AddTiling(2.0, pile);
+ high_res_tiling = set->AddTiling(1.0, pile);
high_res_tiling->set_resolution(HIGH_RESOLUTION);
- set->AddTiling(0.5, layer_bounds);
- low_res_tiling = set->AddTiling(0.25, layer_bounds);
+ set->AddTiling(0.5, pile);
+ low_res_tiling = set->AddTiling(0.25, pile);
low_res_tiling->set_resolution(LOW_RESOLUTION);
- set->AddTiling(0.125, layer_bounds);
+ set->AddTiling(0.125, pile);
higher_than_high_res_range =
set->GetTilingRange(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES);
@@ -102,11 +108,11 @@ TEST(PictureLayerTilingSetTest, TilingRange) {
EXPECT_EQ(5u, lower_than_low_res_range.end);
auto set_without_low_res = CreateTilingSet(&client);
- set_without_low_res->AddTiling(2.0, layer_bounds);
- high_res_tiling = set_without_low_res->AddTiling(1.0, layer_bounds);
+ set_without_low_res->AddTiling(2.0, pile);
+ high_res_tiling = set_without_low_res->AddTiling(1.0, pile);
high_res_tiling->set_resolution(HIGH_RESOLUTION);
- set_without_low_res->AddTiling(0.5, layer_bounds);
- set_without_low_res->AddTiling(0.25, layer_bounds);
+ set_without_low_res->AddTiling(0.5, pile);
+ set_without_low_res->AddTiling(0.25, pile);
higher_than_high_res_range = set_without_low_res->GetTilingRange(
PictureLayerTilingSet::HIGHER_THAN_HIGH_RES);
@@ -132,10 +138,9 @@ TEST(PictureLayerTilingSetTest, TilingRange) {
EXPECT_EQ(0u, lower_than_low_res_range.end - lower_than_low_res_range.start);
auto set_with_only_high_and_low_res = CreateTilingSet(&client);
- high_res_tiling =
- set_with_only_high_and_low_res->AddTiling(1.0, layer_bounds);
+ high_res_tiling = set_with_only_high_and_low_res->AddTiling(1.0, pile);
high_res_tiling->set_resolution(HIGH_RESOLUTION);
- low_res_tiling = set_with_only_high_and_low_res->AddTiling(0.5, layer_bounds);
+ low_res_tiling = set_with_only_high_and_low_res->AddTiling(0.5, pile);
low_res_tiling->set_resolution(LOW_RESOLUTION);
higher_than_high_res_range = set_with_only_high_and_low_res->GetTilingRange(
@@ -164,7 +169,7 @@ TEST(PictureLayerTilingSetTest, TilingRange) {
EXPECT_EQ(0u, lower_than_low_res_range.end - lower_than_low_res_range.start);
auto set_with_only_high_res = CreateTilingSet(&client);
- high_res_tiling = set_with_only_high_res->AddTiling(1.0, layer_bounds);
+ high_res_tiling = set_with_only_high_res->AddTiling(1.0, pile);
high_res_tiling->set_resolution(HIGH_RESOLUTION);
higher_than_high_res_range = set_with_only_high_res->GetTilingRange(
@@ -220,10 +225,12 @@ class PictureLayerTilingSetTestWithResources : public testing::Test {
client.set_tree(PENDING_TREE);
gfx::Size layer_bounds(1000, 800);
auto set = CreateTilingSet(&client);
+ auto pile =
+ FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds);
float scale = min_scale;
for (int i = 0; i < num_tilings; ++i, scale += scale_increment) {
- PictureLayerTiling* tiling = set->AddTiling(scale, layer_bounds);
+ PictureLayerTiling* tiling = set->AddTiling(scale, pile);
tiling->CreateAllTilesForTesting();
std::vector<Tile*> tiles = tiling->AllTilesForTesting();
client.tile_manager()->InitializeTilesWithResourcesForTesting(tiles);
@@ -298,14 +305,14 @@ TEST(PictureLayerTilingSetTest, TileSizeChange) {
gfx::Size layer_bounds(100, 100);
auto pile =
- FakePicturePileImpl::CreateEmptyPile(gfx::Size(77, 77), layer_bounds);
+ FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds);
gfx::Size tile_size1(10, 10);
gfx::Size tile_size2(30, 30);
gfx::Size tile_size3(20, 20);
pending_client.SetTileSize(tile_size1);
- pending_set->AddTiling(1.f, layer_bounds);
+ pending_set->AddTiling(1.f, pile);
// New tilings get the correct tile size.
EXPECT_EQ(tile_size1, pending_set->tiling_at(0)->tile_size());
@@ -399,12 +406,12 @@ TEST(PictureLayerTilingSetTest, MaxContentScale) {
gfx::Size layer_bounds(100, 105);
auto pile =
- FakePicturePileImpl::CreateEmptyPile(gfx::Size(77, 77), layer_bounds);
+ FakePicturePileImpl::CreateEmptyPileWithDefaultTileSize(layer_bounds);
// Tilings can be added of any scale, the tiling client can controls this.
- pending_set->AddTiling(1.f, layer_bounds);
- pending_set->AddTiling(2.f, layer_bounds);
- pending_set->AddTiling(3.f, layer_bounds);
+ pending_set->AddTiling(1.f, pile);
+ pending_set->AddTiling(2.f, pile);
+ pending_set->AddTiling(3.f, pile);
// Set some expected things for the tiling set to function.
pending_set->tiling_at(0)->set_resolution(HIGH_RESOLUTION);
« no previous file with comments | « cc/resources/picture_layer_tiling_set.cc ('k') | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698