Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / cc / animation / layer_animation_controller_unittest.cc
index 3f8a89f..49ac0a5 100644 (file)
@@ -14,7 +14,7 @@
 #include "cc/test/animation_test_common.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/box_f.h"
+#include "ui/gfx/geometry/box_f.h"
 #include "ui/gfx/transform.h"
 
 namespace cc {
@@ -107,7 +107,7 @@ TEST(LayerAnimationControllerTest, DoNotClobberStartTimes) {
 
   // Start the animation on the main thread. Should not affect the start time.
   controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_EQ(controller->GetAnimation(group_id,
                                      Animation::Opacity)->start_time(),
             controller_impl->GetAnimation(group_id,
@@ -156,7 +156,7 @@ TEST(LayerAnimationControllerTest, UseSpecifiedStartTimes) {
 
   // Start the animation on the main thread. Should not affect the start time.
   controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_EQ(start_time,
             controller->GetAnimation(group_id,
                                      Animation::Opacity)->start_time());
@@ -210,11 +210,11 @@ TEST(LayerAnimationControllerTest, Activation) {
   EXPECT_EQ(1u, registrar_impl->active_animation_controllers().size());
 
   controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_EQ(1u, registrar->active_animation_controllers().size());
 
   controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_EQ(Animation::Finished,
             controller->GetAnimation(Animation::Opacity)->run_state());
   EXPECT_EQ(1u, registrar->active_animation_controllers().size());
@@ -232,7 +232,7 @@ TEST(LayerAnimationControllerTest, Activation) {
   EXPECT_EQ(1u, events->size());
   controller->NotifyAnimationFinished((*events)[0]);
   controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1500));
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
 
   EXPECT_EQ(Animation::WaitingForDeletion,
             controller->GetAnimation(Animation::Opacity)->run_state());
@@ -246,8 +246,8 @@ TEST(LayerAnimationControllerTest, Activation) {
   EXPECT_EQ(0u, registrar->active_animation_controllers().size());
   EXPECT_EQ(0u, registrar_impl->active_animation_controllers().size());
 
-  controller->SetAnimationRegistrar(NULL);
-  controller_impl->SetAnimationRegistrar(NULL);
+  controller->SetAnimationRegistrar(nullptr);
+  controller_impl->SetAnimationRegistrar(nullptr);
 }
 
 TEST(LayerAnimationControllerTest, SyncPause) {
@@ -279,7 +279,7 @@ TEST(LayerAnimationControllerTest, SyncPause) {
   controller_impl->Animate(kInitialTickTime);
   controller_impl->UpdateState(true, &events);
   controller->Animate(kInitialTickTime);
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_EQ(Animation::Running,
             controller_impl->GetAnimation(group_id,
                                           Animation::Opacity)->run_state());
@@ -364,7 +364,7 @@ TEST(LayerAnimationControllerTest, AnimationsAreDeleted) {
 
   AddOpacityTransitionToController(controller.get(), 1.0, 0.0f, 1.0f, false);
   controller->Animate(kInitialTickTime);
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   controller->PushAnimationUpdatesTo(controller_impl.get());
   controller_impl->ActivateAnimations();
 
@@ -377,7 +377,7 @@ TEST(LayerAnimationControllerTest, AnimationsAreDeleted) {
   controller->NotifyAnimationStarted((*events)[0]);
 
   controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
 
   EXPECT_FALSE(dummy.animation_waiting_for_deletion());
   EXPECT_FALSE(dummy_impl.animation_waiting_for_deletion());
@@ -400,7 +400,7 @@ TEST(LayerAnimationControllerTest, AnimationsAreDeleted) {
   controller->NotifyAnimationFinished((*events)[0]);
 
   controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(3000));
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_TRUE(dummy.animation_waiting_for_deletion());
 
   controller->PushAnimationUpdatesTo(controller_impl.get());
@@ -510,14 +510,12 @@ TEST(LayerAnimationControllerTest, TrivialTransformOnImpl) {
 
   // Create simple Transform animation.
   TransformOperations operations;
-  curve->AddKeyframe(
-      TransformKeyframe::Create(0, operations, scoped_ptr<TimingFunction>()));
+  curve->AddKeyframe(TransformKeyframe::Create(0, operations, nullptr));
   operations.AppendTranslate(delta_x, delta_y, 0);
-  curve->AddKeyframe(
-      TransformKeyframe::Create(1, operations, scoped_ptr<TimingFunction>()));
+  curve->AddKeyframe(TransformKeyframe::Create(1, operations, nullptr));
 
-  scoped_ptr<Animation> animation(Animation::Create(
-      curve.PassAs<AnimationCurve>(), 1, 0, Animation::Transform));
+  scoped_ptr<Animation> animation(
+      Animation::Create(curve.Pass(), 1, 0, Animation::Transform));
   animation->set_is_impl_only(true);
   controller_impl->AddAnimation(animation.Pass());
 
@@ -561,15 +559,13 @@ TEST(LayerAnimationControllerTest, FilterTransition) {
 
   FilterOperations start_filters;
   start_filters.Append(FilterOperation::CreateBrightnessFilter(1.f));
-  curve->AddKeyframe(
-      FilterKeyframe::Create(0, start_filters, scoped_ptr<TimingFunction>()));
+  curve->AddKeyframe(FilterKeyframe::Create(0, start_filters, nullptr));
   FilterOperations end_filters;
   end_filters.Append(FilterOperation::CreateBrightnessFilter(2.f));
-  curve->AddKeyframe(
-      FilterKeyframe::Create(1, end_filters, scoped_ptr<TimingFunction>()));
+  curve->AddKeyframe(FilterKeyframe::Create(1, end_filters, nullptr));
 
-  scoped_ptr<Animation> animation(Animation::Create(
-      curve.PassAs<AnimationCurve>(), 1, 0, Animation::Filter));
+  scoped_ptr<Animation> animation(
+      Animation::Create(curve.Pass(), 1, 0, Animation::Filter));
   controller->AddAnimation(animation.Pass());
 
   controller->Animate(kInitialTickTime);
@@ -610,15 +606,13 @@ TEST(LayerAnimationControllerTest, FilterTransitionOnImplOnly) {
   // Create simple Filter animation.
   FilterOperations start_filters;
   start_filters.Append(FilterOperation::CreateBrightnessFilter(1.f));
-  curve->AddKeyframe(
-      FilterKeyframe::Create(0, start_filters, scoped_ptr<TimingFunction>()));
+  curve->AddKeyframe(FilterKeyframe::Create(0, start_filters, nullptr));
   FilterOperations end_filters;
   end_filters.Append(FilterOperation::CreateBrightnessFilter(2.f));
-  curve->AddKeyframe(
-      FilterKeyframe::Create(1, end_filters, scoped_ptr<TimingFunction>()));
+  curve->AddKeyframe(FilterKeyframe::Create(1, end_filters, nullptr));
 
-  scoped_ptr<Animation> animation(Animation::Create(
-      curve.PassAs<AnimationCurve>(), 1, 0, Animation::Filter));
+  scoped_ptr<Animation> animation(
+      Animation::Create(curve.Pass(), 1, 0, Animation::Filter));
   animation->set_is_impl_only(true);
   controller_impl->AddAnimation(animation.Pass());
 
@@ -663,15 +657,15 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransition) {
   controller->AddValueObserver(&dummy);
   controller->set_value_provider(&dummy_provider);
 
-  gfx::Vector2dF initial_value(100.f, 300.f);
-  gfx::Vector2dF target_value(300.f, 200.f);
+  gfx::ScrollOffset initial_value(100.f, 300.f);
+  gfx::ScrollOffset target_value(300.f, 200.f);
   scoped_ptr<ScrollOffsetAnimationCurve> curve(
       ScrollOffsetAnimationCurve::Create(
           target_value,
           EaseInOutTimingFunction::Create().Pass()));
 
-  scoped_ptr<Animation> animation(Animation::Create(
-      curve.PassAs<AnimationCurve>(), 1, 0, Animation::ScrollOffset));
+  scoped_ptr<Animation> animation(
+      Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset));
   animation->set_needs_synchronized_start_time(true);
   controller->AddAnimation(animation.Pass());
 
@@ -690,7 +684,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransition) {
       controller->GetAnimation(Animation::ScrollOffset)->curve()->Duration());
 
   controller->Animate(kInitialTickTime);
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_TRUE(controller->HasActiveAnimation());
   EXPECT_EQ(initial_value, dummy.scroll_offset());
 
@@ -704,7 +698,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransition) {
 
   controller->NotifyAnimationStarted((*events)[0]);
   controller->Animate(kInitialTickTime + duration / 2);
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_TRUE(controller->HasActiveAnimation());
   EXPECT_VECTOR2DF_EQ(gfx::Vector2dF(200.f, 250.f), dummy.scroll_offset());
 
@@ -723,7 +717,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransition) {
   EXPECT_FALSE(event);
 
   controller->Animate(kInitialTickTime + duration);
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_VECTOR2DF_EQ(target_value, dummy.scroll_offset());
   EXPECT_FALSE(controller->HasActiveAnimation());
 }
@@ -745,15 +739,15 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionNoImplProvider) {
   controller->AddValueObserver(&dummy);
   controller->set_value_provider(&dummy_provider);
 
-  gfx::Vector2dF initial_value(500.f, 100.f);
-  gfx::Vector2dF target_value(300.f, 200.f);
+  gfx::ScrollOffset initial_value(500.f, 100.f);
+  gfx::ScrollOffset target_value(300.f, 200.f);
   scoped_ptr<ScrollOffsetAnimationCurve> curve(
       ScrollOffsetAnimationCurve::Create(
           target_value,
           EaseInOutTimingFunction::Create().Pass()));
 
-  scoped_ptr<Animation> animation(Animation::Create(
-      curve.PassAs<AnimationCurve>(), 1, 0, Animation::ScrollOffset));
+  scoped_ptr<Animation> animation(
+      Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset));
   animation->set_needs_synchronized_start_time(true);
   controller->AddAnimation(animation.Pass());
 
@@ -770,7 +764,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionNoImplProvider) {
       controller->GetAnimation(Animation::ScrollOffset)->curve()->Duration());
 
   controller->Animate(kInitialTickTime);
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_TRUE(controller->HasActiveAnimation());
   EXPECT_EQ(initial_value, dummy.scroll_offset());
 
@@ -787,7 +781,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionNoImplProvider) {
 
   controller->NotifyAnimationStarted((*events)[0]);
   controller->Animate(kInitialTickTime + duration / 2);
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_TRUE(controller->HasActiveAnimation());
   EXPECT_VECTOR2DF_EQ(gfx::Vector2dF(400.f, 150.f), dummy.scroll_offset());
 
@@ -806,7 +800,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionNoImplProvider) {
   EXPECT_FALSE(event);
 
   controller->Animate(kInitialTickTime + duration);
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_VECTOR2DF_EQ(target_value, dummy.scroll_offset());
   EXPECT_FALSE(controller->HasActiveAnimation());
 }
@@ -819,8 +813,8 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionOnImplOnly) {
   scoped_ptr<AnimationEventsVector> events(
       make_scoped_ptr(new AnimationEventsVector));
 
-  gfx::Vector2dF initial_value(100.f, 300.f);
-  gfx::Vector2dF target_value(300.f, 200.f);
+  gfx::ScrollOffset initial_value(100.f, 300.f);
+  gfx::ScrollOffset target_value(300.f, 200.f);
   scoped_ptr<ScrollOffsetAnimationCurve> curve(
       ScrollOffsetAnimationCurve::Create(
           target_value,
@@ -828,8 +822,8 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionOnImplOnly) {
   curve->SetInitialValue(initial_value);
   double duration_in_seconds = curve->Duration();
 
-  scoped_ptr<Animation> animation(Animation::Create(
-      curve.PassAs<AnimationCurve>(), 1, 0, Animation::ScrollOffset));
+  scoped_ptr<Animation> animation(
+      Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset));
   animation->set_is_impl_only(true);
   controller_impl->AddAnimation(animation.Pass());
 
@@ -865,15 +859,15 @@ class FakeAnimationDelegate : public AnimationDelegate {
       : started_(false),
         finished_(false) {}
 
-  virtual void NotifyAnimationStarted(
-      TimeTicks monotonic_time,
-      Animation::TargetProperty target_property) OVERRIDE {
+  void NotifyAnimationStarted(TimeTicks monotonic_time,
+                              Animation::TargetProperty target_property,
+                              int group) override {
     started_ = true;
   }
 
-  virtual void NotifyAnimationFinished(
-      TimeTicks monotonic_time,
-      Animation::TargetProperty target_property) OVERRIDE {
+  void NotifyAnimationFinished(TimeTicks monotonic_time,
+                               Animation::TargetProperty target_property,
+                               int group) override {
     finished_ = true;
   }
 
@@ -1477,28 +1471,23 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) {
       KeyframedTransformAnimationCurve::Create());
 
   TransformOperations operations1;
-  curve1->AddKeyframe(TransformKeyframe::Create(
-      0.0, operations1, scoped_ptr<TimingFunction>()));
+  curve1->AddKeyframe(TransformKeyframe::Create(0.0, operations1, nullptr));
   operations1.AppendTranslate(10.0, 15.0, 0.0);
-  curve1->AddKeyframe(TransformKeyframe::Create(
-      1.0, operations1, scoped_ptr<TimingFunction>()));
+  curve1->AddKeyframe(TransformKeyframe::Create(1.0, operations1, nullptr));
 
-  scoped_ptr<Animation> animation(Animation::Create(
-      curve1.PassAs<AnimationCurve>(), 1, 1, Animation::Transform));
+  scoped_ptr<Animation> animation(
+      Animation::Create(curve1.Pass(), 1, 1, Animation::Transform));
   controller_impl->AddAnimation(animation.Pass());
 
   scoped_ptr<KeyframedTransformAnimationCurve> curve2(
       KeyframedTransformAnimationCurve::Create());
 
   TransformOperations operations2;
-  curve2->AddKeyframe(TransformKeyframe::Create(
-      0.0, operations2, scoped_ptr<TimingFunction>()));
+  curve2->AddKeyframe(TransformKeyframe::Create(0.0, operations2, nullptr));
   operations2.AppendScale(2.0, 3.0, 4.0);
-  curve2->AddKeyframe(TransformKeyframe::Create(
-      1.0, operations2, scoped_ptr<TimingFunction>()));
+  curve2->AddKeyframe(TransformKeyframe::Create(1.0, operations2, nullptr));
 
-  animation = Animation::Create(
-      curve2.PassAs<AnimationCurve>(), 2, 2, Animation::Transform);
+  animation = Animation::Create(curve2.Pass(), 2, 2, Animation::Transform);
   controller_impl->AddAnimation(animation.Pass());
 
   gfx::BoxF box(1.f, 2.f, -1.f, 3.f, 4.f, 5.f);
@@ -1528,13 +1517,10 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) {
   TransformOperations operations3;
   gfx::Transform transform3;
   transform3.Scale3d(1.0, 2.0, 3.0);
-  curve3->AddKeyframe(TransformKeyframe::Create(
-      0.0, operations3, scoped_ptr<TimingFunction>()));
+  curve3->AddKeyframe(TransformKeyframe::Create(0.0, operations3, nullptr));
   operations3.AppendMatrix(transform3);
-  curve3->AddKeyframe(TransformKeyframe::Create(
-      1.0, operations3, scoped_ptr<TimingFunction>()));
-  animation = Animation::Create(
-      curve3.PassAs<AnimationCurve>(), 3, 3, Animation::Transform);
+  curve3->AddKeyframe(TransformKeyframe::Create(1.0, operations3, nullptr));
+  animation = Animation::Create(curve3.Pass(), 3, 3, Animation::Transform);
   controller_impl->AddAnimation(animation.Pass());
   EXPECT_FALSE(controller_impl->TransformAnimationBoundsForBox(box, &bounds));
 }
@@ -1571,9 +1557,9 @@ TEST(LayerAnimationControllerTest, AbortAnimations) {
       Animation::Opacity));
 
   controller->Animate(kInitialTickTime);
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
 
   EXPECT_EQ(Animation::Finished,
             controller->GetAnimation(1, Animation::Transform)->run_state());
@@ -1626,7 +1612,7 @@ TEST(LayerAnimationControllerTest, MainThreadAbortedAnimationGetsDeleted) {
   EXPECT_FALSE(dummy_impl.animation_waiting_for_deletion());
 
   controller->Animate(kInitialTickTime);
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_TRUE(dummy.animation_waiting_for_deletion());
   EXPECT_EQ(Animation::WaitingForDeletion,
             controller->GetAnimation(Animation::Opacity)->run_state());
@@ -1675,7 +1661,7 @@ TEST(LayerAnimationControllerTest, ImplThreadAbortedAnimationGetsDeleted) {
             controller->GetAnimation(Animation::Opacity)->run_state());
 
   controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
-  controller->UpdateState(true, NULL);
+  controller->UpdateState(true, nullptr);
   EXPECT_TRUE(dummy.animation_waiting_for_deletion());
   EXPECT_EQ(Animation::WaitingForDeletion,
             controller->GetAnimation(Animation::Opacity)->run_state());
@@ -1801,14 +1787,12 @@ TEST(LayerAnimationControllerTest, HasAnimationThatAffectsScale) {
       KeyframedTransformAnimationCurve::Create());
 
   TransformOperations operations1;
-  curve1->AddKeyframe(TransformKeyframe::Create(
-      0.0, operations1, scoped_ptr<TimingFunction>()));
+  curve1->AddKeyframe(TransformKeyframe::Create(0.0, operations1, nullptr));
   operations1.AppendTranslate(10.0, 15.0, 0.0);
-  curve1->AddKeyframe(TransformKeyframe::Create(
-      1.0, operations1, scoped_ptr<TimingFunction>()));
+  curve1->AddKeyframe(TransformKeyframe::Create(1.0, operations1, nullptr));
 
-  scoped_ptr<Animation> animation(Animation::Create(
-      curve1.PassAs<AnimationCurve>(), 2, 2, Animation::Transform));
+  scoped_ptr<Animation> animation(
+      Animation::Create(curve1.Pass(), 2, 2, Animation::Transform));
   controller_impl->AddAnimation(animation.Pass());
 
   // Translations don't affect scale.
@@ -1818,14 +1802,11 @@ TEST(LayerAnimationControllerTest, HasAnimationThatAffectsScale) {
       KeyframedTransformAnimationCurve::Create());
 
   TransformOperations operations2;
-  curve2->AddKeyframe(TransformKeyframe::Create(
-      0.0, operations2, scoped_ptr<TimingFunction>()));
+  curve2->AddKeyframe(TransformKeyframe::Create(0.0, operations2, nullptr));
   operations2.AppendScale(2.0, 3.0, 4.0);
-  curve2->AddKeyframe(TransformKeyframe::Create(
-      1.0, operations2, scoped_ptr<TimingFunction>()));
+  curve2->AddKeyframe(TransformKeyframe::Create(1.0, operations2, nullptr));
 
-  animation = Animation::Create(
-      curve2.PassAs<AnimationCurve>(), 3, 3, Animation::Transform);
+  animation = Animation::Create(curve2.Pass(), 3, 3, Animation::Transform);
   controller_impl->AddAnimation(animation.Pass());
 
   EXPECT_TRUE(controller_impl->HasAnimationThatAffectsScale());
@@ -1856,14 +1837,12 @@ TEST(LayerAnimationControllerTest, HasOnlyTranslationTransforms) {
       KeyframedTransformAnimationCurve::Create());
 
   TransformOperations operations1;
-  curve1->AddKeyframe(TransformKeyframe::Create(
-      0.0, operations1, scoped_ptr<TimingFunction>()));
+  curve1->AddKeyframe(TransformKeyframe::Create(0.0, operations1, nullptr));
   operations1.AppendTranslate(10.0, 15.0, 0.0);
-  curve1->AddKeyframe(TransformKeyframe::Create(
-      1.0, operations1, scoped_ptr<TimingFunction>()));
+  curve1->AddKeyframe(TransformKeyframe::Create(1.0, operations1, nullptr));
 
-  scoped_ptr<Animation> animation(Animation::Create(
-      curve1.PassAs<AnimationCurve>(), 2, 2, Animation::Transform));
+  scoped_ptr<Animation> animation(
+      Animation::Create(curve1.Pass(), 2, 2, Animation::Transform));
   controller_impl->AddAnimation(animation.Pass());
 
   // The only transform animation we've added is a translation.
@@ -1873,14 +1852,11 @@ TEST(LayerAnimationControllerTest, HasOnlyTranslationTransforms) {
       KeyframedTransformAnimationCurve::Create());
 
   TransformOperations operations2;
-  curve2->AddKeyframe(TransformKeyframe::Create(
-      0.0, operations2, scoped_ptr<TimingFunction>()));
+  curve2->AddKeyframe(TransformKeyframe::Create(0.0, operations2, nullptr));
   operations2.AppendScale(2.0, 3.0, 4.0);
-  curve2->AddKeyframe(TransformKeyframe::Create(
-      1.0, operations2, scoped_ptr<TimingFunction>()));
+  curve2->AddKeyframe(TransformKeyframe::Create(1.0, operations2, nullptr));
 
-  animation = Animation::Create(
-      curve2.PassAs<AnimationCurve>(), 3, 3, Animation::Transform);
+  animation = Animation::Create(curve2.Pass(), 3, 3, Animation::Transform);
   controller_impl->AddAnimation(animation.Pass());
 
   // A scale animation is not a translation.
@@ -1894,63 +1870,55 @@ TEST(LayerAnimationControllerTest, HasOnlyTranslationTransforms) {
   EXPECT_TRUE(controller_impl->HasOnlyTranslationTransforms());
 }
 
-TEST(LayerAnimationControllerTest, MaximumScale) {
+TEST(LayerAnimationControllerTest, MaximumTargetScale) {
   scoped_refptr<LayerAnimationController> controller_impl(
       LayerAnimationController::Create(0));
 
   float max_scale = 0.f;
-  EXPECT_TRUE(controller_impl->MaximumScale(&max_scale));
+  EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
   EXPECT_EQ(0.f, max_scale);
 
   scoped_ptr<KeyframedTransformAnimationCurve> curve1(
       KeyframedTransformAnimationCurve::Create());
 
   TransformOperations operations1;
-  curve1->AddKeyframe(TransformKeyframe::Create(
-      0.0, operations1, scoped_ptr<TimingFunction>()));
+  curve1->AddKeyframe(TransformKeyframe::Create(0.0, operations1, nullptr));
   operations1.AppendScale(2.0, 3.0, 4.0);
-  curve1->AddKeyframe(TransformKeyframe::Create(
-      1.0, operations1, scoped_ptr<TimingFunction>()));
+  curve1->AddKeyframe(TransformKeyframe::Create(1.0, operations1, nullptr));
 
-  scoped_ptr<Animation> animation(Animation::Create(
-      curve1.PassAs<AnimationCurve>(), 1, 1, Animation::Transform));
+  scoped_ptr<Animation> animation(
+      Animation::Create(curve1.Pass(), 1, 1, Animation::Transform));
   controller_impl->AddAnimation(animation.Pass());
 
-  EXPECT_TRUE(controller_impl->MaximumScale(&max_scale));
+  EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
   EXPECT_EQ(4.f, max_scale);
 
   scoped_ptr<KeyframedTransformAnimationCurve> curve2(
       KeyframedTransformAnimationCurve::Create());
 
   TransformOperations operations2;
-  curve2->AddKeyframe(TransformKeyframe::Create(
-      0.0, operations2, scoped_ptr<TimingFunction>()));
+  curve2->AddKeyframe(TransformKeyframe::Create(0.0, operations2, nullptr));
   operations2.AppendScale(6.0, 5.0, 4.0);
-  curve2->AddKeyframe(TransformKeyframe::Create(
-      1.0, operations2, scoped_ptr<TimingFunction>()));
+  curve2->AddKeyframe(TransformKeyframe::Create(1.0, operations2, nullptr));
 
-  animation = Animation::Create(
-      curve2.PassAs<AnimationCurve>(), 2, 2, Animation::Transform);
+  animation = Animation::Create(curve2.Pass(), 2, 2, Animation::Transform);
   controller_impl->AddAnimation(animation.Pass());
 
-  EXPECT_TRUE(controller_impl->MaximumScale(&max_scale));
+  EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
   EXPECT_EQ(6.f, max_scale);
 
   scoped_ptr<KeyframedTransformAnimationCurve> curve3(
       KeyframedTransformAnimationCurve::Create());
 
   TransformOperations operations3;
-  curve3->AddKeyframe(TransformKeyframe::Create(
-      0.0, operations3, scoped_ptr<TimingFunction>()));
+  curve3->AddKeyframe(TransformKeyframe::Create(0.0, operations3, nullptr));
   operations3.AppendPerspective(6.0);
-  curve3->AddKeyframe(TransformKeyframe::Create(
-      1.0, operations3, scoped_ptr<TimingFunction>()));
+  curve3->AddKeyframe(TransformKeyframe::Create(1.0, operations3, nullptr));
 
-  animation = Animation::Create(
-      curve3.PassAs<AnimationCurve>(), 3, 3, Animation::Transform);
+  animation = Animation::Create(curve3.Pass(), 3, 3, Animation::Transform);
   controller_impl->AddAnimation(animation.Pass());
 
-  EXPECT_FALSE(controller_impl->MaximumScale(&max_scale));
+  EXPECT_FALSE(controller_impl->MaximumTargetScale(&max_scale));
 
   controller_impl->GetAnimation(3, Animation::Transform)
       ->SetRunState(Animation::Finished, TicksFromSecondsF(0.0));
@@ -1958,11 +1926,76 @@ TEST(LayerAnimationControllerTest, MaximumScale) {
       ->SetRunState(Animation::Finished, TicksFromSecondsF(0.0));
 
   // Only unfinished animations should be considered by
-  // MaximumScale.
-  EXPECT_TRUE(controller_impl->MaximumScale(&max_scale));
+  // MaximumTargetScale.
+  EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
   EXPECT_EQ(4.f, max_scale);
 }
 
+TEST(LayerAnimationControllerTest, MaximumTargetScaleWithDirection) {
+  scoped_refptr<LayerAnimationController> controller_impl(
+      LayerAnimationController::Create(0));
+
+  scoped_ptr<KeyframedTransformAnimationCurve> curve1(
+      KeyframedTransformAnimationCurve::Create());
+  TransformOperations operations1;
+  operations1.AppendScale(1.0, 2.0, 3.0);
+  curve1->AddKeyframe(TransformKeyframe::Create(0.0, operations1, nullptr));
+  TransformOperations operations2;
+  operations2.AppendScale(4.0, 5.0, 6.0);
+  curve1->AddKeyframe(TransformKeyframe::Create(1.0, operations2, nullptr));
+
+  scoped_ptr<Animation> animation_owned(
+      Animation::Create(curve1.Pass(), 1, 1, Animation::Transform));
+  Animation* animation = animation_owned.get();
+  controller_impl->AddAnimation(animation_owned.Pass());
+
+  float max_scale = 0.f;
+
+  EXPECT_GT(animation->playback_rate(), 0.0);
+
+  // Normal direction with positive playback rate.
+  animation->set_direction(Animation::Normal);
+  EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
+  EXPECT_EQ(6.f, max_scale);
+
+  // Alternate direction with positive playback rate.
+  animation->set_direction(Animation::Alternate);
+  EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
+  EXPECT_EQ(6.f, max_scale);
+
+  // Reverse direction with positive playback rate.
+  animation->set_direction(Animation::Reverse);
+  EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
+  EXPECT_EQ(3.f, max_scale);
+
+  // Alternate reverse direction.
+  animation->set_direction(Animation::Reverse);
+  EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
+  EXPECT_EQ(3.f, max_scale);
+
+  animation->set_playback_rate(-1.0);
+
+  // Normal direction with negative playback rate.
+  animation->set_direction(Animation::Normal);
+  EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
+  EXPECT_EQ(3.f, max_scale);
+
+  // Alternate direction with negative playback rate.
+  animation->set_direction(Animation::Alternate);
+  EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
+  EXPECT_EQ(3.f, max_scale);
+
+  // Reverse direction with negative playback rate.
+  animation->set_direction(Animation::Reverse);
+  EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
+  EXPECT_EQ(6.f, max_scale);
+
+  // Alternate reverse direction with negative playback rate.
+  animation->set_direction(Animation::Reverse);
+  EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale));
+  EXPECT_EQ(6.f, max_scale);
+}
+
 TEST(LayerAnimationControllerTest, NewlyPushedAnimationWaitsForActivation) {
   scoped_ptr<AnimationEventsVector> events(
       make_scoped_ptr(new AnimationEventsVector));
@@ -2265,5 +2298,51 @@ TEST(LayerAnimationControllerTest, StartAnimationsAffectingDifferentObservers) {
   EXPECT_EQ(1.f, dummy_impl.opacity());
 }
 
+TEST(LayerAnimationControllerTest, TestIsAnimatingProperty) {
+  FakeLayerAnimationValueObserver dummy;
+  scoped_refptr<LayerAnimationController> controller(
+      LayerAnimationController::Create(0));
+  controller->AddValueObserver(&dummy);
+
+  scoped_ptr<Animation> animation(CreateAnimation(
+      scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
+      1,
+      Animation::Opacity));
+  controller->AddAnimation(animation.Pass());
+  controller->Animate(kInitialTickTime);
+  EXPECT_TRUE(controller->IsAnimatingProperty(Animation::Opacity));
+  controller->UpdateState(true, nullptr);
+  EXPECT_TRUE(controller->HasActiveAnimation());
+  EXPECT_TRUE(controller->IsAnimatingProperty(Animation::Opacity));
+  EXPECT_FALSE(controller->IsAnimatingProperty(Animation::Filter));
+  EXPECT_EQ(0.f, dummy.opacity());
+}
+
+TEST(LayerAnimationControllerTest, TestIsAnimatingPropertyTimeOffsetFillMode) {
+  FakeLayerAnimationValueObserver dummy;
+  scoped_refptr<LayerAnimationController> controller(
+      LayerAnimationController::Create(0));
+  controller->AddValueObserver(&dummy);
+
+  scoped_ptr<Animation> animation(CreateAnimation(
+      scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
+      1,
+      Animation::Opacity));
+  animation->set_fill_mode(Animation::FillModeNone);
+  animation->set_time_offset(TimeDelta::FromMilliseconds(-2000));
+  controller->AddAnimation(animation.Pass());
+
+  controller->Animate(kInitialTickTime);
+  controller->UpdateState(true, nullptr);
+  EXPECT_FALSE(controller->IsAnimatingProperty(Animation::Opacity));
+  EXPECT_TRUE(controller->HasActiveAnimation());
+  EXPECT_FALSE(controller->IsAnimatingProperty(Animation::Opacity));
+  EXPECT_FALSE(controller->IsAnimatingProperty(Animation::Filter));
+
+  controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000));
+  controller->UpdateState(true, nullptr);
+  EXPECT_TRUE(controller->IsAnimatingProperty(Animation::Opacity));
+}
+
 }  // namespace
 }  // namespace cc