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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const bool kIsLeftSideVerticalScrollbar = false; | 56 const bool kIsLeftSideVerticalScrollbar = false; |
57 const bool kIsOverlayScrollbar = true; | 57 const bool kIsOverlayScrollbar = true; |
58 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = | 58 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = |
59 SolidColorScrollbarLayerImpl::Create( | 59 SolidColorScrollbarLayerImpl::Create( |
60 host_impl_.active_tree(), kId, HORIZONTAL, kThumbThickness, | 60 host_impl_.active_tree(), kId, HORIZONTAL, kThumbThickness, |
61 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); | 61 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); |
62 scrollbar_layer_ = scrollbar.get(); | 62 scrollbar_layer_ = scrollbar.get(); |
63 | 63 |
64 scroll_layer->test_properties()->AddChild(std::move(scrollbar)); | 64 scroll_layer->test_properties()->AddChild(std::move(scrollbar)); |
65 clip_layer_->test_properties()->AddChild(std::move(scroll_layer)); | 65 clip_layer_->test_properties()->AddChild(std::move(scroll_layer)); |
66 host_impl_.active_tree()->SetRootLayer(std::move(clip)); | 66 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip)); |
67 | 67 |
68 scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); | 68 scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); |
69 scrollbar_layer_->test_properties()->opacity_can_animate = true; | 69 scrollbar_layer_->test_properties()->opacity_can_animate = true; |
70 clip_layer_->SetBounds(gfx::Size(100, 100)); | 70 clip_layer_->SetBounds(gfx::Size(100, 100)); |
71 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); | 71 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); |
72 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 72 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
73 | 73 |
74 scrollbar_controller_ = ScrollbarAnimationControllerThinning::Create( | 74 scrollbar_controller_ = ScrollbarAnimationControllerThinning::Create( |
75 scroll_layer_ptr->id(), this, base::TimeDelta::FromSeconds(2), | 75 scroll_layer_ptr->id(), this, base::TimeDelta::FromSeconds(2), |
76 base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(3)); | 76 base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(3)); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 | 381 |
382 time += base::TimeDelta::FromSeconds(1); | 382 time += base::TimeDelta::FromSeconds(1); |
383 scrollbar_controller_->Animate(time); | 383 scrollbar_controller_->Animate(time); |
384 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity()); | 384 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity()); |
385 // The thickness now gets big again. | 385 // The thickness now gets big again. |
386 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); | 386 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); |
387 } | 387 } |
388 | 388 |
389 } // namespace | 389 } // namespace |
390 } // namespace cc | 390 } // namespace cc |
OLD | NEW |