| Index: ui/gfx/compositor/layer_animation_sequence_unittest.cc
|
| diff --git a/ui/gfx/compositor/layer_animation_sequence_unittest.cc b/ui/gfx/compositor/layer_animation_sequence_unittest.cc
|
| index 3b283a3fe12bedb653ae2485202c7cb3f279924c..a80a5f1bb474a3eaa0227164b6ef8a1a149c5ea3 100644
|
| --- a/ui/gfx/compositor/layer_animation_sequence_unittest.cc
|
| +++ b/ui/gfx/compositor/layer_animation_sequence_unittest.cc
|
| @@ -11,10 +11,10 @@
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "ui/gfx/rect.h"
|
| #include "ui/gfx/transform.h"
|
| +#include "ui/gfx/compositor/dummy_layer_animation_delegate.h"
|
| #include "ui/gfx/compositor/layer_animation_delegate.h"
|
| #include "ui/gfx/compositor/layer_animation_element.h"
|
| #include "ui/gfx/compositor/test_utils.h"
|
| -#include "ui/gfx/compositor/test_layer_animation_delegate.h"
|
|
|
| namespace ui {
|
|
|
| @@ -33,7 +33,7 @@ TEST(LayerAnimationSequenceTest, NoElement) {
|
| // a single element.
|
| TEST(LayerAnimationSequenceTest, SingleElement) {
|
| LayerAnimationSequence sequence;
|
| - TestLayerAnimationDelegate delegate;
|
| + DummyLayerAnimationDelegate delegate;
|
| float start = 0.0;
|
| float middle = 0.5;
|
| float target = 1.0;
|
| @@ -61,7 +61,7 @@ TEST(LayerAnimationSequenceTest, SingleElement) {
|
| // multiple elements. Note, see the layer animator tests for cyclic sequences.
|
| TEST(LayerAnimationSequenceTest, MultipleElement) {
|
| LayerAnimationSequence sequence;
|
| - TestLayerAnimationDelegate delegate;
|
| + DummyLayerAnimationDelegate delegate;
|
| float start_opacity = 0.0;
|
| float middle_opacity = 0.5;
|
| float target_opacity = 1.0;
|
| @@ -93,7 +93,7 @@ TEST(LayerAnimationSequenceTest, MultipleElement) {
|
| EXPECT_FLOAT_EQ(middle_opacity, delegate.GetOpacityForAnimation());
|
| sequence.Progress(base::TimeDelta::FromMilliseconds(1000), &delegate);
|
| EXPECT_FLOAT_EQ(target_opacity, delegate.GetOpacityForAnimation());
|
| - TestLayerAnimationDelegate copy = delegate;
|
| + DummyLayerAnimationDelegate copy = delegate;
|
|
|
| // In the middle of the pause -- nothing should have changed.
|
| sequence.Progress(base::TimeDelta::FromMilliseconds(1500), &delegate);
|
| @@ -129,7 +129,7 @@ TEST(LayerAnimationSequenceTest, MultipleElement) {
|
| // Check that a sequence can still be aborted if it has cycled many times.
|
| TEST(LayerAnimationSequenceTest, AbortingCyclicSequence) {
|
| LayerAnimationSequence sequence;
|
| - TestLayerAnimationDelegate delegate;
|
| + DummyLayerAnimationDelegate delegate;
|
| float start_opacity = 0.0;
|
| float target_opacity = 1.0;
|
| base::TimeDelta delta = base::TimeDelta::FromSeconds(1);
|
| @@ -153,6 +153,28 @@ TEST(LayerAnimationSequenceTest, AbortingCyclicSequence) {
|
| EXPECT_FLOAT_EQ(start_opacity, delegate.GetOpacityForAnimation());
|
| }
|
|
|
| +// Check that a sequence can be 'fast-forwarded' to the end and the target set.
|
| +// Also check that this has no effect if the sequence is cyclic.
|
| +TEST(LayerAnimationSequenceTest, SetTarget) {
|
| + LayerAnimationSequence sequence;
|
| + DummyLayerAnimationDelegate delegate;
|
| + float start_opacity = 0.0;
|
| + float target_opacity = 1.0;
|
| + base::TimeDelta delta = base::TimeDelta::FromSeconds(1);
|
| + sequence.AddElement(
|
| + LayerAnimationElement::CreateOpacityElement(target_opacity, delta));
|
| +
|
| + LayerAnimationElement::TargetValue target_value;
|
| + target_value.opacity = start_opacity;
|
| + sequence.GetTargetValue(&target_value);
|
| + EXPECT_FLOAT_EQ(target_opacity, target_value.opacity);
|
| +
|
| + sequence.set_is_cyclic(true);
|
| + target_value.opacity = start_opacity;
|
| + sequence.GetTargetValue(&target_value);
|
| + EXPECT_FLOAT_EQ(start_opacity, target_value.opacity);
|
| +}
|
| +
|
| } // namespace
|
|
|
| } // namespace ui
|
|
|