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..43515351ecf77d7966a89cb44f11c6b4c53e659a 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,27 @@ 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); |
+ } |
+ |
+ gfx::PointF NearVerticalScrollbarBegin(float offset_x, float offset_y) { |
+ gfx::PointF p(90, 0); |
+ p.Offset(offset_x, offset_y); |
+ return p; |
+ } |
+ |
+ gfx::PointF NearVerticalScrollbarEnd(float offset_x, float offset_y) { |
+ gfx::PointF p(90, 90); |
+ p.Offset(offset_x, offset_y); |
+ return p; |
+ } |
+ |
+ 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 +287,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 keeps thick. 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 start animating thickness. |
+ 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 +364,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 +405,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 +446,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 +474,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 +489,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 +511,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 +549,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 +563,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 +600,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 +647,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 +686,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 +723,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 +897,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 +915,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 +925,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 +937,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 +954,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 +964,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 +990,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 +1024,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 +1042,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 +1056,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 +1080,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 +1106,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 +1140,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 +1151,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 +1165,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 +1174,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 +1189,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 +1203,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()); |