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

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

Issue 365163004: Web Animations: Remove timeLag from Player API and model (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 6 years, 5 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/AnimationPlayer.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/AnimationPlayerTest.cpp
diff --git a/Source/core/animation/AnimationPlayerTest.cpp b/Source/core/animation/AnimationPlayerTest.cpp
index 40a46570bd466f4021ed8e62293202e7d9f438ba..92176fb7e4616aea7e0b741ab919496567cd87b8 100644
--- a/Source/core/animation/AnimationPlayerTest.cpp
+++ b/Source/core/animation/AnimationPlayerTest.cpp
@@ -95,7 +95,6 @@ TEST_F(AnimationAnimationPlayerTest, InitialState)
EXPECT_EQ(0, player->currentTimeInternal());
EXPECT_FALSE(player->paused());
EXPECT_EQ(1, player->playbackRate());
- EXPECT_EQ(0, player->timeLagInternal());
EXPECT_FALSE(player->hasStartTime());
EXPECT_TRUE(isNull(player->startTimeInternal()));
@@ -106,7 +105,6 @@ TEST_F(AnimationAnimationPlayerTest, InitialState)
EXPECT_FALSE(player->paused());
EXPECT_EQ(1, player->playbackRate());
EXPECT_EQ(0, player->startTimeInternal());
- EXPECT_EQ(0, player->timeLagInternal());
EXPECT_TRUE(player->hasStartTime());
}
@@ -191,27 +189,25 @@ TEST_F(AnimationAnimationPlayerTest, SetCurrentTimeMax)
TEST_F(AnimationAnimationPlayerTest, SetCurrentTimeUnrestrictedDouble)
{
updateTimeline(10);
- player->setCurrentTimeInternal(nullValue());
+ player->setCurrentTime(nullValue());
EXPECT_EQ(10, player->currentTimeInternal());
- player->setCurrentTimeInternal(std::numeric_limits<double>::infinity());
+ player->setCurrentTime(std::numeric_limits<double>::infinity());
EXPECT_EQ(10, player->currentTimeInternal());
- player->setCurrentTimeInternal(-std::numeric_limits<double>::infinity());
+ player->setCurrentTime(-std::numeric_limits<double>::infinity());
EXPECT_EQ(10, player->currentTimeInternal());
}
-TEST_F(AnimationAnimationPlayerTest, TimeLag)
+
+TEST_F(AnimationAnimationPlayerTest, SetCurrentTimeSetsStartTime)
{
- player->setCurrentTimeInternal(10);
- EXPECT_EQ(-10, player->timeLagInternal());
- updateTimeline(10);
- EXPECT_EQ(-10, player->timeLagInternal());
- player->setCurrentTimeInternal(40);
- EXPECT_EQ(-30, player->timeLagInternal());
- updateTimeline(20);
- EXPECT_EQ(-20, player->timeLagInternal());
+ EXPECT_EQ(0, player->startTime());
+ player->setCurrentTime(1000);
+ EXPECT_EQ(-1000, player->startTime());
+ updateTimeline(1);
+ EXPECT_EQ(-1000, player->startTime());
+ EXPECT_EQ(2000, player->currentTime());
}
-
TEST_F(AnimationAnimationPlayerTest, SetStartTime)
{
updateTimeline(20);
@@ -246,6 +242,29 @@ TEST_F(AnimationAnimationPlayerTest, SetStartTimeOnLimitedAnimationPlayer)
EXPECT_TRUE(player->finished());
}
+TEST_F(AnimationAnimationPlayerTest, StartTimePauseFinish)
+{
+ player->pause();
+ EXPECT_TRUE(std::isnan(player->startTime()));
+ player->finish(exceptionState);
+ EXPECT_TRUE(std::isnan(player->startTime()));
+}
+
+TEST_F(AnimationAnimationPlayerTest, StartTimeFinishPause)
+{
+ double startTime = player->startTime();
+ player->finish(exceptionState);
+ EXPECT_EQ(startTime, player->startTime());
+ player->pause();
+ EXPECT_TRUE(std::isnan(player->startTime()));
+}
+
+TEST_F(AnimationAnimationPlayerTest, StartTimeWithZeroPlaybackRate)
+{
+ player->setPlaybackRate(0);
+ EXPECT_TRUE(std::isnan(player->startTime()));
+}
+
TEST_F(AnimationAnimationPlayerTest, SetStartTimeWhilePaused)
{
updateTimeline(10);
@@ -257,7 +276,6 @@ TEST_F(AnimationAnimationPlayerTest, SetStartTimeWhilePaused)
EXPECT_EQ(10, player->currentTimeInternal());
}
-
TEST_F(AnimationAnimationPlayerTest, PausePlay)
{
updateTimeline(10);
« no previous file with comments | « Source/core/animation/AnimationPlayer.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698