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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp

Issue 2336823003: Fix ScrollAnimator::hasRunningAnimation to account for the PostAnimationCleanup (Closed)
Patch Set: comment update Created 4 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 | « third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
index b645cf3bdeb970a98e3113f03a8e4c4403272aa6..b94edc041f9ba2ff98927b4e564994b6b66c6414 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
@@ -601,9 +601,9 @@ TEST(ScrollAnimatorTest, MainThreadAnimationTargetAdjustment)
.WillRepeatedly(Return(IntPoint(-100, -100)));
EXPECT_CALL(*scrollableArea, maximumScrollPosition()).Times(AtLeast(1))
.WillRepeatedly(Return(IntPoint(1000, 1000)));
- // Twice from tickAnimation, once from reset, and once from
+ // Twice from tickAnimation, once from reset, and twice from
// adjustAnimationAndSetScrollPosition.
- EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(4);
+ EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(5);
// One from call to userScroll and one from updateCompositorAnimations.
EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(2);
EXPECT_CALL(*scrollableArea, scheduleAnimation()).Times(AtLeast(1))
@@ -630,11 +630,18 @@ TEST(ScrollAnimatorTest, MainThreadAnimationTargetAdjustment)
animator->adjustAnimationAndSetScrollPosition(newPos, AnchoringScroll);
EXPECT_EQ(FloatPoint(110, 90), animator->desiredTargetPosition());
- // Animation finished
+ // Adjusting after finished animation should do nothing.
gMockedTime += 1.0;
animator->updateCompositorAnimations();
animator->tickAnimation(getMockedTime());
- EXPECT_EQ(FloatPoint(110, 90), animator->currentPosition());
+ EXPECT_EQ(animator->runStateForTesting(),
+ ScrollAnimatorCompositorCoordinator::RunState::PostAnimationCleanup);
+ newPos = animator->currentPosition() + FloatSize(10, -10);
+ animator->adjustAnimationAndSetScrollPosition(newPos, AnchoringScroll);
+ EXPECT_EQ(animator->runStateForTesting(),
+ ScrollAnimatorCompositorCoordinator::RunState::PostAnimationCleanup);
+ EXPECT_EQ(FloatPoint(110, 90), animator->desiredTargetPosition());
+
reset(*animator);
// Forced GC in order to finalize objects depending on the mock object.
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698