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

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

Issue 555063002: Web Animations: Add tests for player state transitions and fix discovered issues (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Address comments. Created 6 years, 3 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.cpp ('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 301a8fac4f727d46e0af081f5d82b6e75977bf13..017f6d8b3d36ee1d25f2bb8cae7f12d362c96c25 100644
--- a/Source/core/animation/AnimationPlayerTest.cpp
+++ b/Source/core/animation/AnimationPlayerTest.cpp
@@ -284,7 +284,7 @@ TEST_F(AnimationAnimationPlayerTest, StartTimePauseFinish)
EXPECT_EQ(AnimationPlayer::Pending, player->playStateInternal());
EXPECT_TRUE(std::isnan(player->startTime()));
player->finish(exceptionState);
- EXPECT_EQ(AnimationPlayer::Pending, player->playStateInternal());
+ EXPECT_EQ(AnimationPlayer::Paused, player->playStateInternal());
EXPECT_TRUE(std::isnan(player->startTime()));
}
@@ -300,9 +300,8 @@ TEST_F(AnimationAnimationPlayerTest, PauseBeatsFinish)
TEST_F(AnimationAnimationPlayerTest, StartTimeFinishPause)
{
- double startTime = player->startTime();
player->finish(exceptionState);
- EXPECT_EQ(startTime, player->startTime());
+ EXPECT_EQ(-30 * 1000, player->startTime());
player->pause();
EXPECT_TRUE(std::isnan(player->startTime()));
}
@@ -461,18 +460,18 @@ TEST_F(AnimationAnimationPlayerTest, ReverseSeeksToEnd)
EXPECT_EQ(30, player->currentTimeInternal());
}
-TEST_F(AnimationAnimationPlayerTest, ReverseLimitsAnimationPlayer)
+TEST_F(AnimationAnimationPlayerTest, ReverseBeyondLimit)
{
player->setCurrentTimeInternal(40);
player->setPlaybackRate(-1);
player->reverse();
- EXPECT_TRUE(player->finished());
- EXPECT_EQ(40, player->currentTimeInternal());
+ EXPECT_EQ(AnimationPlayer::Pending, player->playStateInternal());
+ EXPECT_EQ(0, player->currentTimeInternal());
player->setCurrentTimeInternal(-10);
player->reverse();
- EXPECT_TRUE(player->finished());
- EXPECT_EQ(-10, player->currentTimeInternal());
+ EXPECT_EQ(AnimationPlayer::Pending, player->playStateInternal());
+ EXPECT_EQ(30, player->currentTimeInternal());
}
@@ -849,8 +848,6 @@ TEST_F(AnimationAnimationPlayerTest, PlayBackwardsAfterCancel)
EXPECT_EQ(40 * 1000, player->startTime());
}
-// FIXME: crbug.com/410229, when fixed, will reuqire the expected results of
-// this test to change (currentTime -> 30 * 1000).
TEST_F(AnimationAnimationPlayerTest, ReverseAfterCancel)
{
player->cancel();
@@ -859,12 +856,12 @@ TEST_F(AnimationAnimationPlayerTest, ReverseAfterCancel)
EXPECT_TRUE(std::isnan(player->startTime()));
player->reverse();
EXPECT_EQ(AnimationPlayer::Pending, player->playStateInternal());
- EXPECT_TRUE(std::isnan(player->currentTime()));
+ EXPECT_EQ(30 * 1000, player->currentTime());
EXPECT_TRUE(std::isnan(player->startTime()));
simulateFrame(10);
- EXPECT_EQ(AnimationPlayer::Finished, player->playStateInternal());
- EXPECT_EQ(0 * 1000, player->currentTime());
- EXPECT_EQ(10 * 1000, player->startTime());
+ EXPECT_EQ(AnimationPlayer::Running, player->playStateInternal());
+ EXPECT_EQ(30 * 1000, player->currentTime());
+ EXPECT_EQ(40 * 1000, player->startTime());
}
TEST_F(AnimationAnimationPlayerTest, FinishAfterCancel)
@@ -874,9 +871,9 @@ TEST_F(AnimationAnimationPlayerTest, FinishAfterCancel)
EXPECT_TRUE(std::isnan(player->currentTime()));
EXPECT_TRUE(std::isnan(player->startTime()));
player->finish(exceptionState);
- EXPECT_EQ(AnimationPlayer::Finished, player->playStateInternal());
- EXPECT_EQ(30 * 1000, player->currentTime());
- EXPECT_EQ(0, player->startTime());
+ EXPECT_TRUE(std::isnan(player->currentTime()));
+ EXPECT_TRUE(std::isnan(player->startTime()));
+ EXPECT_EQ(AnimationPlayer::Idle, player->playStateInternal());
}
TEST_F(AnimationAnimationPlayerTest, PauseAfterCancel)
« no previous file with comments | « Source/core/animation/AnimationPlayer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698