| Index: cc/input/scrollbar_animation_controller_unittest.cc
|
| diff --git a/cc/input/scrollbar_animation_controller_unittest.cc b/cc/input/scrollbar_animation_controller_unittest.cc
|
| index 4ece3c5c448b64d5178414883b3b2b6f85a3bf0e..37bd6f4340e66f0cbfcd6d9b3e0ae1be7494d5ac 100644
|
| --- a/cc/input/scrollbar_animation_controller_unittest.cc
|
| +++ b/cc/input/scrollbar_animation_controller_unittest.cc
|
| @@ -143,18 +143,18 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, AppearOnResize) {
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
| ExpectScrollbarsOpacity(1);
|
|
|
| // Make the Layer non-scrollable, scrollbar disappears.
|
| clip_layer_->SetBounds(gfx::Size(200, 200));
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| ExpectScrollbarsOpacity(0);
|
|
|
| // Make the layer scrollable, scrollbar appears again.
|
| clip_layer_->SetBounds(gfx::Size(100, 100));
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| ExpectScrollbarsOpacity(1);
|
| }
|
|
|
| @@ -173,7 +173,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, HideOnResize) {
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
|
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->Opacity());
|
|
|
| scrollbar_controller_->DidScrollEnd();
|
| @@ -185,7 +185,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, HideOnResize) {
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
|
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FLOAT_EQ(0.0f, h_scrollbar_layer_->Opacity());
|
|
|
| scrollbar_controller_->DidScrollEnd();
|
| @@ -205,7 +205,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, BasicAppearAndFadeOut) {
|
| ExpectScrollbarsOpacity(0);
|
| EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden());
|
|
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| ExpectScrollbarsOpacity(1);
|
| EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden());
|
|
|
| @@ -234,7 +234,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveNearAndDontFadeOut) {
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // An fade out animation should have been enqueued.
|
| @@ -275,7 +275,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveOverAndDontFadeOut) {
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // An fade out animation should have been enqueued.
|
| @@ -317,7 +317,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // An fade out animation should have been enqueued.
|
| @@ -345,7 +345,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // An fade out animation should have been enqueued.
|
| @@ -381,7 +381,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeWhileCaptured) {
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // An fade out animation should have been enqueued.
|
| @@ -418,7 +418,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, FadeAfterReleasedFar) {
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // An fade out animation should have been enqueued.
|
| @@ -469,7 +469,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeAfterReleasedNear) {
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // An fade out animation should have been enqueued.
|
| @@ -508,7 +508,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // A fade out animation should have been enqueued. Start it.
|
| @@ -548,7 +548,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, TestCantCaptureWhenFaded) {
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| EXPECT_EQ(kFadeOutDelay, client_.delay());
|
| @@ -612,7 +612,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, ScrollWithMouseNear) {
|
| h_scrollbar_layer_->thumb_thickness_scale_factor());
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
|
|
| // Now that we've received a scroll, we should be thick without an animation.
|
| ExpectScrollbarsOpacity(1);
|
| @@ -647,7 +647,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
|
| // A ScrollUpdate without a ScrollBegin indicates a main thread scroll update
|
| // so we should schedule a fade out animation without waiting for a ScrollEnd
|
| // (which will never come).
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FALSE(client_.start_fade().is_null());
|
| EXPECT_EQ(kFadeOutDelay, client_.delay());
|
|
|
| @@ -656,7 +656,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
|
| // If we got a ScrollBegin, we shouldn't schedule the fade out animation until
|
| // we get a corresponding ScrollEnd.
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_TRUE(client_.start_fade().is_null());
|
| scrollbar_controller_->DidScrollEnd();
|
| EXPECT_FALSE(client_.start_fade().is_null());
|
| @@ -668,16 +668,16 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
|
| TEST_F(ScrollbarAnimationControllerAuraOverlayTest, ResizeFadeDuration) {
|
| ASSERT_TRUE(client_.delay().is_zero());
|
|
|
| - scrollbar_controller_->DidScrollUpdate(true);
|
| + scrollbar_controller_->DidResize();
|
| EXPECT_FALSE(client_.start_fade().is_null());
|
| EXPECT_EQ(kResizeFadeOutDelay, client_.delay());
|
|
|
| client_.delay() = base::TimeDelta();
|
|
|
| // We should use the gesture delay rather than the resize delay if we're in a
|
| - // gesture scroll, even if the resize param is set.
|
| + // gesture scroll, even if it is resizing.
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(true);
|
| + scrollbar_controller_->DidResize();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| EXPECT_FALSE(client_.start_fade().is_null());
|
| @@ -691,7 +691,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, FadeAnimated) {
|
|
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // Appearance is instant.
|
| @@ -723,7 +723,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, NotifyChangedVisibility) {
|
| EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(1);
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden());
|
| Mock::VerifyAndClearExpectations(&client_);
|
|
|
| @@ -758,7 +758,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, NotifyChangedVisibility) {
|
| // Calling DidScrollUpdate without a begin (i.e. update from commit) should
|
| // also notify.
|
| EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(1);
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden());
|
| Mock::VerifyAndClearExpectations(&client_);
|
| }
|
| @@ -771,7 +771,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
|
|
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // Near vertical scrollbar
|
| @@ -864,7 +864,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearBoth) {
|
|
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // Near both Scrollbar
|
| @@ -894,7 +894,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
|
|
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // Near vertical scrollbar.
|
| @@ -960,7 +960,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseLeaveFadeOut) {
|
|
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // Should not have delay fadeout animation.
|
| @@ -1099,8 +1099,10 @@ TEST_F(ScrollbarAnimationControllerAndroidTest, DelayAnimationOnResize) {
|
| ->effect_tree.OnOpacityAnimated(0.0f,
|
| scrollbar_layer_->effect_tree_index(),
|
| scrollbar_layer_->layer_tree_impl());
|
| + // We should use the gesture delay rather than the resize delay if we're in a
|
| + // gesture scroll, even if it is resizing.
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(true);
|
| + scrollbar_controller_->DidResize();
|
| scrollbar_controller_->DidScrollEnd();
|
| // Normal Animation delay of 2 seconds.
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
| @@ -1111,7 +1113,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest, DelayAnimationOnResize) {
|
| ->effect_tree.OnOpacityAnimated(0.0f,
|
| scrollbar_layer_->effect_tree_index(),
|
| scrollbar_layer_->layer_tree_impl());
|
| - scrollbar_controller_->DidScrollUpdate(true);
|
| + scrollbar_controller_->DidResize();
|
| // Delay animation on resize to 5 seconds.
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
| EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(5));
|
| @@ -1162,7 +1164,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest, HideOnResize) {
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
|
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
|
|
| scrollbar_controller_->DidScrollEnd();
|
| @@ -1174,7 +1176,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest, HideOnResize) {
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
|
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
|
|
|
| scrollbar_controller_->DidScrollEnd();
|
| @@ -1193,7 +1195,7 @@ TEST_F(VerticalScrollbarAnimationControllerAndroidTest, HideOnResize) {
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
|
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
|
|
|
| scrollbar_controller_->DidScrollEnd();
|
| @@ -1204,7 +1206,7 @@ TEST_F(VerticalScrollbarAnimationControllerAndroidTest, HideOnResize) {
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
|
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
|
|
| scrollbar_controller_->DidScrollEnd();
|
| @@ -1219,7 +1221,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest, HideOnUserNonScrollableHorz) {
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
|
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
|
|
|
| scrollbar_controller_->DidScrollEnd();
|
| @@ -1234,7 +1236,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest, ShowOnUserNonScrollableVert) {
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
|
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
|
|
| scrollbar_controller_->DidScrollEnd();
|
| @@ -1250,7 +1252,7 @@ TEST_F(VerticalScrollbarAnimationControllerAndroidTest,
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
|
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
|
|
|
| scrollbar_controller_->DidScrollEnd();
|
| @@ -1266,7 +1268,7 @@ TEST_F(VerticalScrollbarAnimationControllerAndroidTest,
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
|
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
|
|
| scrollbar_controller_->DidScrollEnd();
|
| @@ -1278,7 +1280,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest, AwakenByScrollingGesture) {
|
| scrollbar_controller_->DidScrollBegin();
|
| EXPECT_FALSE(did_request_animate_);
|
|
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FALSE(did_request_animate_);
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
|
|
| @@ -1316,7 +1318,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest, AwakenByScrollingGesture) {
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| scrollbar_controller_->DidScrollBegin();
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| start_fade_.Run();
|
| @@ -1350,7 +1352,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest, AwakenByScrollingGesture) {
|
| TEST_F(ScrollbarAnimationControllerAndroidTest, AwakenByProgrammaticScroll) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FALSE(did_request_animate_);
|
|
|
| start_fade_.Run();
|
| @@ -1366,7 +1368,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest, AwakenByProgrammaticScroll) {
|
| EXPECT_TRUE(did_request_animate_);
|
| did_request_animate_ = false;
|
| EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FALSE(did_request_animate_);
|
|
|
| start_fade_.Run();
|
| @@ -1391,7 +1393,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest, AwakenByProgrammaticScroll) {
|
| EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
|
|
|
| time += base::TimeDelta::FromSeconds(1);
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| start_fade_.Run();
|
| time += base::TimeDelta::FromSeconds(1);
|
| scrollbar_controller_->Animate(time);
|
| @@ -1421,7 +1423,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest,
|
| AnimationPreservedByNonScrollingGesture) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| start_fade_.Run();
|
| EXPECT_TRUE(did_request_animate_);
|
| did_request_animate_ = false;
|
| @@ -1460,7 +1462,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest,
|
| AnimationOverriddenByScrollingGesture) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FALSE(did_request_animate_);
|
| start_fade_.Run();
|
| EXPECT_TRUE(did_request_animate_);
|
| @@ -1486,7 +1488,7 @@ TEST_F(ScrollbarAnimationControllerAndroidTest,
|
| EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
|
|
|
| time += base::TimeDelta::FromSeconds(1);
|
| - scrollbar_controller_->DidScrollUpdate(false);
|
| + scrollbar_controller_->WillUpdateScroll();
|
| EXPECT_FALSE(did_request_animate_);
|
| EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
|
|
|
|
|