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

Unified Diff: cc/input/scrollbar_animation_controller_unittest.cc

Issue 2841943002: Overlay scrollbars expand only when mouse is near thumb (Closed)
Patch Set: bokan comments#8 addressed Created 3 years, 8 months 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: 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 c956ba639729abb69f2f347922817f5f00b95fa0..a326ddfbff37a4aaf0ccd61950a450fb8a83cb8e 100644
--- a/cc/input/scrollbar_animation_controller_unittest.cc
+++ b/cc/input/scrollbar_animation_controller_unittest.cc
@@ -23,11 +23,11 @@ namespace {
const float kIdleThicknessScale =
SingleScrollbarAnimationControllerThinning::kIdleThicknessScale;
-const float kDefaultMouseMoveDistanceToTriggerAnimation =
- SingleScrollbarAnimationControllerThinning::
- kDefaultMouseMoveDistanceToTriggerAnimation;
const float kMouseMoveDistanceToTriggerFadeIn =
ScrollbarAnimationController::kMouseMoveDistanceToTriggerFadeIn;
+const float kMouseMoveDistanceToTriggerExpand =
+ SingleScrollbarAnimationControllerThinning::
+ kMouseMoveDistanceToTriggerExpand;
const int kThumbThickness = 10;
class MockScrollbarAnimationControllerClient
@@ -87,6 +87,7 @@ class ScrollbarAnimationControllerAuraOverlayTest : public testing::Test {
LayerImpl* scroll_layer_ptr = scroll_layer.get();
const int kTrackStart = 0;
+ const int kTrackLength = 100;
const bool kIsLeftSideVerticalScrollbar = false;
const bool kIsOverlayScrollbar = true;
@@ -106,10 +107,16 @@ class ScrollbarAnimationControllerAuraOverlayTest : public testing::Test {
clip_layer_->test_properties()->AddChild(std::move(scroll_layer));
host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip));
+ v_scrollbar_layer_->SetBounds(gfx::Size(kThumbThickness, kTrackLength));
+ v_scrollbar_layer_->SetPosition(gfx::PointF(90, 0));
v_scrollbar_layer_->SetScrollElementId(scroll_layer_ptr->element_id());
- h_scrollbar_layer_->SetScrollElementId(scroll_layer_ptr->element_id());
v_scrollbar_layer_->test_properties()->opacity_can_animate = true;
+
+ h_scrollbar_layer_->SetBounds(gfx::Size(kTrackLength, kThumbThickness));
+ h_scrollbar_layer_->SetPosition(gfx::PointF(0, 90));
+ h_scrollbar_layer_->SetScrollElementId(scroll_layer_ptr->element_id());
h_scrollbar_layer_->test_properties()->opacity_can_animate = true;
+
clip_layer_->SetBounds(gfx::Size(100, 100));
scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting();
@@ -118,6 +125,31 @@ class ScrollbarAnimationControllerAuraOverlayTest : public testing::Test {
CreateScrollbarAnimationControllerAuraOverlay(
scroll_layer_ptr->element_id(), &client_, kFadeDelay,
kResizeFadeOutDelay, kFadeDuration, kThinningDuration);
+
+ v_scrollbar_layer_->SetCurrentPos(0);
+ h_scrollbar_layer_->SetCurrentPos(0);
+ }
+
+ // Return a point with given offset from the top-left of vertical scrollbar.
+ gfx::PointF NearVerticalScrollbarBegin(float offset_x, float offset_y) {
+ gfx::PointF p(90, 0);
+ p.Offset(offset_x, offset_y);
+ return p;
+ }
+
+ // Return a point with given offset from the bottom-left of vertical
+ // scrollbar.
+ gfx::PointF NearVerticalScrollbarEnd(float offset_x, float offset_y) {
+ gfx::PointF p(90, 90);
+ p.Offset(offset_x, offset_y);
+ return p;
+ }
+
+ // Return a point with given offset from the top-left of horizontal scrollbar.
+ gfx::PointF NearHorizontalScrollbarBegin(float offset_x, float offset_y) {
+ gfx::PointF p(0, 90);
+ p.Offset(offset_x, offset_y);
+ return p;
}
FakeImplTaskRunnerProvider task_runner_provider_;
@@ -259,8 +291,70 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden());
}
-// 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.
+// Scroll content. Move the mouse near the scrollbar track but not near thumb
+// and confirm it stay thin. Move the mouse near the scrollbar thumb and
+// confirm it becomes thick.
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
+ MoveNearTrackThenNearThumb) {
+ base::TimeTicks time;
+ time += base::TimeDelta::FromSeconds(1);
+
+ scrollbar_controller_->DidScrollBegin();
+ scrollbar_controller_->DidScrollUpdate();
+ scrollbar_controller_->DidScrollEnd();
+
+ // An fade out animation should have been enqueued.
+ EXPECT_EQ(kFadeDelay, client_.delay());
+ EXPECT_FALSE(client_.start_fade().is_null());
+ EXPECT_FALSE(client_.start_fade().IsCancelled());
+
+ // Now move the mouse near the vertical scrollbar track. This should cancel
+ // the currently queued fading animation and stay scrollbar thin.
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarEnd(-1, 0));
+ ExpectScrollbarsOpacity(1);
+ EXPECT_FLOAT_EQ(kIdleThicknessScale,
+ v_scrollbar_layer_->thumb_thickness_scale_factor());
+ EXPECT_FLOAT_EQ(kIdleThicknessScale,
+ h_scrollbar_layer_->thumb_thickness_scale_factor());
+ EXPECT_TRUE(client_.start_fade().IsCancelled());
+
+ scrollbar_controller_->Animate(time);
+ time += kThinningDuration;
+ scrollbar_controller_->Animate(time);
+
+ EXPECT_FLOAT_EQ(kIdleThicknessScale,
+ v_scrollbar_layer_->thumb_thickness_scale_factor());
+ EXPECT_FLOAT_EQ(kIdleThicknessScale,
+ h_scrollbar_layer_->thumb_thickness_scale_factor());
+
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
+ scrollbar_controller_->Animate(time);
+ time += kThinningDuration;
+ scrollbar_controller_->Animate(time);
+
+ EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
+ EXPECT_FLOAT_EQ(kIdleThicknessScale,
+ h_scrollbar_layer_->thumb_thickness_scale_factor());
+
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarEnd(-1, 0));
+ EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
+ EXPECT_FLOAT_EQ(kIdleThicknessScale,
+ h_scrollbar_layer_->thumb_thickness_scale_factor());
+ EXPECT_TRUE(client_.start_fade().IsCancelled());
+
+ scrollbar_controller_->Animate(time);
+ time += kThinningDuration;
+ scrollbar_controller_->Animate(time);
+
+ EXPECT_FLOAT_EQ(kIdleThicknessScale,
+ v_scrollbar_layer_->thumb_thickness_scale_factor());
+ EXPECT_FLOAT_EQ(kIdleThicknessScale,
+ h_scrollbar_layer_->thumb_thickness_scale_factor());
+}
+
+// Scroll content. Move the mouse near the scrollbar thumb and confirm it
+// becomes thick. Ensure it remains visible as long as the mouse is near the
+// scrollbar.
TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveNearAndDontFadeOut) {
base::TimeTicks time;
time += base::TimeDelta::FromSeconds(1);
@@ -274,9 +368,9 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveNearAndDontFadeOut) {
EXPECT_FALSE(client_.start_fade().is_null());
EXPECT_FALSE(client_.start_fade().IsCancelled());
- // Now move the mouse near the scrollbar. This should cancel the currently
- // queued fading animation and start animating thickness.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1);
+ // Now move the mouse near the vertical scrollbar thumb. This should cancel
+ // the currently queued fading animation and start animating thickness.
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -315,9 +409,9 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveOverAndDontFadeOut) {
EXPECT_FALSE(client_.start_fade().is_null());
EXPECT_FALSE(client_.start_fade().IsCancelled());
- // Now move the mouse over the scrollbar. This should cancel the currently
- // queued fading animation and start animating thickness.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0);
+ // Now move the mouse over the vertical scrollbar thumb. This should cancel
+ // the currently queued fading animation and start animating thickness.
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -356,9 +450,9 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
EXPECT_EQ(kFadeDelay, client_.delay());
EXPECT_FALSE(client_.start_fade().is_null());
- // Now move the mouse over the scrollbar and capture it. It should become
- // thick without need for an animation.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0);
+ // Now move the mouse over the vertical scrollbar thumb and capture it. It
+ // should become thick without need for an animation.
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
scrollbar_controller_->DidMouseDown();
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -384,9 +478,9 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
EXPECT_EQ(kFadeDelay, client_.delay());
EXPECT_FALSE(client_.start_fade().is_null());
- // Now move the mouse over the scrollbar and capture it. It should become
- // thick without need for an animation.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0);
+ // Now move the mouse over the vertical scrollbar and capture it. It should
+ // become thick without need for an animation.
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
scrollbar_controller_->DidMouseDown();
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -399,8 +493,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
// Then move mouse away, The fade out animation should have been cleared or
// cancelled.
- scrollbar_controller_->DidMouseMoveNear(
- VERTICAL, kDefaultMouseMoveDistanceToTriggerAnimation);
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerExpand, 0));
EXPECT_TRUE(client_.start_fade().is_null() ||
client_.start_fade().IsCancelled());
@@ -421,8 +515,9 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeWhileCaptured) {
EXPECT_FALSE(client_.start_fade().is_null());
EXPECT_FALSE(client_.start_fade().IsCancelled());
- // Now move the mouse over the scrollbar and animate it until it's thick.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0);
+ // Now move the mouse over the vertical scrollbar thumb and animate it until
+ // it's thick.
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
scrollbar_controller_->Animate(time);
time += kThinningDuration;
scrollbar_controller_->Animate(time);
@@ -458,8 +553,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, FadeAfterReleasedFar) {
EXPECT_FALSE(client_.start_fade().is_null());
EXPECT_FALSE(client_.start_fade().IsCancelled());
- // Now move the mouse over the scrollbar and capture it.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0);
+ // Now move the mouse over the vertical scrollbar thumb and capture it.
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
scrollbar_controller_->DidMouseDown();
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -472,8 +567,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, FadeAfterReleasedFar) {
client_.start_fade().IsCancelled());
// Now move the mouse away from the scrollbar and release it.
- scrollbar_controller_->DidMouseMoveNear(
- VERTICAL, kDefaultMouseMoveDistanceToTriggerAnimation);
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn, 0));
scrollbar_controller_->DidMouseUp();
scrollbar_controller_->Animate(time);
@@ -509,8 +604,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeAfterReleasedNear) {
EXPECT_FALSE(client_.start_fade().is_null());
EXPECT_FALSE(client_.start_fade().IsCancelled());
- // Now move the mouse over the scrollbar and capture it.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0);
+ // Now move the mouse over the vertical scrollbar thumb and capture it.
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
scrollbar_controller_->DidMouseDown();
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -556,9 +651,9 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
scrollbar_controller_->Animate(time);
ExpectScrollbarsOpacity(.5f);
- // Now move the mouse near the scrollbar. It should reset opacity to 1
- // instantly and start animating to thick.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1);
+ // Now move the mouse near the vertical scrollbar thumb. It should reset
+ // opacity to 1 instantly and start animating to thick.
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -595,9 +690,9 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, TestCantCaptureWhenFaded) {
scrollbar_controller_->Animate(time);
ExpectScrollbarsOpacity(0);
- // Move mouse over the scrollbar. It shouldn't thicken the scrollbar since
- // it's completely faded out.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0);
+ // Move mouse over the vertical scrollbar thumb. It shouldn't thicken the
+ // scrollbar since it's completely faded out.
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
scrollbar_controller_->Animate(time);
time += kThinningDuration;
scrollbar_controller_->Animate(time);
@@ -632,7 +727,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, ScrollWithMouseNear) {
base::TimeTicks time;
time += base::TimeDelta::FromSeconds(1);
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1);
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
scrollbar_controller_->Animate(time);
time += kThinningDuration;
@@ -806,8 +901,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
scrollbar_controller_->DidScrollUpdate();
scrollbar_controller_->DidScrollEnd();
- // Near vertical scrollbar
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1);
+ // Near vertical scrollbar.
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
scrollbar_controller_->Animate(time);
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
@@ -824,7 +919,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
h_scrollbar_layer_->thumb_thickness_scale_factor());
// Subsequent moves within the nearness threshold should not change anything.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 2);
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-2, 0));
scrollbar_controller_->Animate(time);
time += base::TimeDelta::FromSeconds(10);
scrollbar_controller_->Animate(time);
@@ -834,8 +929,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
h_scrollbar_layer_->thumb_thickness_scale_factor());
// Now move away from bar.
- scrollbar_controller_->DidMouseMoveNear(
- VERTICAL, kDefaultMouseMoveDistanceToTriggerAnimation);
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerExpand, 0));
scrollbar_controller_->Animate(time);
time += kThinningDuration;
scrollbar_controller_->Animate(time);
@@ -846,7 +941,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
h_scrollbar_layer_->thumb_thickness_scale_factor());
// Near horizontal scrollbar
- scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 2);
+ scrollbar_controller_->DidMouseMove(NearHorizontalScrollbarBegin(0, -1));
scrollbar_controller_->Animate(time);
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
@@ -863,7 +958,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->thumb_thickness_scale_factor());
// Subsequent moves within the nearness threshold should not change anything.
- scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 1);
+ scrollbar_controller_->DidMouseMove(NearHorizontalScrollbarBegin(0, -2));
scrollbar_controller_->Animate(time);
time += base::TimeDelta::FromSeconds(10);
scrollbar_controller_->Animate(time);
@@ -873,8 +968,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->thumb_thickness_scale_factor());
// Now move away from bar.
- scrollbar_controller_->DidMouseMoveNear(
- HORIZONTAL, kDefaultMouseMoveDistanceToTriggerAnimation);
+ scrollbar_controller_->DidMouseMove(
+ NearHorizontalScrollbarBegin(0, -kMouseMoveDistanceToTriggerExpand));
scrollbar_controller_->Animate(time);
time += kThinningDuration;
scrollbar_controller_->Animate(time);
@@ -899,9 +994,12 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearBoth) {
scrollbar_controller_->DidScrollUpdate();
scrollbar_controller_->DidScrollEnd();
+ // Move scrollbar thumb to the end of track.
+ v_scrollbar_layer_->SetCurrentPos(100);
+ h_scrollbar_layer_->SetCurrentPos(100);
+
// Near both Scrollbar
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1);
- scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 1);
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarEnd(-1, -1));
scrollbar_controller_->Animate(time);
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
@@ -930,7 +1028,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
scrollbar_controller_->DidScrollEnd();
// Near vertical scrollbar.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1);
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
scrollbar_controller_->Animate(time);
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
@@ -948,9 +1046,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
h_scrollbar_layer_->thumb_thickness_scale_factor());
// Away vertical scrollbar and near horizontal scrollbar.
- scrollbar_controller_->DidMouseMoveNear(
- VERTICAL, kDefaultMouseMoveDistanceToTriggerAnimation);
- scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 1);
+ scrollbar_controller_->DidMouseMove(gfx::PointF(0, 0));
+ scrollbar_controller_->DidMouseMove(NearHorizontalScrollbarBegin(0, -1));
scrollbar_controller_->Animate(time);
// Vertical scrollbar animate to thin. horizontal scrollbar animate to
@@ -963,8 +1060,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->thumb_thickness_scale_factor());
// Away horizontal scrollbar.
- scrollbar_controller_->DidMouseMoveNear(
- HORIZONTAL, kDefaultMouseMoveDistanceToTriggerAnimation);
+ scrollbar_controller_->DidMouseMove(gfx::PointF(0, 0));
scrollbar_controller_->Animate(time);
// Horizontal scrollbar animate to thin.
@@ -988,7 +1084,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseLeaveFadeOut) {
time += base::TimeDelta::FromSeconds(1);
// Move mouse near scrollbar.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1);
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
// Scroll to make the scrollbars visible.
scrollbar_controller_->DidScrollBegin();
@@ -1014,8 +1110,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, BasicMouseHoverFadeIn) {
time += base::TimeDelta::FromSeconds(1);
// Move mouse hover the fade in scrollbar region of scrollbar.
- scrollbar_controller_->DidMouseMoveNear(
- VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1);
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
// An fade in animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
@@ -1048,8 +1144,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
time += base::TimeDelta::FromSeconds(1);
// Move mouse hover the fade in scrollbar region of scrollbar.
- scrollbar_controller_->DidMouseMoveNear(
- VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1);
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
// An fade in animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
@@ -1059,8 +1155,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
base::Closure& fade = client_.start_fade();
// Move mouse still hover the fade in scrollbar region of scrollbar should not
// post a new fade in.
- scrollbar_controller_->DidMouseMoveNear(
- VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 2);
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 2, 0));
EXPECT_TRUE(fade.Equals(client_.start_fade()));
}
@@ -1073,8 +1169,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
time += base::TimeDelta::FromSeconds(1);
// Move mouse hover the fade in scrollbar region of scrollbar.
- scrollbar_controller_->DidMouseMoveNear(
- VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1);
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
// An fade in animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
@@ -1082,8 +1178,9 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
EXPECT_EQ(kFadeDelay, client_.delay());
// Move mouse far away,delay fade in should be canceled.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL,
- kMouseMoveDistanceToTriggerFadeIn);
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn, 0));
+
EXPECT_TRUE(client_.start_fade().is_null() ||
client_.start_fade().IsCancelled());
}
@@ -1096,8 +1193,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
time += base::TimeDelta::FromSeconds(1);
// Move mouse hover the fade in scrollbar region of scrollbar.
- scrollbar_controller_->DidMouseMoveNear(
- VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1);
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
// An fade in animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
@@ -1110,8 +1207,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
client_.start_fade().IsCancelled());
// Move mouse hover the fade in scrollbar region of scrollbar.
- scrollbar_controller_->DidMouseMoveNear(
- VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1);
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
// An fade in animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());

Powered by Google App Engine
This is Rietveld 408576698