| 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 9d2fee7152b3197771b3bce825f3b43280ce0d96..1276da4d4f32eaa7ac18704ca0fd9acba6a326ef 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 remains visible as long as the mouse is near the scrollbar.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearAndDontFadeOut) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, MoveNearAndDontFadeOut) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -216,7 +219,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearAndDontFadeOut) {
|
|
|
| // 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());
|
| @@ -238,7 +241,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearAndDontFadeOut) {
|
|
|
| // Scroll content. Move the mouse over the scrollbar and confirm it becomes
|
| // thick. Ensure it remains visible as long as the mouse is over the scrollbar.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, MoveOverAndDontFadeOut) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, MoveOverAndDontFadeOut) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -253,7 +256,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MoveOverAndDontFadeOut) {
|
|
|
| // 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());
|
| @@ -275,7 +278,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MoveOverAndDontFadeOut) {
|
|
|
| // 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);
|
| @@ -290,7 +293,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());
|
| @@ -302,7 +305,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);
|
|
|
| @@ -316,7 +319,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, DontFadeWhileCaptured) {
|
| EXPECT_FALSE(client_.start_fade().IsCancelled());
|
|
|
| // 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);
|
| @@ -337,7 +340,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, DontFadeWhileCaptured) {
|
|
|
| // Make sure releasing a captured scrollbar when the mouse isn't near it, causes
|
| // the scrollbar to fade out.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, FadeAfterReleasedFar) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest, FadeAfterReleasedFar) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -351,7 +354,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, FadeAfterReleasedFar) {
|
| EXPECT_FALSE(client_.start_fade().IsCancelled());
|
|
|
| // 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());
|
| @@ -363,7 +366,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, FadeAfterReleasedFar) {
|
|
|
| // Now move the mouse away from the scrollbar and release it.
|
| scrollbar_controller_->DidMouseMoveNear(
|
| - kDefaultMouseMoveDistanceToTriggerAnimation + 1);
|
| + HORIZONTAL, kDefaultMouseMoveDistanceToTriggerAnimation + 1);
|
| scrollbar_controller_->DidMouseUp();
|
|
|
| scrollbar_controller_->Animate(time);
|
| @@ -382,7 +385,8 @@ TEST_F(ScrollbarAnimationControllerThinningTest, FadeAfterReleasedFar) {
|
|
|
| // Make sure releasing a captured scrollbar when the mouse is near/over it,
|
| // doesn't cause the scrollbar to fade out.
|
| -TEST_F(ScrollbarAnimationControllerThinningTest, DontFadeAfterReleasedNear) {
|
| +TEST_F(SingleScrollbarAnimationControllerThinningTest,
|
| + DontFadeAfterReleasedNear) {
|
| base::TimeTicks time;
|
| time += base::TimeDelta::FromSeconds(1);
|
|
|
| @@ -396,7 +400,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, DontFadeAfterReleasedNear) {
|
| EXPECT_FALSE(client_.start_fade().IsCancelled());
|
|
|
| // 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());
|
| @@ -416,7 +420,8 @@ TEST_F(ScrollbarAnimationControllerThinningTest, DontFadeAfterReleasedNear) {
|
|
|
| // 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);
|
|
|
| @@ -439,7 +444,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());
|
| @@ -452,7 +457,8 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearScrollbarWhileFading) {
|
| }
|
|
|
| // 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);
|
|
|
| @@ -474,7 +480,7 @@ TEST_F(ScrollbarAnimationControllerThinningTest, TestCantCaptureWhenFaded) {
|
|
|
| // Move mouse over the scrollbar. It shouldn't thicken the scrollbar since
|
| // it's completely faded out.
|
| - scrollbar_controller_->DidMouseMoveNear(0);
|
| + scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 0);
|
| scrollbar_controller_->Animate(time);
|
| time += kThinningDuration;
|
| scrollbar_controller_->Animate(time);
|
| @@ -502,11 +508,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;
|
|
|
| @@ -542,7 +548,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);
|
|
|
| @@ -551,7 +557,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,
|
| @@ -564,7 +570,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);
|
| @@ -573,7 +579,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);
|
| @@ -584,7 +590,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);
|
| @@ -593,7 +599,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,
|
| @@ -606,7 +612,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);
|
| @@ -616,7 +622,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);
|
| @@ -625,7 +631,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);
|
| @@ -637,7 +643,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();
|
| @@ -647,7 +653,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,
|
| @@ -677,7 +683,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());
|
| @@ -709,7 +715,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();
|
| @@ -720,7 +726,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);
|
| @@ -741,7 +747,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());
|
| @@ -763,7 +769,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);
|
| @@ -773,7 +780,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);
|
| @@ -791,7 +798,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);
|
| @@ -801,7 +808,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);
|
| @@ -813,7 +820,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();
|
| @@ -824,7 +831,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);
|
| @@ -847,7 +854,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);
|
| @@ -858,7 +865,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());
|
| @@ -875,7 +882,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());
|
|
|
| @@ -892,7 +899,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
|
| @@ -916,7 +924,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);
|
| @@ -936,7 +944,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);
|
| @@ -967,7 +975,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);
|
|
|
|
|