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

Unified Diff: cc/input/scrollbar_animation_controller_thinning_unittest.cc

Issue 2384053002: cancel overlay-scrollbar hover state when moving pointer out of window for ChromeOS (Closed)
Patch Set: quick return Created 4 years, 2 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_thinning.cc ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/input/scrollbar_animation_controller_thinning_unittest.cc
diff --git a/cc/input/scrollbar_animation_controller_thinning_unittest.cc b/cc/input/scrollbar_animation_controller_thinning_unittest.cc
index 4824879f67af4f5436a0429e4bdf336051a84d3c..64096b7eae0e9581e152ef81d1602125be795b59 100644
--- a/cc/input/scrollbar_animation_controller_thinning_unittest.cc
+++ b/cc/input/scrollbar_animation_controller_thinning_unittest.cc
@@ -518,5 +518,40 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseCaptureAndReleaseOnBar) {
}
}
+// Move mouse on scrollbar and capture then move out of window. Confirm that
+// the bar stays thick and dark.
+TEST_F(ScrollbarAnimationControllerThinningTest,
+ MouseCapturedAndExitWindowFromScrollbar) {
+ base::TimeTicks time;
+ time += base::TimeDelta::FromSeconds(1);
+
+ // Move in
+ scrollbar_controller_->DidMouseMoveNear(0);
+
+ scrollbar_controller_->Animate(time);
+ time += base::TimeDelta::FromSeconds(kDuration);
+ scrollbar_controller_->Animate(time);
+ EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+ EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
+
+ // Capture
+ scrollbar_controller_->DidCaptureScrollbarBegin();
+ time += base::TimeDelta::FromSeconds(1);
+ scrollbar_controller_->Animate(time);
+ EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+ EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
+
+ // move out of window
+ scrollbar_controller_->DidMouseMoveOffScrollbar();
+
+ // test for 10 seconds, stay thick and dark
+ for (int i = 0; i < 10; ++i) {
+ time += base::TimeDelta::FromSeconds(1);
+ scrollbar_controller_->Animate(time);
+ EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
+ EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
+ }
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/input/scrollbar_animation_controller_thinning.cc ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698