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 c036732cf928239abf84ac034927652940d1b44d..65a2df9b531863c169e1e7b91c0b566a6d0c36b9 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. |
@@ -1121,8 +1121,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()); |
@@ -1133,7 +1135,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)); |
@@ -1184,7 +1186,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(); |
@@ -1196,7 +1198,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(); |
@@ -1215,7 +1217,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(); |
@@ -1226,7 +1228,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(); |
@@ -1241,7 +1243,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(); |
@@ -1256,7 +1258,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(); |
@@ -1272,7 +1274,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(); |
@@ -1288,7 +1290,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(); |
@@ -1300,7 +1302,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()); |
@@ -1338,7 +1340,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(); |
@@ -1372,7 +1374,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(); |
@@ -1388,7 +1390,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(); |
@@ -1413,7 +1415,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); |
@@ -1443,7 +1445,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; |
@@ -1482,7 +1484,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_); |
@@ -1508,7 +1510,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()); |