| Index: cc/input/single_scrollbar_animation_controller_thinning_unittest.cc
|
| diff --git a/cc/input/scrollbar_animation_controller_thinning_unittest.cc b/cc/input/single_scrollbar_animation_controller_thinning_unittest.cc
|
| similarity index 89%
|
| copy from cc/input/scrollbar_animation_controller_thinning_unittest.cc
|
| copy to cc/input/single_scrollbar_animation_controller_thinning_unittest.cc
|
| index 243602ba6adc177efe609a1c827e3358b5b7b54e..e1d9f2bb9705e1cb582bf0a988b137c29b2a42ad 100644
|
| --- a/cc/input/scrollbar_animation_controller_thinning_unittest.cc
|
| +++ b/cc/input/single_scrollbar_animation_controller_thinning_unittest.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "cc/input/scrollbar_animation_controller_thinning.h"
|
| +#include "cc/input/single_scrollbar_animation_controller_thinning.h"
|
|
|
| #include "cc/layers/solid_color_scrollbar_layer_impl.h"
|
| #include "cc/test/fake_impl_task_runner_provider.h"
|
| @@ -22,16 +22,17 @@ namespace cc {
|
| namespace {
|
|
|
| // These constants are hard-coded and should match the values in
|
| -// scrollbar_animation_controller_thinning.cc.
|
| +// single_scrollbar_animation_controller_thinning.cc.
|
| const float kIdleThicknessScale = 0.4f;
|
| const float kDefaultMouseMoveDistanceToTriggerAnimation = 25.f;
|
|
|
| -class MockScrollbarAnimationControllerClient
|
| +class MockSingleScrollbarAnimationControllerClient
|
| : public ScrollbarAnimationControllerClient {
|
| public:
|
| - explicit MockScrollbarAnimationControllerClient(LayerTreeHostImpl* host_impl)
|
| + explicit MockSingleScrollbarAnimationControllerClient(
|
| + LayerTreeHostImpl* host_impl)
|
| : host_impl_(host_impl) {}
|
| - virtual ~MockScrollbarAnimationControllerClient() {}
|
| + virtual ~MockSingleScrollbarAnimationControllerClient() {}
|
|
|
| void PostDelayedScrollbarAnimationTask(const base::Closure& start_fade,
|
| base::TimeDelta delay) override {
|
| @@ -54,9 +55,9 @@ class MockScrollbarAnimationControllerClient
|
| LayerTreeHostImpl* host_impl_;
|
| };
|
|
|
| -class ScrollbarAnimationControllerThinningTest : public testing::Test {
|
| +class SingleScrollbarAnimationControllerThinningTest : public testing::Test {
|
| public:
|
| - ScrollbarAnimationControllerThinningTest()
|
| + SingleScrollbarAnimationControllerThinningTest()
|
| : host_impl_(&task_runner_provider_, &task_graph_runner_),
|
| client_(&host_impl_) {}
|
|
|
| @@ -98,28 +99,30 @@ class ScrollbarAnimationControllerThinningTest : public testing::Test {
|
| scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
|
| host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting();
|
|
|
| - scrollbar_controller_ = ScrollbarAnimationControllerThinning::Create(
|
| - scroll_layer_ptr->id(), &client_, kDelayBeforeStarting,
|
| + scrollbar_controller_ = SingleScrollbarAnimationControllerThinning::Create(
|
| + scroll_layer_ptr->id(), HORIZONTAL, &client_, kDelayBeforeStarting,
|
| kResizeDelayBeforeStarting, kFadeDuration, kThinningDuration);
|
| }
|
|
|
| FakeImplTaskRunnerProvider task_runner_provider_;
|
| TestTaskGraphRunner task_graph_runner_;
|
| FakeLayerTreeHostImpl host_impl_;
|
| - std::unique_ptr<ScrollbarAnimationControllerThinning> scrollbar_controller_;
|
| + std::unique_ptr<SingleScrollbarAnimationControllerThinning>
|
| + scrollbar_controller_;
|
| LayerImpl* clip_layer_;
|
| SolidColorScrollbarLayerImpl* scrollbar_layer_;
|
| - NiceMock<MockScrollbarAnimationControllerClient> client_;
|
| + NiceMock<MockSingleScrollbarAnimationControllerClient> client_;
|
| };
|
|
|
| // Check initialization of scrollbar. Should start off invisible and thin.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, Idle) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, Idle) {
|
| EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
|
| - EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
|
| + EXPECT_FLOAT_EQ(kIdleThicknessScale,
|
| + scrollbar_layer_->thumb_thickness_scale_factor());
|
| }
|
|
|
| // Check that scrollbar appears again when the layer becomes scrollable.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, AppearOnResize) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, AppearOnResize) {
|
| scrollbar_controller_->DidScrollBegin();
|
| scrollbar_controller_->DidScrollUpdate(false);
|
| scrollbar_controller_->DidScrollEnd();
|
| @@ -137,7 +140,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, AppearOnResize) {
|
| }
|
|
|
| // Check that scrollbar disappears when the layer becomes non-scrollable.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, HideOnResize) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, HideOnResize) {
|
| LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
|
| ASSERT_TRUE(scroll_layer);
|
| EXPECT_EQ(gfx::Size(200, 200), scroll_layer->bounds());
|
| @@ -169,7 +172,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, HideOnResize) {
|
| }
|
|
|
| // Scroll content. Confirm the scrollbar appears and fades out.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, BasicAppearAndFadeOut) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, BasicAppearAndFadeOut) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -201,7 +204,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, BasicAppearAndFadeOut) {
|
|
|
| // Scroll content. Move the mouse near the scrollbar and confirm it becomes
|
| // thick. Ensure it fades out after that.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearAndFadeOut) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, MoveNearAndFadeOut) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -215,7 +218,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearAndFadeOut) {
|
|
|
| // Now move the mouse near the scrollbar. This should cancel the currently
|
| // queued fading animation and start animating thickness.
|
| - scrollbar_controller_->DidMouseMoveNear(1);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 1);
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
| EXPECT_FLOAT_EQ(kIdleThicknessScale,
|
| scrollbar_layer_->thumb_thickness_scale_factor());
|
| @@ -236,7 +239,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearAndFadeOut) {
|
|
|
| // Scroll content. Move the mouse over the scrollbar and confirm it becomes
|
| // thick. Ensure it fades out after that.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, MoveOverAndFadeOut) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, MoveOverAndFadeOut) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -250,7 +253,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MoveOverAndFadeOut) {
|
|
|
| // Now move the mouse over the scrollbar. This should cancel the currently
|
| // queued fading animation and start animating thickness.
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
| EXPECT_FLOAT_EQ(kIdleThicknessScale,
|
| scrollbar_layer_->thumb_thickness_scale_factor());
|
| @@ -271,7 +274,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MoveOverAndFadeOut) {
|
|
|
| // Make sure a scrollbar captured before the thickening animation doesn't try
|
| // to fade out.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest,
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest,
|
| DontFadeWhileCapturedBeforeThick) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
| @@ -286,7 +289,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest,
|
|
|
| // Now move the mouse over the scrollbar and capture it. It should become
|
| // thick without need for an animation.
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->DidMouseDown();
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
|
| @@ -298,7 +301,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest,
|
|
|
| // Make sure a scrollbar captured after a thickening animation doesn't try to
|
| // fade out.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, DontFadeWhileCaptured) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, DontFadeWhileCaptured) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -311,7 +314,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, DontFadeWhileCaptured) {
|
| EXPECT_FALSE(client_.start_fade().is_null());
|
|
|
| // Now move the mouse over the scrollbar and animate it until it's thick.
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->Animate(time);
|
| time += kThinningDuration;
|
| scrollbar_controller_->Animate(time);
|
| @@ -329,7 +332,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, DontFadeWhileCaptured) {
|
| }
|
|
|
| // Make sure releasing a captured scrollbar causes it to fade out.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, FadeAfterReleased) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, FadeAfterReleased) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -342,7 +345,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, FadeAfterReleased) {
|
| EXPECT_FALSE(client_.start_fade().is_null());
|
|
|
| // Now move the mouse over the scrollbar and capture it.
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->DidMouseDown();
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
|
| @@ -358,7 +361,8 @@ TEST_F(ScrollbarAnimationControllerThinningTest, FadeAfterReleased) {
|
|
|
| // Make sure moving near a scrollbar while it's fading out causes it to reset
|
| // the opacity and thicken.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearScrollbarWhileFading) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest,
|
| + MoveNearScrollbarWhileFading) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -381,7 +385,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearScrollbarWhileFading) {
|
|
|
| // Now move the mouse near the scrollbar. It should reset opacity to 1
|
| // instantly and start animating to thick.
|
| - scrollbar_controller_->DidMouseMoveNear(1);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 1);
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
| EXPECT_FLOAT_EQ(kIdleThicknessScale,
|
| scrollbar_layer_->thumb_thickness_scale_factor());
|
| @@ -395,7 +399,8 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearScrollbarWhileFading) {
|
|
|
| // Make sure capturing a scrollbar while it's fading out causes it to reset the
|
| // opacity and thicken instantly.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, CaptureScrollbarWhileFading) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest,
|
| + CaptureScrollbarWhileFading) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -404,7 +409,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, CaptureScrollbarWhileFading) {
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // Move mouse over the scrollbar.
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->Animate(time);
|
| time += kThinningDuration;
|
| scrollbar_controller_->Animate(time);
|
| @@ -431,7 +436,8 @@ TEST_F(ScrollbarAnimationControllerThinningTest, CaptureScrollbarWhileFading) {
|
| }
|
|
|
| // Make sure we can't capture scrollbar that's completely faded out
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, TestCantCaptureWhenFaded) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest,
|
| + TestCantCaptureWhenFaded) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -440,7 +446,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, TestCantCaptureWhenFaded) {
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| // Move mouse over the scrollbar.
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->Animate(time);
|
| time += kThinningDuration;
|
| scrollbar_controller_->Animate(time);
|
| @@ -478,11 +484,11 @@ TEST_F(ScrollbarAnimationControllerThinningTest, TestCantCaptureWhenFaded) {
|
|
|
| // Initiate a scroll when the pointer is already near the scrollbar. It should
|
| // appear thick and remain thick.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, ScrollWithMouseNear) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, ScrollWithMouseNear) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| - scrollbar_controller_->DidMouseMoveNear(1);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 1);
|
| scrollbar_controller_->Animate(time);
|
| time += kThinningDuration;
|
|
|
| @@ -517,7 +523,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, ScrollWithMouseNear) {
|
|
|
| // Move the pointer near the scrollbar. Confirm it gets thick and narrow when
|
| // moved away.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, MouseNear) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, MouseNear) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -526,7 +532,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseNear) {
|
| scrollbar_controller_->DidScrollUpdate(false);
|
| scrollbar_controller_->DidScrollEnd();
|
|
|
| - scrollbar_controller_->DidMouseMoveNear(1);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 1);
|
| scrollbar_controller_->Animate(time);
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
| EXPECT_FLOAT_EQ(kIdleThicknessScale,
|
| @@ -539,7 +545,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseNear) {
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
|
|
|
| // Subsequent moves within the nearness threshold should not change anything.
|
| - scrollbar_controller_->DidMouseMoveNear(2);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 2);
|
| scrollbar_controller_->Animate(time);
|
| time += base::TimeDelta::FromSeconds(10);
|
| scrollbar_controller_->Animate(time);
|
| @@ -548,7 +554,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseNear) {
|
|
|
| // Now move away from bar.
|
| scrollbar_controller_->DidMouseMoveNear(
|
| - kDefaultMouseMoveDistanceToTriggerAnimation);
|
| + HORIZONTAL, kDefaultMouseMoveDistanceToTriggerAnimation);
|
| scrollbar_controller_->Animate(time);
|
| time += kThinningDuration;
|
| scrollbar_controller_->Animate(time);
|
| @@ -559,7 +565,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseNear) {
|
|
|
| // Move the pointer over the scrollbar. Make sure it gets thick that it gets
|
| // thin when moved away.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, MouseOver) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, MouseOver) {
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| scrollbar_controller_->DidScrollUpdate(false);
|
| @@ -568,7 +574,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseOver) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->Animate(time);
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
| EXPECT_FLOAT_EQ(kIdleThicknessScale,
|
| @@ -581,7 +587,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseOver) {
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
|
|
|
| // Subsequent moves should not change anything.
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->Animate(time);
|
| time += base::TimeDelta::FromSeconds(10);
|
| scrollbar_controller_->Animate(time);
|
| @@ -591,7 +597,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseOver) {
|
| // Moving off the scrollbar but still withing the "near" threshold should do
|
| // nothing.
|
| scrollbar_controller_->DidMouseMoveNear(
|
| - kDefaultMouseMoveDistanceToTriggerAnimation - 1.f);
|
| + HORIZONTAL, kDefaultMouseMoveDistanceToTriggerAnimation - 1.f);
|
| scrollbar_controller_->Animate(time);
|
| time += base::TimeDelta::FromSeconds(10);
|
| scrollbar_controller_->Animate(time);
|
| @@ -600,7 +606,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseOver) {
|
|
|
| // Now move away from bar.
|
| scrollbar_controller_->DidMouseMoveNear(
|
| - kDefaultMouseMoveDistanceToTriggerAnimation);
|
| + HORIZONTAL, kDefaultMouseMoveDistanceToTriggerAnimation);
|
| scrollbar_controller_->Animate(time);
|
| time += kThinningDuration;
|
| scrollbar_controller_->Animate(time);
|
| @@ -612,7 +618,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseOver) {
|
| // First move the pointer over the scrollbar off of it. Make sure the thinning
|
| // animation kicked off in DidMouseMoveOffScrollbar gets overridden by the
|
| // thickening animation in the DidMouseMoveNear call.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest,
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest,
|
| MouseNearThenAwayWhileAnimating) {
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| @@ -622,7 +628,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest,
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->Animate(time);
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
| EXPECT_FLOAT_EQ(kIdleThicknessScale,
|
| @@ -652,7 +658,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest,
|
| // Now we get a notification for the mouse moving over the scroller. The
|
| // animation is reset to the thickening direction but we won't start
|
| // thickening until the new animation catches up to the current thickness.
|
| - scrollbar_controller_->DidMouseMoveNear(1);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 1);
|
| scrollbar_controller_->Animate(time);
|
| EXPECT_FLOAT_EQ(1.0f - (1.0f - kIdleThicknessScale) / 2.0f,
|
| scrollbar_layer_->thumb_thickness_scale_factor());
|
| @@ -684,7 +690,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest,
|
| // First move the pointer on the scrollbar, then press it, then away.
|
| // Confirm that the bar gets thick. Then mouse up. Confirm that
|
| // the bar gets thin.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest,
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest,
|
| MouseCaptureAndReleaseOutOfBar) {
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| @@ -695,7 +701,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest,
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| // Move over the scrollbar.
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->Animate(time);
|
| time += kFadeDuration;
|
| scrollbar_controller_->Animate(time);
|
| @@ -716,7 +722,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest,
|
| // Move outside the "near" threshold. Because the scrollbar is captured it
|
| // should remain thick.
|
| scrollbar_controller_->DidMouseMoveNear(
|
| - kDefaultMouseMoveDistanceToTriggerAnimation);
|
| + HORIZONTAL, kDefaultMouseMoveDistanceToTriggerAnimation);
|
| time += kThinningDuration;
|
| scrollbar_controller_->Animate(time);
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
|
| @@ -738,7 +744,8 @@ TEST_F(ScrollbarAnimationControllerThinningTest,
|
| // First move the pointer on the scrollbar, then press it, then away. Confirm
|
| // that the bar gets thick. Then move point on the scrollbar and mouse up.
|
| // Confirm that the bar stays thick.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, MouseCaptureAndReleaseOnBar) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest,
|
| + MouseCaptureAndReleaseOnBar) {
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| scrollbar_controller_->DidScrollUpdate(false);
|
| @@ -748,7 +755,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseCaptureAndReleaseOnBar) {
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| // Move over scrollbar.
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->Animate(time);
|
| time += kThinningDuration;
|
| scrollbar_controller_->Animate(time);
|
| @@ -766,7 +773,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseCaptureAndReleaseOnBar) {
|
|
|
| // Move away from scrollbar. Nothing should change.
|
| scrollbar_controller_->DidMouseMoveNear(
|
| - kDefaultMouseMoveDistanceToTriggerAnimation);
|
| + HORIZONTAL, kDefaultMouseMoveDistanceToTriggerAnimation);
|
| time += base::TimeDelta::FromSeconds(1);
|
| scrollbar_controller_->Animate(time);
|
| time += base::TimeDelta::FromSeconds(10);
|
| @@ -776,7 +783,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseCaptureAndReleaseOnBar) {
|
|
|
| // Move over scrollbar and release. Since we're near the scrollbar, it should
|
| // remain thick.
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->DidMouseUp();
|
| time += base::TimeDelta::FromSeconds(1);
|
| scrollbar_controller_->Animate(time);
|
| @@ -788,7 +795,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseCaptureAndReleaseOnBar) {
|
|
|
| // Move mouse on scrollbar and capture then move out of window. Confirm that
|
| // the bar stays thick.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest,
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest,
|
| MouseCapturedAndExitWindowFromScrollbar) {
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| @@ -799,7 +806,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest,
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| // Move mouse over scrollbar.
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->Animate(time);
|
| time += kThinningDuration;
|
| scrollbar_controller_->Animate(time);
|
| @@ -822,7 +829,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest,
|
| }
|
|
|
| // Tests that the thickening/thinning effects are animated.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, ThicknessAnimated) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, ThicknessAnimated) {
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| scrollbar_controller_->DidScrollUpdate(false);
|
| @@ -833,7 +840,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, ThicknessAnimated) {
|
|
|
| // Move mouse near scrollbar. Test that at half the duration time, the
|
| // thickness is half way through its animation.
|
| - scrollbar_controller_->DidMouseMoveNear(1);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 1);
|
| scrollbar_controller_->Animate(time);
|
| EXPECT_FLOAT_EQ(kIdleThicknessScale,
|
| scrollbar_layer_->thumb_thickness_scale_factor());
|
| @@ -850,7 +857,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, ThicknessAnimated) {
|
| // Move mouse away from scrollbar. Same check.
|
| time += base::TimeDelta::FromSeconds(1);
|
| scrollbar_controller_->DidMouseMoveNear(
|
| - kDefaultMouseMoveDistanceToTriggerAnimation);
|
| + HORIZONTAL, kDefaultMouseMoveDistanceToTriggerAnimation);
|
| scrollbar_controller_->Animate(time);
|
| EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
|
|
|
| @@ -867,7 +874,8 @@ TEST_F(ScrollbarAnimationControllerThinningTest, ThicknessAnimated) {
|
|
|
| // Tests that main thread scroll updates immediatley queue a fade animation
|
| // without requiring a ScrollEnd.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, MainThreadScrollQueuesFade) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest,
|
| + MainThreadScrollQueuesFade) {
|
| ASSERT_TRUE(client_.start_fade().is_null());
|
|
|
| // A ScrollUpdate without a ScrollBegin indicates a main thread scroll update
|
| @@ -891,7 +899,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MainThreadScrollQueuesFade) {
|
|
|
| // Make sure that if the scroll update is as a result of a resize, we use the
|
| // resize delay time instead of the default one.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, ResizeFadeDuration) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, ResizeFadeDuration) {
|
| ASSERT_TRUE(client_.delay().is_zero());
|
|
|
| scrollbar_controller_->DidScrollUpdate(true);
|
| @@ -911,7 +919,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, ResizeFadeDuration) {
|
| }
|
|
|
| // Tests that the fade effect is animated.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, FadeAnimated) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, FadeAnimated) {
|
| // Scroll to make the scrollbars visible.
|
| scrollbar_controller_->DidScrollBegin();
|
| scrollbar_controller_->DidScrollUpdate(false);
|
| @@ -942,7 +950,8 @@ TEST_F(ScrollbarAnimationControllerThinningTest, FadeAnimated) {
|
| }
|
|
|
| // Tests that the controller tells the client when the scrollbars hide/show.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, NotifyChangedVisibility) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest,
|
| + NotifyChangedVisibility) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
|
|