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

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

Issue 1548883002: Revert of Run smooth scroll animations on the compositor when possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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: 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 d21b14968c2ed37d0795574bb78c9ff4d45e66cf..b72c7105ce4976c93be31e0f759ff0eb1fb89603 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
@@ -73,7 +73,6 @@
MOCK_CONST_METHOD0(scrollbarsCanBeActive, bool());
MOCK_CONST_METHOD0(scrollableAreaBoundingBox, IntRect());
MOCK_METHOD0(registerForAnimation, void());
- MOCK_METHOD0(scheduleAnimation, bool());
bool userInputScrollable(ScrollbarOrientation) const override { return true; }
bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; }
@@ -102,32 +101,30 @@
scrollAnimator.scrollToOffsetWithoutAnimation(FloatPoint());
}
-TEST(ScrollAnimatorTest, MainThreadEnabled)
+TEST(ScrollAnimatorTest, Enabled)
{
OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::create(true);
OwnPtrWillBeRawPtr<ScrollAnimator> scrollAnimator = adoptPtrWillBeNoop(new ScrollAnimator(scrollableArea.get(), getMockedTime));
EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1)).WillRepeatedly(Return(IntPoint()));
EXPECT_CALL(*scrollableArea, maximumScrollPosition()).Times(AtLeast(1)).WillRepeatedly(Return(IntPoint(1000, 1000)));
- EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(9);
+ EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(12);
EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(3);
- EXPECT_CALL(*scrollableArea, scheduleAnimation()).Times(AtLeast(1)).WillRepeatedly(Return(true));
-
- EXPECT_FALSE(scrollAnimator->hasAnimationThatRequiresService());
+
+ EXPECT_FALSE(scrollAnimator->hasRunningAnimation());
ScrollResultOneDimensional result = scrollAnimator->userScroll(HorizontalScrollbar, ScrollByLine, 100, -1);
- EXPECT_FALSE(scrollAnimator->hasAnimationThatRequiresService());
+ EXPECT_FALSE(scrollAnimator->hasRunningAnimation());
EXPECT_FALSE(result.didScroll);
EXPECT_FLOAT_EQ(-1.0f, result.unusedScrollDelta);
result = scrollAnimator->userScroll(HorizontalScrollbar, ScrollByLine, 100, 1);
- EXPECT_TRUE(scrollAnimator->hasAnimationThatRequiresService());
+ EXPECT_TRUE(scrollAnimator->hasRunningAnimation());
EXPECT_TRUE(result.didScroll);
EXPECT_FLOAT_EQ(0.0, result.unusedScrollDelta);
gMockedTime += 0.05;
- scrollAnimator->updateCompositorAnimations();
- scrollAnimator->tickAnimation(getMockedTime());
+ scrollAnimator->serviceScrollAnimations();
EXPECT_NE(100, scrollAnimator->currentPosition().x());
EXPECT_NE(0, scrollAnimator->currentPosition().x());
@@ -135,11 +132,10 @@
reset(*scrollAnimator);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPage, 100, 1);
- EXPECT_TRUE(scrollAnimator->hasAnimationThatRequiresService());
+ EXPECT_TRUE(scrollAnimator->hasRunningAnimation());
gMockedTime += 0.05;
- scrollAnimator->updateCompositorAnimations();
- scrollAnimator->tickAnimation(getMockedTime());
+ scrollAnimator->serviceScrollAnimations();
EXPECT_NE(100, scrollAnimator->currentPosition().x());
EXPECT_NE(0, scrollAnimator->currentPosition().x());
@@ -147,27 +143,25 @@
reset(*scrollAnimator);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPixel, 4, 25);
- EXPECT_TRUE(scrollAnimator->hasAnimationThatRequiresService());
+ EXPECT_TRUE(scrollAnimator->hasRunningAnimation());
gMockedTime += 0.05;
- scrollAnimator->updateCompositorAnimations();
- scrollAnimator->tickAnimation(getMockedTime());
+ scrollAnimator->serviceScrollAnimations();
EXPECT_NE(100, scrollAnimator->currentPosition().x());
EXPECT_NE(0, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
gMockedTime += 1.0;
- scrollAnimator->updateCompositorAnimations();
- scrollAnimator->tickAnimation(getMockedTime());
-
- EXPECT_FALSE(scrollAnimator->hasAnimationThatRequiresService());
+ scrollAnimator->serviceScrollAnimations();
+
+ EXPECT_FALSE(scrollAnimator->hasRunningAnimation());
EXPECT_EQ(100, scrollAnimator->currentPosition().x());
reset(*scrollAnimator);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPrecisePixel, 4, 25);
- EXPECT_FALSE(scrollAnimator->hasAnimationThatRequiresService());
+ EXPECT_FALSE(scrollAnimator->hasRunningAnimation());
EXPECT_EQ(100, scrollAnimator->currentPosition().x());
EXPECT_NE(0, scrollAnimator->currentPosition().x());

Powered by Google App Engine
This is Rietveld 408576698