| Index: cc/test/animation_test_common.cc
|
| diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc
|
| index 8a232badea2994222002059610b39ef326ae8c3c..9ab5f81e7504c1614aad42dd3f509162608ff949 100644
|
| --- a/cc/test/animation_test_common.cc
|
| +++ b/cc/test/animation_test_common.cc
|
| @@ -382,4 +382,31 @@ int AddAnimatedFilterToPlayer(AnimationPlayer* player,
|
| return AddAnimatedFilter(player, duration, start_brightness, end_brightness);
|
| }
|
|
|
| +int AddOpacityStepsToController(LayerAnimationController* target,
|
| + double duration,
|
| + float start_opacity,
|
| + float end_opacity,
|
| + int num_steps) {
|
| + scoped_ptr<KeyframedFloatAnimationCurve> curve(
|
| + KeyframedFloatAnimationCurve::Create());
|
| +
|
| + scoped_ptr<TimingFunction> func =
|
| + StepsTimingFunction::Create(num_steps, 0.5f);
|
| + if (duration > 0.0)
|
| + curve->AddKeyframe(
|
| + FloatKeyframe::Create(base::TimeDelta(), start_opacity, func.Pass()));
|
| + curve->AddKeyframe(FloatKeyframe::Create(
|
| + base::TimeDelta::FromSecondsD(duration), end_opacity, nullptr));
|
| +
|
| + int id = AnimationIdProvider::NextAnimationId();
|
| +
|
| + scoped_ptr<Animation> animation(
|
| + Animation::Create(curve.Pass(), id, AnimationIdProvider::NextGroupId(),
|
| + Animation::OPACITY));
|
| + animation->set_needs_synchronized_start_time(true);
|
| +
|
| + target->AddAnimation(animation.Pass());
|
| + return id;
|
| +}
|
| +
|
| } // namespace cc
|
|
|