Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Unified Diff: Source/core/animation/AnimationTimelineTest.cpp

Issue 1120003002: [Oilpan] Migrate most classes under core/animations to Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Intentional nullptr access Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/animation/AnimationTimeline.idl ('k') | Source/core/animation/ColorStyleInterpolation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/AnimationTimelineTest.cpp
diff --git a/Source/core/animation/AnimationTimelineTest.cpp b/Source/core/animation/AnimationTimelineTest.cpp
index 79482a1f4cd40c60de9e18cccdb94b0e711fc746..7efe9f38b0d2b3b8c849d525d4c655cffc923834 100644
--- a/Source/core/animation/AnimationTimelineTest.cpp
+++ b/Source/core/animation/AnimationTimelineTest.cpp
@@ -45,7 +45,7 @@
namespace blink {
-class MockPlatformTiming : public AnimationTimeline::PlatformTiming {
+class MockPlatformTiming final : public AnimationTimeline::PlatformTiming {
public:
MOCK_METHOD1(wakeAfter, void(double));
@@ -80,6 +80,9 @@ public:
DEFINE_INLINE_TRACE()
{
+ // Null access to get a stack trace.
+ int* foo = nullptr;
+ *foo = 1;
peria 2015/05/11 10:27:54 This change is made to share how an instance of Mo
AnimationTimeline::PlatformTiming::trace(visitor);
}
};
@@ -91,8 +94,7 @@ protected:
document = Document::create();
document->animationClock().resetTimeForTesting();
element = Element::create(QualifiedName::null() , document.get());
- platformTiming = new MockPlatformTiming;
- timeline = AnimationTimeline::create(document.get(), adoptPtrWillBeNoop(platformTiming));
+ timeline = AnimationTimeline::create(document.get(), new MockPlatformTiming);
ASSERT_EQ(0, timeline->currentTimeInternal());
}
@@ -101,9 +103,7 @@ protected:
document.release();
element.release();
timeline.release();
-#if ENABLE(OILPAN)
Heap::collectAllGarbage();
-#endif
}
void updateClockAndService(double time)
@@ -114,11 +114,15 @@ protected:
timeline->scheduleNextService();
}
+ MockPlatformTiming* platformTiming()
+ {
+ return static_cast<MockPlatformTiming*>(timeline->timing());
+ }
+
RefPtrWillBePersistent<Document> document;
RefPtrWillBePersistent<Element> element;
- RefPtrWillBePersistent<AnimationTimeline> timeline;
+ Persistent<AnimationTimeline> timeline;
Timing timing;
- MockPlatformTiming* platformTiming;
void wake()
{
@@ -138,35 +142,35 @@ TEST_F(AnimationAnimationTimelineTest, HasStarted)
TEST_F(AnimationAnimationTimelineTest, EmptyKeyframeAnimation)
{
- RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector());
- RefPtrWillBeRawPtr<KeyframeEffect> keyframeEffect = KeyframeEffect::create(element.get(), effect, timing);
+ AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector());
+ KeyframeEffect* keyframeEffect = KeyframeEffect::create(element.get(), effect, timing);
- timeline->play(keyframeEffect.get());
+ timeline->play(keyframeEffect);
- platformTiming->expectNoMoreActions();
+ platformTiming()->expectNoMoreActions();
updateClockAndService(0);
EXPECT_FLOAT_EQ(0, timeline->currentTimeInternal());
EXPECT_FALSE(keyframeEffect->isInEffect());
- platformTiming->expectNoMoreActions();
+ platformTiming()->expectNoMoreActions();
updateClockAndService(100);
EXPECT_FLOAT_EQ(100, timeline->currentTimeInternal());
}
TEST_F(AnimationAnimationTimelineTest, EmptyForwardsKeyframeAnimation)
{
- RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector());
+ AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector());
timing.fillMode = Timing::FillModeForwards;
- RefPtrWillBeRawPtr<KeyframeEffect> keyframeEffect = KeyframeEffect::create(element.get(), effect, timing);
+ KeyframeEffect* keyframeEffect = KeyframeEffect::create(element.get(), effect, timing);
- timeline->play(keyframeEffect.get());
+ timeline->play(keyframeEffect);
- platformTiming->expectNoMoreActions();
+ platformTiming()->expectNoMoreActions();
updateClockAndService(0);
EXPECT_FLOAT_EQ(0, timeline->currentTimeInternal());
EXPECT_TRUE(keyframeEffect->isInEffect());
- platformTiming->expectNoMoreActions();
+ platformTiming()->expectNoMoreActions();
updateClockAndService(100);
EXPECT_FLOAT_EQ(100, timeline->currentTimeInternal());
}
@@ -346,10 +350,10 @@ TEST_F(AnimationAnimationTimelineTest, PauseForTesting)
{
float seekTime = 1;
timing.fillMode = Timing::FillModeForwards;
- RefPtrWillBeRawPtr<KeyframeEffect> anim1 = KeyframeEffect::create(element.get(), AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()), timing);
- RefPtrWillBeRawPtr<KeyframeEffect> anim2 = KeyframeEffect::create(element.get(), AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()), timing);
- Animation* animation1 = timeline->play(anim1.get());
- Animation* animation2 = timeline->play(anim2.get());
+ KeyframeEffect* anim1 = KeyframeEffect::create(element.get(), AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()), timing);
+ KeyframeEffect* anim2 = KeyframeEffect::create(element.get(), AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()), timing);
+ Animation* animation1 = timeline->play(anim1);
+ Animation* animation2 = timeline->play(anim2);
timeline->pauseAnimationsForTesting(seekTime);
EXPECT_FLOAT_EQ(seekTime, animation1->currentTime() / 1000.0);
@@ -361,21 +365,21 @@ TEST_F(AnimationAnimationTimelineTest, DelayBeforeAnimationStart)
timing.iterationDuration = 2;
timing.startDelay = 5;
- RefPtrWillBeRawPtr<KeyframeEffect> keyframeEffect = KeyframeEffect::create(element.get(), nullptr, timing);
+ KeyframeEffect* keyframeEffect = KeyframeEffect::create(element.get(), nullptr, timing);
- timeline->play(keyframeEffect.get());
+ timeline->play(keyframeEffect);
// TODO: Put the animation startTime in the future when we add the capability to change animation startTime
- platformTiming->expectDelayedAction(timing.startDelay - minimumDelay());
+ platformTiming()->expectDelayedAction(timing.startDelay - minimumDelay());
updateClockAndService(0);
- platformTiming->expectDelayedAction(timing.startDelay - minimumDelay() - 1.5);
+ platformTiming()->expectDelayedAction(timing.startDelay - minimumDelay() - 1.5);
updateClockAndService(1.5);
- EXPECT_CALL(*platformTiming, serviceOnNextFrame());
+ EXPECT_CALL(*platformTiming(), serviceOnNextFrame());
wake();
- platformTiming->expectNextFrameAction();
+ platformTiming()->expectNextFrameAction();
updateClockAndService(4.98);
}
@@ -388,9 +392,9 @@ TEST_F(AnimationAnimationTimelineTest, PlayAfterDocumentDeref)
element = nullptr;
document = nullptr;
- RefPtrWillBeRawPtr<KeyframeEffect> keyframeEffect = KeyframeEffect::create(0, nullptr, timing);
+ KeyframeEffect* keyframeEffect = KeyframeEffect::create(0, nullptr, timing);
// Test passes if this does not crash.
- timeline->play(keyframeEffect.get());
+ timeline->play(keyframeEffect);
}
TEST_F(AnimationAnimationTimelineTest, UseAnimationAfterTimelineDeref)
« no previous file with comments | « Source/core/animation/AnimationTimeline.idl ('k') | Source/core/animation/ColorStyleInterpolation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698