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

Unified Diff: cc/input/scrollbar_animation_controller_unittest.cc

Issue 2813643002: Change the distance trigger scrollbar show (Closed)
Patch Set: change tests and comments 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
« no previous file with comments | « cc/input/scrollbar_animation_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c4fda1a43c8331c22fcf7fe807f678215b20f1ef..587a48b2cc1c6ec15005c5771d80f0ba0ba915fc 100644
--- a/cc/input/scrollbar_animation_controller_unittest.cc
+++ b/cc/input/scrollbar_animation_controller_unittest.cc
@@ -1006,13 +1006,14 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseLeaveFadeOut) {
EXPECT_EQ(kFadeOutDelay, client_.delay());
}
-// Scrollbars should schedule a delay show when mouse hover hidden scrollbar.
+// Scrollbars should schedule a delay show when mouse near a hidden scrollbar.
TEST_F(ScrollbarAnimationControllerAuraOverlayTest, BasicMouseHoverShow) {
chaopeng 2017/04/10 14:56:11 Here we are not hover anymore. what should we name
bokan 2017/04/10 18:14:16 We are hovering over the "show scrollbar region" r
base::TimeTicks time;
time += base::TimeDelta::FromSeconds(1);
- // Move mouse over scrollbar.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0);
+ // Move mouse near scrollbar within kMouseMoveDistanceToTriggerShow.
+ scrollbar_controller_->DidMouseMoveNear(VERTICAL,
+ kMouseMoveDistanceToTriggerShow - 1);
// An show animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
@@ -1032,8 +1033,9 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
base::TimeTicks time;
time += base::TimeDelta::FromSeconds(1);
- // Move mouse over scrollbar.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0);
+ // Move mouse near scrollbar within kMouseMoveDistanceToTriggerShow.
+ scrollbar_controller_->DidMouseMoveNear(VERTICAL,
+ kMouseMoveDistanceToTriggerShow - 1);
// An show animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
@@ -1041,31 +1043,33 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
EXPECT_EQ(kShowDelay, client_.delay());
base::Closure& fade = client_.start_fade();
- // Move mouse inside scrollbar. should not post a new show.
- scrollbar_controller_->DidMouseMoveNear(
- VERTICAL, kMouseMoveDistanceToTriggerShow - kThumbThickness - 1);
+ // Move mouse near scrollbar still within kMouseMoveDistanceToTriggerShow.
+ // should not post a new show.
+ scrollbar_controller_->DidMouseMoveNear(VERTICAL,
+ kMouseMoveDistanceToTriggerShow - 2);
EXPECT_TRUE(fade.Equals(client_.start_fade()));
}
-// Scrollbars should cancel delay show when mouse hover hidden scrollbar then
-// move out of scrollbar.
+// Scrollbars should cancel delay show when mouse near hidden scrollbar then
+// move far away.
TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
MouseHoverThenOutShouldCancelShow) {
base::TimeTicks time;
time += base::TimeDelta::FromSeconds(1);
- // Move mouse over scrollbar.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0);
+ // Move mouse near scrollbar within kMouseMoveDistanceToTriggerShow.
+ scrollbar_controller_->DidMouseMoveNear(VERTICAL,
+ kMouseMoveDistanceToTriggerShow - 1);
// An show animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
EXPECT_FALSE(client_.start_fade().IsCancelled());
EXPECT_EQ(kShowDelay, client_.delay());
- // Move mouse out of scrollbar,delay show should be canceled.
- scrollbar_controller_->DidMouseMoveNear(
- VERTICAL, kMouseMoveDistanceToTriggerShow - kThumbThickness);
+ // Move mouse far away,delay show should be canceled.
+ scrollbar_controller_->DidMouseMoveNear(VERTICAL,
+ kMouseMoveDistanceToTriggerShow);
EXPECT_TRUE(client_.start_fade().is_null() ||
client_.start_fade().IsCancelled());
}
@@ -1077,8 +1081,9 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
base::TimeTicks time;
time += base::TimeDelta::FromSeconds(1);
- // Move mouse over scrollbar.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0);
+ // Move mouse near scrollbar within kMouseMoveDistanceToTriggerShow.
+ scrollbar_controller_->DidMouseMoveNear(VERTICAL,
+ kMouseMoveDistanceToTriggerShow - 1);
// An show animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
@@ -1090,8 +1095,9 @@ TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
EXPECT_TRUE(client_.start_fade().is_null() ||
client_.start_fade().IsCancelled());
- // Move mouse over scrollbar.
- scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0);
+ // Move mouse near scrollbar within kMouseMoveDistanceToTriggerShow.
+ scrollbar_controller_->DidMouseMoveNear(VERTICAL,
+ kMouseMoveDistanceToTriggerShow - 1);
// An show animation should have been enqueued.
EXPECT_FALSE(client_.start_fade().is_null());
« no previous file with comments | « cc/input/scrollbar_animation_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698