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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 642983003: cc: Make PictureLayerImpl use a better choice for animated raster scale. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: animationscale: fixtest Created 6 years, 2 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/animation_test_common.h » ('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 3ceb79bc34acf91037a3d69526181b8eeae1d25d..11a84b0e7a848f4a35b75b0c7a1643f55f9ef0bc 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -1095,6 +1095,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
// Page scale animation, new high res, but not new low res because animating.
contents_scale = 2.f;
page_scale = 2.f;
+ maximum_animation_scale = 2.f;
animating_transform = true;
SetContentsScaleOnBothLayers(contents_scale,
device_scale,
@@ -2380,7 +2381,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) {
EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
// When animating with an unknown maximum animation scale factor, a new
- // high-res tiling should be created at the animation's initial scale.
+ // high-res tiling should be created at a source scale of 1.
animating_transform = true;
contents_scale = 2.f;
maximum_animation_scale = 0.f;
@@ -2390,7 +2391,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) {
page_scale,
maximum_animation_scale,
animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale);
// Further changes to scale during the animation should not cause a new
// high-res tiling to get created.
@@ -2401,7 +2402,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) {
page_scale,
maximum_animation_scale,
animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale);
// Once we stop animating, a new high-res tiling should be created.
animating_transform = false;
@@ -2416,8 +2417,8 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) {
// When animating with a maxmium animation scale factor that is so large
// that the layer grows larger than the viewport at this scale, a new
- // high-res tiling should get created at the animation's initial scale, not
- // at its maximum scale.
+ // high-res tiling should get created at a source scale of 1, not at its
+ // maximum scale.
animating_transform = true;
contents_scale = 2.f;
maximum_animation_scale = 11.f;
@@ -2427,7 +2428,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) {
page_scale,
maximum_animation_scale,
animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale);
// Once we stop animating, a new high-res tiling should be created.
animating_transform = false;
@@ -2457,6 +2458,31 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) {
// Once we stop animating, a new high-res tiling should be created.
animating_transform = false;
+ contents_scale = 12.f;
+
+ SetContentsScaleOnBothLayers(contents_scale,
+ device_scale,
+ page_scale,
+ maximum_animation_scale,
+ animating_transform);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 12.f);
+
+ // When animating toward a smaller scale, but that is still so large that the
+ // layer grows larger than the viewport at this scale, a new high-res tiling
+ // should get created at source scale 1.
+ animating_transform = true;
+ contents_scale = 11.f;
+ maximum_animation_scale = 11.f;
+
+ SetContentsScaleOnBothLayers(contents_scale,
+ device_scale,
+ page_scale,
+ maximum_animation_scale,
+ animating_transform);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), device_scale * page_scale);
+
+ // Once we stop animating, a new high-res tiling should be created.
+ animating_transform = false;
contents_scale = 11.f;
SetContentsScaleOnBothLayers(contents_scale,
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/test/animation_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698