| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/input/scrollbar_animation_controller_thinning.h" | 5 #include "cc/input/scrollbar_animation_controller_thinning.h" |
| 6 | 6 |
| 7 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 7 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
| 8 #include "cc/test/fake_impl_task_runner_provider.h" | 8 #include "cc/test/fake_impl_task_runner_provider.h" |
| 9 #include "cc/test/fake_layer_tree_host_impl.h" | 9 #include "cc/test/fake_layer_tree_host_impl.h" |
| 10 #include "cc/test/geometry_test_utils.h" | 10 #include "cc/test/geometry_test_utils.h" |
| (...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 939 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 940 v_scrollbar_layer_->thumb_thickness_scale_factor()); | 940 v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 941 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 941 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 942 h_scrollbar_layer_->thumb_thickness_scale_factor()); | 942 h_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 943 | 943 |
| 944 // An animation should have been enqueued. | 944 // An animation should have been enqueued. |
| 945 EXPECT_FALSE(client_.start_fade().is_null()); | 945 EXPECT_FALSE(client_.start_fade().is_null()); |
| 946 EXPECT_EQ(kDelayBeforeStarting, client_.delay()); | 946 EXPECT_EQ(kDelayBeforeStarting, client_.delay()); |
| 947 } | 947 } |
| 948 | 948 |
| 949 // Ensure we have a delay fadeout animation after mouse leave without a mouse |
| 950 // move. |
| 951 TEST_F(ScrollbarAnimationControllerThinningTest, MouseLeaveFadeOut) { |
| 952 base::TimeTicks time; |
| 953 time += base::TimeDelta::FromSeconds(1); |
| 954 |
| 955 // Move mouse near scrollbar. |
| 956 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); |
| 957 |
| 958 // Scroll to make the scrollbars visible. |
| 959 scrollbar_controller_->DidScrollBegin(); |
| 960 scrollbar_controller_->DidScrollUpdate(false); |
| 961 scrollbar_controller_->DidScrollEnd(); |
| 962 |
| 963 // Should not have delay fadeout animation. |
| 964 EXPECT_TRUE(client_.start_fade().is_null() || |
| 965 client_.start_fade().IsCancelled()); |
| 966 |
| 967 // Mouse leave. |
| 968 scrollbar_controller_->DidMouseLeave(); |
| 969 |
| 970 // An animation should have been enqueued. |
| 971 EXPECT_FALSE(client_.start_fade().is_null()); |
| 972 EXPECT_EQ(kDelayBeforeStarting, client_.delay()); |
| 973 } |
| 974 |
| 949 } // namespace | 975 } // namespace |
| 950 } // namespace cc | 976 } // namespace cc |
| OLD | NEW |