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

Unified Diff: cc/input/scrollbar_animation_controller_unittest.cc

Issue 2931703002: Don't fade in overlay scrollbar when user interacting the content under scrollbar. (Closed)
Patch Set: Created 3 years, 6 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 e1cb8957e9702ab994ca3bb60787981d99125b0c..41aceb43f5638a15a90a032fa84c4d6003192f3c 100644
--- a/cc/input/scrollbar_animation_controller_unittest.cc
+++ b/cc/input/scrollbar_animation_controller_unittest.cc
@@ -315,7 +315,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
// 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));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarEnd(-1, 0), false);
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -332,7 +332,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
EXPECT_FLOAT_EQ(kIdleThicknessScale,
h_scrollbar_layer_->thumb_thickness_scale_factor());
- scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0), false);
scrollbar_controller_->Animate(time);
time += kThinningDuration;
scrollbar_controller_->Animate(time);
@@ -341,7 +341,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
EXPECT_FLOAT_EQ(kIdleThicknessScale,
h_scrollbar_layer_->thumb_thickness_scale_factor());
- scrollbar_controller_->DidMouseMove(NearVerticalScrollbarEnd(-1, 0));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarEnd(-1, 0), false);
EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
EXPECT_FLOAT_EQ(kIdleThicknessScale,
h_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -375,7 +375,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveNearAndDontFadeOut) {
// 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));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0), false);
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -416,7 +416,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveOverAndDontFadeOut) {
// 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));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0), false);
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -457,7 +457,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
// 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_->DidMouseMove(NearVerticalScrollbarBegin(0, 0), false);
scrollbar_controller_->DidMouseDown();
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -485,7 +485,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
// 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_->DidMouseMove(NearVerticalScrollbarBegin(0, 0), false);
scrollbar_controller_->DidMouseDown();
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -499,7 +499,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
// Then move mouse away, The fade out animation should have been cleared or
// cancelled.
scrollbar_controller_->DidMouseMove(
- NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerExpand, 0));
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerExpand, 0), false);
EXPECT_TRUE(client_.start_fade().is_null() ||
client_.start_fade().IsCancelled());
@@ -522,7 +522,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeWhileCaptured) {
// Now move the mouse over the vertical scrollbar thumb and animate it until
// it's thick.
- scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0), false);
scrollbar_controller_->Animate(time);
time += kThinningDuration;
scrollbar_controller_->Animate(time);
@@ -559,7 +559,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, FadeAfterReleasedFar) {
EXPECT_FALSE(client_.start_fade().IsCancelled());
// Now move the mouse over the vertical scrollbar thumb and capture it.
- scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0), false);
scrollbar_controller_->DidMouseDown();
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -573,7 +573,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, FadeAfterReleasedFar) {
// Now move the mouse away from the scrollbar and release it.
scrollbar_controller_->DidMouseMove(
- NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn, 0));
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn, 0), false);
scrollbar_controller_->DidMouseUp();
scrollbar_controller_->Animate(time);
@@ -610,7 +610,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeAfterReleasedNear) {
EXPECT_FALSE(client_.start_fade().IsCancelled());
// Now move the mouse over the vertical scrollbar thumb and capture it.
- scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0), false);
scrollbar_controller_->DidMouseDown();
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -658,7 +658,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
// 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));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0), false);
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
v_scrollbar_layer_->thumb_thickness_scale_factor());
@@ -697,7 +697,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, TestCantCaptureWhenFaded) {
// 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_->DidMouseMove(NearVerticalScrollbarBegin(0, 0), false);
scrollbar_controller_->Animate(time);
time += kThinningDuration;
scrollbar_controller_->Animate(time);
@@ -717,13 +717,28 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, TestCantCaptureWhenFaded) {
h_scrollbar_layer_->thumb_thickness_scale_factor());
EXPECT_TRUE(client_.start_fade().is_null());
- // Similarly, releasing the scrollbar should have no effect.
+ // Similarly, releasing the scrollbar should have no effect but trigger a fade
+ // in.
scrollbar_controller_->DidMouseUp();
ExpectScrollbarsOpacity(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().is_null());
+
+ // An fade in animation should have been enqueued.
+ EXPECT_FALSE(client_.start_fade().is_null());
+ EXPECT_FALSE(client_.start_fade().IsCancelled());
+ EXPECT_EQ(kFadeDelay, client_.delay());
+
+ // Play the delay animation.
+ client_.start_fade().Run();
+ EXPECT_TRUE(client_.start_fade().IsCancelled());
+
+ scrollbar_controller_->Animate(time);
+ time += kFadeDuration;
+ scrollbar_controller_->Animate(time);
+
+ EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden());
}
// Initiate a scroll when the pointer is already near the scrollbar. It should
@@ -732,7 +747,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, ScrollWithMouseNear) {
base::TimeTicks time;
time += base::TimeDelta::FromSeconds(1);
- scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0), false);
scrollbar_controller_->Animate(time);
time += kThinningDuration;
@@ -886,7 +901,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
scrollbar_controller_->DidScrollEnd();
// Near vertical scrollbar.
- scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0), false);
scrollbar_controller_->Animate(time);
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
@@ -903,7 +918,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
h_scrollbar_layer_->thumb_thickness_scale_factor());
// Subsequent moves within the nearness threshold should not change anything.
- scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-2, 0));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-2, 0), false);
scrollbar_controller_->Animate(time);
time += base::TimeDelta::FromSeconds(10);
scrollbar_controller_->Animate(time);
@@ -914,7 +929,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
// Now move away from bar.
scrollbar_controller_->DidMouseMove(
- NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerExpand, 0));
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerExpand, 0), false);
scrollbar_controller_->Animate(time);
time += kThinningDuration;
scrollbar_controller_->Animate(time);
@@ -925,7 +940,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
h_scrollbar_layer_->thumb_thickness_scale_factor());
// Near horizontal scrollbar
- scrollbar_controller_->DidMouseMove(NearHorizontalScrollbarBegin(0, -1));
+ scrollbar_controller_->DidMouseMove(NearHorizontalScrollbarBegin(0, -1),
+ false);
scrollbar_controller_->Animate(time);
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
@@ -942,7 +958,8 @@ 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_->DidMouseMove(NearHorizontalScrollbarBegin(0, -2));
+ scrollbar_controller_->DidMouseMove(NearHorizontalScrollbarBegin(0, -2),
+ false);
scrollbar_controller_->Animate(time);
time += base::TimeDelta::FromSeconds(10);
scrollbar_controller_->Animate(time);
@@ -953,7 +970,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
// Now move away from bar.
scrollbar_controller_->DidMouseMove(
- NearHorizontalScrollbarBegin(0, -kMouseMoveDistanceToTriggerExpand));
+ NearHorizontalScrollbarBegin(0, -kMouseMoveDistanceToTriggerExpand),
+ false);
scrollbar_controller_->Animate(time);
time += kThinningDuration;
scrollbar_controller_->Animate(time);
@@ -983,7 +1001,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearBoth) {
h_scrollbar_layer_->SetCurrentPos(100);
// Near both Scrollbar
- scrollbar_controller_->DidMouseMove(NearVerticalScrollbarEnd(-1, -1));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarEnd(-1, -1), false);
scrollbar_controller_->Animate(time);
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
@@ -1012,7 +1030,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
scrollbar_controller_->DidScrollEnd();
// Near vertical scrollbar.
- scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0), false);
scrollbar_controller_->Animate(time);
ExpectScrollbarsOpacity(1);
EXPECT_FLOAT_EQ(kIdleThicknessScale,
@@ -1030,8 +1048,9 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
h_scrollbar_layer_->thumb_thickness_scale_factor());
// Away vertical scrollbar and near horizontal scrollbar.
- scrollbar_controller_->DidMouseMove(gfx::PointF(0, 0));
- scrollbar_controller_->DidMouseMove(NearHorizontalScrollbarBegin(0, -1));
+ scrollbar_controller_->DidMouseMove(gfx::PointF(0, 0), false);
+ scrollbar_controller_->DidMouseMove(NearHorizontalScrollbarBegin(0, -1),
+ false);
scrollbar_controller_->Animate(time);
// Vertical scrollbar animate to thin. horizontal scrollbar animate to
@@ -1044,7 +1063,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->thumb_thickness_scale_factor());
// Away horizontal scrollbar.
- scrollbar_controller_->DidMouseMove(gfx::PointF(0, 0));
+ scrollbar_controller_->DidMouseMove(gfx::PointF(0, 0), false);
scrollbar_controller_->Animate(time);
// Horizontal scrollbar animate to thin.
@@ -1068,7 +1087,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseLeaveFadeOut) {
time += base::TimeDelta::FromSeconds(1);
// Move mouse near scrollbar.
- scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
+ scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0), false);
// Scroll to make the scrollbars visible.
scrollbar_controller_->DidScrollBegin();
@@ -1095,7 +1114,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, BasicMouseHoverFadeIn) {
// Move mouse hover the fade in scrollbar region of scrollbar.
scrollbar_controller_->DidMouseMove(
- NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0),
+ false);
// An fade in animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
@@ -1129,7 +1149,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
// Move mouse hover the fade in scrollbar region of scrollbar.
scrollbar_controller_->DidMouseMove(
- NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0),
+ false);
// An fade in animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
@@ -1140,7 +1161,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
// Move mouse still hover the fade in scrollbar region of scrollbar should not
// post a new fade in.
scrollbar_controller_->DidMouseMove(
- NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 2, 0));
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 2, 0),
+ false);
EXPECT_TRUE(fade.Equals(client_.start_fade()));
}
@@ -1154,7 +1176,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
// Move mouse hover the fade in scrollbar region of scrollbar.
scrollbar_controller_->DidMouseMove(
- NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0),
+ false);
// An fade in animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
@@ -1163,7 +1186,7 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
// Move mouse far away,delay fade in should be canceled.
scrollbar_controller_->DidMouseMove(
- NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn, 0));
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn, 0), false);
EXPECT_TRUE(client_.start_fade().is_null() ||
client_.start_fade().IsCancelled());
@@ -1178,7 +1201,8 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
// Move mouse hover the fade in scrollbar region of scrollbar.
scrollbar_controller_->DidMouseMove(
- NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0),
+ false);
// An fade in animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
@@ -1192,7 +1216,59 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
// Move mouse hover the fade in scrollbar region of scrollbar.
scrollbar_controller_->DidMouseMove(
- NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0),
+ false);
+
+ // An fade in animation should have been enqueued.
+ EXPECT_FALSE(client_.start_fade().is_null());
+ EXPECT_FALSE(client_.start_fade().IsCancelled());
+ EXPECT_EQ(kFadeDelay, client_.delay());
+
+ // Play the delay animation.
+ client_.start_fade().Run();
+ EXPECT_TRUE(client_.start_fade().IsCancelled());
+
+ scrollbar_controller_->Animate(time);
+ time += kFadeDuration;
+ scrollbar_controller_->Animate(time);
+
+ EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden());
+}
+
+// Make sure mouse down will cancel hover fade in timer, then mouse move with
+// press will not trigger hover fade in, mouse release near will trigger new
+// hover fade in.
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
+ MouseHoverThenMouseDownShouldCancelFadeInThenReleaseNearShouldFadeIn) {
+ base::TimeTicks time;
+ time += base::TimeDelta::FromSeconds(1);
+
+ // Move mouse hover the fade in scrollbar region of scrollbar.
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0),
+ false);
+
+ // An fade in animation should have been enqueued.
+ EXPECT_FALSE(client_.start_fade().is_null());
+ EXPECT_FALSE(client_.start_fade().IsCancelled());
+ EXPECT_EQ(kFadeDelay, client_.delay());
+
+ // Mouse down,delay fade in should be canceled.
+ scrollbar_controller_->DidMouseDown();
+ EXPECT_TRUE(client_.start_fade().is_null() ||
+ client_.start_fade().IsCancelled());
+
+ // Move mouse hover the fade in scrollbar region of scrollbar with press.
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0),
+ true);
+
+ // Should not have delay fade animation.
+ EXPECT_TRUE(client_.start_fade().is_null() ||
+ client_.start_fade().IsCancelled());
+
+ // Mouse up.
+ scrollbar_controller_->DidMouseUp();
// An fade in animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
@@ -1210,6 +1286,46 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden());
}
+// Make sure mouse down will cancel hover fade in timer, then mouse move with
+// press will not trigger hover fade in, mouse release far will no trigger new
bokan 2017/06/08 14:02:38 nit: no -> not
+// hover fade in.
+TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
+ MouseReleaseFarShouldNotFadeIn) {
+ base::TimeTicks time;
+ time += base::TimeDelta::FromSeconds(1);
+
+ // Move mouse hover the fade in scrollbar region of scrollbar.
bokan 2017/06/08 14:02:38 nit: "Move mouse hover the fade in scrollbar" -> "
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0),
+ false);
+
+ // An fade in animation should have been enqueued.
+ EXPECT_FALSE(client_.start_fade().is_null());
+ EXPECT_FALSE(client_.start_fade().IsCancelled());
+ EXPECT_EQ(kFadeDelay, client_.delay());
+
+ // Mouse down,delay fade in should be canceled.
+ scrollbar_controller_->DidMouseDown();
+ EXPECT_TRUE(client_.start_fade().is_null() ||
+ client_.start_fade().IsCancelled());
+
+ // Move mouse far from hover the fade in scrollbar region of scrollbar with
bokan 2017/06/08 14:02:38 nit: ditto here and elsewhere
+ // press.
+ scrollbar_controller_->DidMouseMove(
+ NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn, 0), true);
+
+ // Should not have delay fade animation.
+ EXPECT_TRUE(client_.start_fade().is_null() ||
+ client_.start_fade().IsCancelled());
+
+ // Mouse up.
+ scrollbar_controller_->DidMouseUp();
+
+ // Should not have delay fade animation.
+ EXPECT_TRUE(client_.start_fade().is_null() ||
+ client_.start_fade().IsCancelled());
+}
+
class ScrollbarAnimationControllerAndroidTest
: public testing::Test,
public ScrollbarAnimationControllerClient {

Powered by Google App Engine
This is Rietveld 408576698