| 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/single_scrollbar_animation_controller_thinning.h" | 5 #include "cc/input/single_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" |
| 11 #include "cc/test/test_task_graph_runner.h" | 11 #include "cc/test/test_task_graph_runner.h" |
| 12 #include "cc/trees/layer_tree_impl.h" | 12 #include "cc/trees/layer_tree_impl.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 using testing::AtLeast; | 16 using testing::AtLeast; |
| 17 using testing::Mock; | 17 using testing::Mock; |
| 18 using testing::NiceMock; | 18 using testing::NiceMock; |
| 19 using testing::_; | 19 using testing::_; |
| 20 | 20 |
| 21 namespace cc { | 21 namespace cc { |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // These constants are hard-coded and should match the values in | 24 const float kIdleThicknessScale = |
| 25 // single_scrollbar_animation_controller_thinning.cc. | 25 SingleScrollbarAnimationControllerThinning::kIdleThicknessScale; |
| 26 const float kIdleThicknessScale = 0.4f; | 26 const float kDefaultMouseMoveDistanceToTriggerAnimation = |
| 27 const float kDefaultMouseMoveDistanceToTriggerAnimation = 25.f; | 27 SingleScrollbarAnimationControllerThinning:: |
| 28 kDefaultMouseMoveDistanceToTriggerAnimation; |
| 28 | 29 |
| 29 class MockSingleScrollbarAnimationControllerClient | 30 class MockSingleScrollbarAnimationControllerClient |
| 30 : public ScrollbarAnimationControllerClient { | 31 : public ScrollbarAnimationControllerClient { |
| 31 public: | 32 public: |
| 32 explicit MockSingleScrollbarAnimationControllerClient( | 33 explicit MockSingleScrollbarAnimationControllerClient( |
| 33 LayerTreeHostImpl* host_impl) | 34 LayerTreeHostImpl* host_impl) |
| 34 : host_impl_(host_impl) {} | 35 : host_impl_(host_impl) {} |
| 35 virtual ~MockSingleScrollbarAnimationControllerClient() {} | 36 virtual ~MockSingleScrollbarAnimationControllerClient() {} |
| 36 | 37 |
| 37 ScrollbarSet ScrollbarsFor(int scroll_layer_id) const override { | 38 ScrollbarSet ScrollbarsFor(int scroll_layer_id) const override { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 scrollbar_layer_->thumb_thickness_scale_factor()); | 373 scrollbar_layer_->thumb_thickness_scale_factor()); |
| 373 | 374 |
| 374 time += kThinningDuration / 2; | 375 time += kThinningDuration / 2; |
| 375 scrollbar_controller_->Animate(time); | 376 scrollbar_controller_->Animate(time); |
| 376 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 377 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 377 scrollbar_layer_->thumb_thickness_scale_factor()); | 378 scrollbar_layer_->thumb_thickness_scale_factor()); |
| 378 } | 379 } |
| 379 | 380 |
| 380 } // namespace | 381 } // namespace |
| 381 } // namespace cc | 382 } // namespace cc |
| OLD | NEW |