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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 260963008: Fixing crash in PictureLayerImpl::MarkVisibleResourcesAsRequired when low-res tiles are disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/test/fake_picture_layer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl_unittest.cc
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index c7a5900ca2e7b10a12a82dc43b215a39b08c3e0d..0bf351d37e4d06d38164a4f050ea263b3d21b3c4 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -703,13 +703,16 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
&result_scale_x,
&result_scale_y,
&result_bounds);
- ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
enne (OOO) 2014/05/02 17:03:16 Just make the test set the settings appropriately
Sergey 2014/05/07 02:34:25 Done.
+ pending_layer_->tilings()->num_tilings());
EXPECT_FLOAT_EQ(
1.3f,
pending_layer_->tilings()->tiling_at(0)->contents_scale());
- EXPECT_FLOAT_EQ(
- 1.3f * low_res_factor,
- pending_layer_->tilings()->tiling_at(1)->contents_scale());
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_FLOAT_EQ(
+ 1.3f * low_res_factor,
+ pending_layer_->tilings()->tiling_at(1)->contents_scale());
// If we change the layer's CSS scale factor, then we should not get new
// tilings.
@@ -721,13 +724,16 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
&result_scale_x,
&result_scale_y,
&result_bounds);
- ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ pending_layer_->tilings()->num_tilings());
EXPECT_FLOAT_EQ(
1.3f,
pending_layer_->tilings()->tiling_at(0)->contents_scale());
- EXPECT_FLOAT_EQ(
- 1.3f * low_res_factor,
- pending_layer_->tilings()->tiling_at(1)->contents_scale());
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_FLOAT_EQ(
+ 1.3f * low_res_factor,
+ pending_layer_->tilings()->tiling_at(1)->contents_scale());
// If we change the page scale factor, then we should get new tilings.
pending_layer_->CalculateContentsScale(1.8f, // ideal contents scale
@@ -738,13 +744,16 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
&result_scale_x,
&result_scale_y,
&result_bounds);
- ASSERT_EQ(4u, pending_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 4u : 2u,
+ pending_layer_->tilings()->num_tilings());
EXPECT_FLOAT_EQ(
1.8f,
pending_layer_->tilings()->tiling_at(0)->contents_scale());
- EXPECT_FLOAT_EQ(
- 1.8f * low_res_factor,
- pending_layer_->tilings()->tiling_at(2)->contents_scale());
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_FLOAT_EQ(
+ 1.8f * low_res_factor,
+ pending_layer_->tilings()->tiling_at(2)->contents_scale());
// If we change the device scale factor, then we should get new tilings.
pending_layer_->CalculateContentsScale(1.9f, // ideal contents scale
@@ -755,13 +764,16 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
&result_scale_x,
&result_scale_y,
&result_bounds);
- ASSERT_EQ(6u, pending_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 6u : 3u,
+ pending_layer_->tilings()->num_tilings());
EXPECT_FLOAT_EQ(
1.9f,
pending_layer_->tilings()->tiling_at(0)->contents_scale());
- EXPECT_FLOAT_EQ(
- 1.9f * low_res_factor,
- pending_layer_->tilings()->tiling_at(3)->contents_scale());
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_FLOAT_EQ(
+ 1.9f * low_res_factor,
+ pending_layer_->tilings()->tiling_at(3)->contents_scale());
// If we change the device scale factor, but end up at the same total scale
// factor somehow, then we don't get new tilings.
@@ -773,13 +785,16 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
&result_scale_x,
&result_scale_y,
&result_bounds);
- ASSERT_EQ(6u, pending_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 6u : 3u,
+ pending_layer_->tilings()->num_tilings());
EXPECT_FLOAT_EQ(
1.9f,
pending_layer_->tilings()->tiling_at(0)->contents_scale());
- EXPECT_FLOAT_EQ(
- 1.9f * low_res_factor,
- pending_layer_->tilings()->tiling_at(3)->contents_scale());
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_FLOAT_EQ(
+ 1.9f * low_res_factor,
+ pending_layer_->tilings()->tiling_at(3)->contents_scale());
}
TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) {
@@ -814,11 +829,14 @@ TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) {
&result_scale_x,
&result_scale_y,
&result_bounds);
- ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ pending_layer_->tilings()->num_tilings());
EXPECT_FLOAT_EQ(high_res_scale,
pending_layer_->HighResTiling()->contents_scale());
- EXPECT_FLOAT_EQ(low_res_scale,
- pending_layer_->LowResTiling()->contents_scale());
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_FLOAT_EQ(low_res_scale,
+ pending_layer_->LowResTiling()->contents_scale());
ActivateTree();
SetupPendingTree(empty_pile);
@@ -830,7 +848,9 @@ TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) {
&result_scale_x,
&result_scale_y,
&result_bounds);
- ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ active_layer_->tilings()->num_tilings());
ASSERT_EQ(0u, pending_layer_->tilings()->num_tilings());
ActivateTree();
@@ -853,12 +873,15 @@ TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) {
&result_scale_x,
&result_scale_y,
&result_bounds);
- ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ pending_layer_->tilings()->num_tilings());
ASSERT_EQ(0u, active_layer_->tilings()->num_tilings());
EXPECT_FLOAT_EQ(high_res_scale,
pending_layer_->HighResTiling()->contents_scale());
- EXPECT_FLOAT_EQ(low_res_scale,
- pending_layer_->LowResTiling()->contents_scale());
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_FLOAT_EQ(low_res_scale,
+ pending_layer_->LowResTiling()->contents_scale());
}
TEST_F(PictureLayerImplTest, ZoomOutCrash) {
@@ -894,13 +917,16 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) {
EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, 1.0f, false);
float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
- EXPECT_EQ(2u, active_layer_->tilings()->num_tilings());
+ EXPECT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ active_layer_->tilings()->num_tilings());
EXPECT_FLOAT_EQ(
1.0f,
active_layer_->tilings()->tiling_at(0)->contents_scale());
- EXPECT_FLOAT_EQ(
- 1.0f * low_res_factor,
- active_layer_->tilings()->tiling_at(1)->contents_scale());
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_FLOAT_EQ(
+ 1.0f * low_res_factor,
+ active_layer_->tilings()->tiling_at(1)->contents_scale());
// Start a pinch gesture.
host_impl_.PinchGestureBegin();
@@ -908,16 +934,19 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) {
// Zoom out by a small amount. We should create a tiling at half
// the scale (1/kMaxScaleRatioDuringPinch).
SetContentsScaleOnBothLayers(0.90f, 1.0f, 0.9f, 1.0f, false);
- EXPECT_EQ(3u, active_layer_->tilings()->num_tilings());
+ EXPECT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 3u : 2u,
+ active_layer_->tilings()->num_tilings());
EXPECT_FLOAT_EQ(
1.0f,
active_layer_->tilings()->tiling_at(0)->contents_scale());
EXPECT_FLOAT_EQ(
0.5f,
active_layer_->tilings()->tiling_at(1)->contents_scale());
- EXPECT_FLOAT_EQ(
- 1.0f * low_res_factor,
- active_layer_->tilings()->tiling_at(2)->contents_scale());
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_FLOAT_EQ(
+ 1.0f * low_res_factor,
+ active_layer_->tilings()->tiling_at(2)->contents_scale());
// Zoom out further, close to our low-res scale factor. We should
// use that tiling as high-res, and not create a new tiling.
@@ -962,39 +991,52 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
float page_scale = 3.2f;
SetContentsScaleOnBothLayers(1.f, device_scale, page_scale, 1.f, false);
- ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ active_layer_->tilings()->num_tilings());
// We only have ideal tilings, so they aren't removed.
used_tilings.clear();
active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
- ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ active_layer_->tilings()->num_tilings());
// Changing the ideal but not creating new tilings.
SetContentsScaleOnBothLayers(1.5f, device_scale, page_scale, 1.f, false);
- ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ active_layer_->tilings()->num_tilings());
// The tilings are still our target scale, so they aren't removed.
used_tilings.clear();
active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
- ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ active_layer_->tilings()->num_tilings());
// Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2.
page_scale = 1.2f;
SetContentsScaleOnBothLayers(1.2f, device_scale, page_scale, 1.f, false);
- ASSERT_EQ(4u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 4u : 2u,
+ active_layer_->tilings()->num_tilings());
EXPECT_FLOAT_EQ(
1.f,
active_layer_->tilings()->tiling_at(1)->contents_scale());
- EXPECT_FLOAT_EQ(
- 1.f * low_res_factor,
- active_layer_->tilings()->tiling_at(3)->contents_scale());
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_FLOAT_EQ(
+ 1.f * low_res_factor,
+ active_layer_->tilings()->tiling_at(3)->contents_scale());
// Mark the non-ideal tilings as used. They won't be removed.
used_tilings.clear();
used_tilings.push_back(active_layer_->tilings()->tiling_at(1));
used_tilings.push_back(active_layer_->tilings()->tiling_at(3));
active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
- ASSERT_EQ(4u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 4u : 2u,
+ active_layer_->tilings()->num_tilings());
// Now move the ideal scale to 0.5. Our target stays 1.2.
SetContentsScaleOnBothLayers(0.5f, device_scale, page_scale, 1.f, false);
@@ -1003,7 +1045,9 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
// removed. The low res tiling for the old ideal=1.0 scale is removed.
used_tilings.clear();
active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
- ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 3u : 2u,
+ active_layer_->tilings()->num_tilings());
// Now move the ideal scale to 1.0. Our target stays 1.2.
SetContentsScaleOnBothLayers(1.f, device_scale, page_scale, 1.f, false);
@@ -1012,7 +1056,9 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
// removed.
used_tilings.clear();
active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
- ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 3u : 2u,
+ active_layer_->tilings()->num_tilings());
// Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2.
active_layer_->CalculateContentsScale(1.1f,
@@ -1028,7 +1074,9 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
// in the range [1.0,1.2] and are kept.
used_tilings.clear();
active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
- ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 3u : 2u,
+ active_layer_->tilings()->num_tilings());
// Move the ideal scale on the pending layer to 1.1 as well. Our target stays
// 1.2 still.
@@ -1047,13 +1095,17 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
used_tilings.clear();
used_tilings.push_back(active_layer_->tilings()->tiling_at(1));
active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
- ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 3u : 2u,
+ active_layer_->tilings()->num_tilings());
// If we remove it from our used tilings set, it is outside the range to keep
// so it is deleted.
used_tilings.clear();
active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
- ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ active_layer_->tilings()->num_tilings());
}
#define EXPECT_BOTH_EQ(expression, x) \
@@ -1095,8 +1147,11 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
maximum_animation_scale,
animating_transform);
EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
- EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor);
- EXPECT_BOTH_EQ(num_tilings(), 2u);
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor);
+ EXPECT_BOTH_EQ(
+ num_tilings(),
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u);
// Page scale animation, new high res, but not new low res because animating.
contents_scale = 2.f;
@@ -1108,8 +1163,11 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
maximum_animation_scale,
animating_transform);
EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
- EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor);
- EXPECT_BOTH_EQ(num_tilings(), 3u);
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor);
+ EXPECT_BOTH_EQ(
+ num_tilings(),
+ host_impl_.settings().create_low_res_tiling ? 3u : 2u);
// Stop animating, new low res gets created for final page scale.
animating_transform = false;
@@ -1119,8 +1177,11 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
maximum_animation_scale,
animating_transform);
EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
- EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), 2.f * low_res_factor);
- EXPECT_BOTH_EQ(num_tilings(), 4u);
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), 2.f * low_res_factor);
+ EXPECT_BOTH_EQ(
+ num_tilings(),
+ host_impl_.settings().create_low_res_tiling ? 4u : 2u);
}
TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
@@ -1166,9 +1227,12 @@ TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
maximum_animation_scale,
animating_transform);
EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale);
- EXPECT_BOTH_EQ(LowResTiling()->contents_scale(),
- contents_scale * low_res_factor);
- EXPECT_BOTH_EQ(num_tilings(), 2u);
+ if (host_impl_.settings().create_low_res_tiling)
+ EXPECT_BOTH_EQ(LowResTiling()->contents_scale(),
+ contents_scale * low_res_factor);
+ EXPECT_BOTH_EQ(
+ num_tilings(),
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u);
ResetTilingsAndRasterScales();
@@ -1207,7 +1271,9 @@ TEST_F(PictureLayerImplTest, ReleaseResources) {
&result_scale_x,
&result_scale_y,
&result_bounds);
- EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings());
+ EXPECT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ pending_layer_->tilings()->num_tilings());
// All tilings should be removed when losing output surface.
active_layer_->ReleaseResources();
@@ -1224,7 +1290,9 @@ TEST_F(PictureLayerImplTest, ReleaseResources) {
&result_scale_x,
&result_scale_y,
&result_bounds);
- EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings());
+ EXPECT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ pending_layer_->tilings()->num_tilings());
}
TEST_F(PictureLayerImplTest, ClampTilesToToMaxTileSize) {
@@ -1251,7 +1319,9 @@ TEST_F(PictureLayerImplTest, ClampTilesToToMaxTileSize) {
&result_scale_x,
&result_scale_y,
&result_bounds);
- ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ pending_layer_->tilings()->num_tilings());
pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
@@ -1281,7 +1351,9 @@ TEST_F(PictureLayerImplTest, ClampTilesToToMaxTileSize) {
&result_scale_x,
&result_scale_y,
&result_bounds);
- ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ pending_layer_->tilings()->num_tilings());
pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
@@ -1477,6 +1549,7 @@ TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) {
TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) {
gfx::Size layer_bounds(400, 400);
gfx::Size tile_size(100, 100);
+
SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
// No tiles shared.
@@ -1490,7 +1563,8 @@ TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) {
// activate with all high res tiles.
pending_layer_->MarkVisibleResourcesAsRequired();
AssertAllTilesRequired(pending_layer_->HighResTiling());
- AssertNoTilesRequired(pending_layer_->LowResTiling());
+ if (host_impl_.settings().create_low_res_tiling)
+ AssertNoTilesRequired(pending_layer_->LowResTiling());
}
TEST_F(PictureLayerImplTest, HighResRequiredWhenMissingHighResFlagOn) {
@@ -1511,7 +1585,8 @@ TEST_F(PictureLayerImplTest, HighResRequiredWhenMissingHighResFlagOn) {
host_impl_.active_tree()->SetRequiresHighResToDraw();
pending_layer_->MarkVisibleResourcesAsRequired();
AssertAllTilesRequired(pending_layer_->HighResTiling());
- AssertNoTilesRequired(pending_layer_->LowResTiling());
+ if (host_impl_.settings().create_low_res_tiling)
+ AssertNoTilesRequired(pending_layer_->LowResTiling());
}
TEST_F(PictureLayerImplTest, NothingRequiredIfAllHighResTilesShared) {
@@ -1528,8 +1603,12 @@ TEST_F(PictureLayerImplTest, NothingRequiredIfAllHighResTilesShared) {
// All tiles shared (no invalidation), so even though the active tree's
// tiles aren't ready, there is nothing required.
pending_layer_->MarkVisibleResourcesAsRequired();
+ VLOG(0) << "NothingRequiredIfAllHighResTilesShared::AssertNoTilesRequired";
AssertNoTilesRequired(pending_layer_->HighResTiling());
- AssertNoTilesRequired(pending_layer_->LowResTiling());
+ if (host_impl_.settings().create_low_res_tiling) {
+ VLOG(0) << "NothingRequiredIfAllHighResTilesShared::AssertNoTilesRequired -> low-res";
+ AssertNoTilesRequired(pending_layer_->LowResTiling());
+ }
}
TEST_F(PictureLayerImplTest, NothingRequiredIfActiveMissingTiles) {
@@ -1552,14 +1631,17 @@ TEST_F(PictureLayerImplTest, NothingRequiredIfActiveMissingTiles) {
// Active layer has tilings, but no tiles due to missing recordings.
EXPECT_TRUE(active_layer_->CanHaveTilings());
- EXPECT_EQ(active_layer_->tilings()->num_tilings(), 2u);
+ EXPECT_EQ(
+ active_layer_->tilings()->num_tilings(),
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u);
EXPECT_EQ(active_layer_->HighResTiling()->AllTilesForTesting().size(), 0u);
// Since the active layer has no tiles at all, the pending layer doesn't
// need content in order to activate.
pending_layer_->MarkVisibleResourcesAsRequired();
AssertNoTilesRequired(pending_layer_->HighResTiling());
- AssertNoTilesRequired(pending_layer_->LowResTiling());
+ if (host_impl_.settings().create_low_res_tiling)
+ AssertNoTilesRequired(pending_layer_->LowResTiling());
}
TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) {
@@ -1584,7 +1666,8 @@ TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) {
// not being able to have content to having content.
pending_layer_->MarkVisibleResourcesAsRequired();
AssertAllTilesRequired(pending_layer_->HighResTiling());
- AssertNoTilesRequired(pending_layer_->LowResTiling());
+ if (host_impl_.settings().create_low_res_tiling)
+ AssertNoTilesRequired(pending_layer_->LowResTiling());
}
TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) {
@@ -1705,7 +1788,9 @@ TEST_F(PictureLayerImplTest, NoLowResTilingWithGpuRasterization) {
&result_scale_y,
&result_bounds);
// Should have a low-res and a high-res tiling.
- ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
+ ASSERT_EQ(
+ host_impl_.settings().create_low_res_tiling ? 2u : 1u,
+ pending_layer_->tilings()->num_tilings());
pending_layer_->SetUseGpuRasterization(true);
EXPECT_TRUE(pending_layer_->ShouldUseGpuRasterization());
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/test/fake_picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698