Index: cc/layer_unittest.cc |
diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc |
index c3c20136cbfd85ef365d90995719de9657b96752..d860c685849ace291fda0c984fd345cc09303f44 100644 |
--- a/cc/layer_unittest.cc |
+++ b/cc/layer_unittest.cc |
@@ -10,6 +10,7 @@ |
#include "cc/layer_tree_host.h" |
#include "cc/math_util.h" |
#include "cc/single_thread_proxy.h" |
+#include "cc/test/animation_test_common.h" |
#include "cc/test/fake_impl_proxy.h" |
#include "cc/test/fake_layer_tree_host_client.h" |
#include "cc/test/fake_layer_tree_host_impl.h" |
@@ -643,6 +644,61 @@ TEST_F(LayerTest, verifyPushPropertiesCausesSurfacePropertyChangedForOpacity) |
EXPECT_TRUE(implLayer->layerSurfacePropertyChanged()); |
} |
+TEST_F(LayerTest, verifyPushPropertiesDoesNotCauseSurfacePropertyChangedDuringImplOnlyTransformAnimation) |
+{ |
+ scoped_refptr<Layer> testLayer = Layer::create(); |
+ scoped_ptr<LayerImpl> implLayer = LayerImpl::create(m_hostImpl.activeTree(), 1); |
+ |
+ scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::create(); |
+ implLayer->layerAnimationController()->setAnimationRegistrar(registrar.get()); |
+ |
+ addAnimatedTransformToController(*implLayer->layerAnimationController(), 1.0, 0, 100); |
+ |
+ gfx::Transform transform; |
+ transform.Rotate(45.0); |
+ testLayer->setTransform(transform); |
+ |
+ EXPECT_FALSE(implLayer->layerSurfacePropertyChanged()); |
+ testLayer->pushPropertiesTo(implLayer.get()); |
+ EXPECT_TRUE(implLayer->layerSurfacePropertyChanged()); |
+ |
+ implLayer->resetAllChangeTrackingForSubtree(); |
+ addAnimatedTransformToController(*implLayer->layerAnimationController(), 1.0, 0, 100); |
+ implLayer->layerAnimationController()->getAnimation(Animation::Transform)->setIsImplOnly(true); |
+ transform.Rotate(45.0); |
+ testLayer->setTransform(transform); |
+ |
+ EXPECT_FALSE(implLayer->layerSurfacePropertyChanged()); |
+ testLayer->pushPropertiesTo(implLayer.get()); |
+ EXPECT_FALSE(implLayer->layerSurfacePropertyChanged()); |
+} |
+ |
+TEST_F(LayerTest, verifyPushPropertiesDoesNotCauseSurfacePropertyChangedDuringImplOnlyOpacityAnimation) |
+{ |
+ scoped_refptr<Layer> testLayer = Layer::create(); |
+ scoped_ptr<LayerImpl> implLayer = LayerImpl::create(m_hostImpl.activeTree(), 1); |
+ |
+ scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::create(); |
+ implLayer->layerAnimationController()->setAnimationRegistrar(registrar.get()); |
+ |
+ addOpacityTransitionToController(*implLayer->layerAnimationController(), 1.0, 0.3f, 0.7f, false); |
+ |
+ testLayer->setOpacity(0.5f); |
+ |
+ EXPECT_FALSE(implLayer->layerSurfacePropertyChanged()); |
+ testLayer->pushPropertiesTo(implLayer.get()); |
+ EXPECT_TRUE(implLayer->layerSurfacePropertyChanged()); |
+ |
+ implLayer->resetAllChangeTrackingForSubtree(); |
+ addOpacityTransitionToController(*implLayer->layerAnimationController(), 1.0, 0.3f, 0.7f, false); |
+ implLayer->layerAnimationController()->getAnimation(Animation::Opacity)->setIsImplOnly(true); |
+ testLayer->setOpacity(0.75f); |
+ |
+ EXPECT_FALSE(implLayer->layerSurfacePropertyChanged()); |
+ testLayer->pushPropertiesTo(implLayer.get()); |
+ EXPECT_FALSE(implLayer->layerSurfacePropertyChanged()); |
+} |
+ |
TEST_F(LayerTest, maskAndReplicaHasParent) |
{ |
scoped_refptr<Layer> parent = Layer::create(); |