| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/animation/AnimationStack.h" | 5 #include "core/animation/AnimationStack.h" |
| 6 | 6 |
| 7 #include "core/animation/AnimationClock.h" | 7 #include "core/animation/AnimationClock.h" |
| 8 #include "core/animation/CompositorPendingAnimations.h" | 8 #include "core/animation/CompositorPendingAnimations.h" |
| 9 #include "core/animation/DocumentTimeline.h" | 9 #include "core/animation/DocumentTimeline.h" |
| 10 #include "core/animation/ElementAnimations.h" | 10 #include "core/animation/ElementAnimations.h" |
| 11 #include "core/animation/KeyframeEffectModel.h" | 11 #include "core/animation/KeyframeEffectModel.h" |
| 12 #include "core/animation/LegacyStyleInterpolation.h" | 12 #include "core/animation/LegacyStyleInterpolation.h" |
| 13 #include "core/animation/animatable/AnimatableDouble.h" | 13 #include "core/animation/animatable/AnimatableDouble.h" |
| 14 #include "core/testing/DummyPageHolder.h" | 14 #include "core/testing/DummyPageHolder.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include <memory> | 16 #include <memory> |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 class AnimationAnimationStackTest : public ::testing::Test { | 20 class AnimationAnimationStackTest : public ::testing::Test { |
| 21 protected: | 21 protected: |
| 22 virtual void SetUp() { | 22 virtual void SetUp() { |
| 23 pageHolder = DummyPageHolder::create(); | 23 pageHolder = DummyPageHolder::create(); |
| 24 document = &pageHolder->document(); | 24 document = &pageHolder->document(); |
| 25 document->animationClock().resetTimeForTesting(); | 25 document->animationClock().resetTimeForTesting(); |
| 26 timeline = DocumentTimeline::create(document.get()); | 26 timeline = DocumentTimeline::create(document.get()); |
| 27 element = document->createElement("foo", ASSERT_NO_EXCEPTION); | 27 element = document->createElement("foo"); |
| 28 } | 28 } |
| 29 | 29 |
| 30 Animation* play(KeyframeEffect* effect, double startTime) { | 30 Animation* play(KeyframeEffect* effect, double startTime) { |
| 31 Animation* animation = timeline->play(effect); | 31 Animation* animation = timeline->play(effect); |
| 32 animation->setStartTime(startTime * 1000); | 32 animation->setStartTime(startTime * 1000); |
| 33 animation->update(TimingUpdateOnDemand); | 33 animation->update(TimingUpdateOnDemand); |
| 34 return animation; | 34 return animation; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void updateTimeline(double time) { | 37 void updateTimeline(double time) { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 interpolations = AnimationStack::activeInterpolations( | 213 interpolations = AnimationStack::activeInterpolations( |
| 214 &element->elementAnimations()->animationStack(), nullptr, nullptr, | 214 &element->elementAnimations()->animationStack(), nullptr, nullptr, |
| 215 KeyframeEffectReadOnly::DefaultPriority); | 215 KeyframeEffectReadOnly::DefaultPriority); |
| 216 EXPECT_EQ(1u, interpolations.size()); | 216 EXPECT_EQ(1u, interpolations.size()); |
| 217 EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize) | 217 EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize) |
| 218 ->equals(AnimatableDouble::create(3).get())); | 218 ->equals(AnimatableDouble::create(3).get())); |
| 219 EXPECT_EQ(1u, sampledEffectCount()); | 219 EXPECT_EQ(1u, sampledEffectCount()); |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace blink | 222 } // namespace blink |
| OLD | NEW |