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

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

Issue 717003002: Animations: Allow document animation timelines to have a playback rate (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
Index: Source/core/animation/AnimationTimelineTest.cpp
diff --git a/Source/core/animation/AnimationTimelineTest.cpp b/Source/core/animation/AnimationTimelineTest.cpp
index 276c43a1831dc0c3ddfd718f2763bf718a6cf615..d6989c0240a05122ab6c3284f80ba32d5b3c823d 100644
--- a/Source/core/animation/AnimationTimelineTest.cpp
+++ b/Source/core/animation/AnimationTimelineTest.cpp
@@ -186,6 +186,92 @@ TEST_F(AnimationAnimationTimelineTest, ZeroTime)
EXPECT_FALSE(isNull);
}
+TEST_F(AnimationAnimationTimelineTest, PlaybackRateForInspectorNormal)
+{
+ timeline = AnimationTimeline::create(document.get());
+ bool isNull;
+
+ document->animationClock().updateTime(100);
+ timeline->setPlaybackRateForInspector(1.0);
+ EXPECT_EQ(100, timeline->currentTimeInternal());
+ EXPECT_EQ(100, timeline->currentTimeInternal(isNull));
+ EXPECT_FALSE(isNull);
+
+ document->animationClock().updateTime(200);
+ EXPECT_EQ(200, timeline->currentTimeInternal());
+ EXPECT_EQ(200, timeline->currentTimeInternal(isNull));
+ EXPECT_FALSE(isNull);
+}
+
+TEST_F(AnimationAnimationTimelineTest, PlaybackRateForInspectorPause)
+{
+ timeline = AnimationTimeline::create(document.get());
+ bool isNull;
+
+ document->animationClock().updateTime(100);
+ EXPECT_EQ(100, timeline->currentTimeInternal());
+ EXPECT_EQ(100, timeline->currentTimeInternal(isNull));
+ EXPECT_FALSE(isNull);
+
+ timeline->setPlaybackRateForInspector(0.0);
+ document->animationClock().updateTime(200);
+ EXPECT_EQ(100, timeline->currentTimeInternal());
+ EXPECT_EQ(100, timeline->currentTimeInternal(isNull));
+
+ timeline->setPlaybackRateForInspector(1.0);
+ document->animationClock().updateTime(400);
+ EXPECT_EQ(300, timeline->currentTimeInternal());
+ EXPECT_EQ(300, timeline->currentTimeInternal(isNull));
+
+ EXPECT_FALSE(isNull);
+}
+
+TEST_F(AnimationAnimationTimelineTest, PlaybackRateForInspectorSlow)
+{
+ timeline = AnimationTimeline::create(document.get());
+ bool isNull;
+
+ document->animationClock().updateTime(100);
+ EXPECT_EQ(100, timeline->currentTimeInternal());
+ EXPECT_EQ(100, timeline->currentTimeInternal(isNull));
+ EXPECT_FALSE(isNull);
+
+ timeline->setPlaybackRateForInspector(0.5);
+ document->animationClock().updateTime(300);
+ EXPECT_EQ(200, timeline->currentTimeInternal());
+ EXPECT_EQ(200, timeline->currentTimeInternal(isNull));
+
+ timeline->setPlaybackRateForInspector(1.0);
+ document->animationClock().updateTime(400);
+ EXPECT_EQ(300, timeline->currentTimeInternal());
+ EXPECT_EQ(300, timeline->currentTimeInternal(isNull));
+
+ EXPECT_FALSE(isNull);
+}
+
+TEST_F(AnimationAnimationTimelineTest, PlaybackRateForInspectorFast)
+{
+ timeline = AnimationTimeline::create(document.get());
+ bool isNull;
+
+ document->animationClock().updateTime(100);
+ EXPECT_EQ(100, timeline->currentTimeInternal());
+ EXPECT_EQ(100, timeline->currentTimeInternal(isNull));
+ EXPECT_FALSE(isNull);
+
+ timeline->setPlaybackRateForInspector(2);
+ document->animationClock().updateTime(300);
+ EXPECT_EQ(500, timeline->currentTimeInternal());
+ EXPECT_EQ(500, timeline->currentTimeInternal(isNull));
+
+ timeline->setPlaybackRateForInspector(1.0);
+ document->animationClock().updateTime(400);
+ EXPECT_EQ(600, timeline->currentTimeInternal());
+ EXPECT_EQ(600, timeline->currentTimeInternal(isNull));
+
+ EXPECT_FALSE(isNull);
+}
+
TEST_F(AnimationAnimationTimelineTest, PauseForTesting)
{
float seekTime = 1;

Powered by Google App Engine
This is Rietveld 408576698