| 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..4801f4e0e068d47a38fa8e57f462e381db70d84c 100644
|
| --- a/cc/input/scrollbar_animation_controller_thinning_unittest.cc
|
| +++ b/cc/input/scrollbar_animation_controller_thinning_unittest.cc
|
| @@ -518,5 +518,80 @@ TEST_F(ScrollbarAnimationControllerThinningTest, MouseCaptureAndReleaseOnBar) {
|
| }
|
| }
|
|
|
| +// Move mouse on scrollbar then move out of window. Confirm that the bar gets
|
| +// thin and light.
|
| +TEST_F(ScrollbarAnimationControllerThinningTest, MouseExitWindowFromScrollbar) {
|
| + 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());
|
| +
|
| + // move out of window
|
| + scrollbar_controller_->DidMouseLeave();
|
| +
|
| + // get thin and light
|
| + 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());
|
| +
|
| + time += base::TimeDelta::FromSeconds(1);
|
| + scrollbar_controller_->Animate(time);
|
| + EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->Opacity());
|
| + EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->thumb_thickness_scale_factor());
|
| +
|
| + time += base::TimeDelta::FromSeconds(1);
|
| + scrollbar_controller_->Animate(time);
|
| + EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->Opacity());
|
| + EXPECT_FLOAT_EQ(0.6f, scrollbar_layer_->thumb_thickness_scale_factor());
|
| +
|
| + time += base::TimeDelta::FromSeconds(1);
|
| + scrollbar_controller_->Animate(time);
|
| + EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
|
| + EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
|
| +}
|
| +
|
| +// 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_->DidMouseLeave();
|
| +
|
| + // 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
|
|
|