Index: third_party/WebKit/Source/core/animation/AnimationStackTest.cpp |
diff --git a/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp b/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp |
index 43067ee9031c2e8abf7cf49e177e7b67058ce3ea..195e051e19079efcde3fb65835c9d1a53790d1bd 100644 |
--- a/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp |
+++ b/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp |
@@ -40,6 +40,11 @@ protected: |
timeline->serviceAnimations(TimingUpdateForAnimationFrame); |
} |
+ size_t sampledEffectCount() |
+ { |
+ return element->ensureElementAnimations().animationStack().m_sampledEffects.size(); |
+ } |
+ |
EffectModel* makeEffectModel(CSSPropertyID id, PassRefPtr<AnimatableValue> value) |
{ |
AnimatableValueKeyframeVector keyframes(2); |
@@ -127,4 +132,41 @@ TEST_F(AnimationAnimationStackTest, ClearedEffectsRemoved) |
EXPECT_EQ(0u, result.size()); |
} |
+TEST_F(AnimationAnimationStackTest, ForwardsFillDiscarding) |
+{ |
+ play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDouble::create(1))), 2); |
+ play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDouble::create(2))), 6); |
+ play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDouble::create(3))), 4); |
+ document->compositorPendingAnimations().update(); |
+ ActiveInterpolationsMap interpolations; |
+ |
+ updateTimeline(11); |
+ Heap::collectAllGarbage(); |
+ interpolations = AnimationStack::activeInterpolations(&element->elementAnimations()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority); |
+ EXPECT_EQ(1u, interpolations.size()); |
+ EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize)->equals(AnimatableDouble::create(3).get())); |
+ EXPECT_EQ(3u, sampledEffectCount()); |
+ |
+ updateTimeline(13); |
+ Heap::collectAllGarbage(); |
+ interpolations = AnimationStack::activeInterpolations(&element->elementAnimations()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority); |
+ EXPECT_EQ(1u, interpolations.size()); |
+ EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize)->equals(AnimatableDouble::create(3).get())); |
+ EXPECT_EQ(3u, sampledEffectCount()); |
+ |
+ updateTimeline(15); |
+ Heap::collectAllGarbage(); |
+ interpolations = AnimationStack::activeInterpolations(&element->elementAnimations()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority); |
+ EXPECT_EQ(1u, interpolations.size()); |
+ EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize)->equals(AnimatableDouble::create(3).get())); |
+ EXPECT_EQ(2u, sampledEffectCount()); |
+ |
+ updateTimeline(17); |
+ Heap::collectAllGarbage(); |
+ interpolations = AnimationStack::activeInterpolations(&element->elementAnimations()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority); |
+ EXPECT_EQ(1u, interpolations.size()); |
+ EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize)->equals(AnimatableDouble::create(3).get())); |
+ EXPECT_EQ(1u, sampledEffectCount()); |
+} |
+ |
} // namespace blink |