OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_linear_fade.h" | 5 #include "cc/input/scrollbar_animation_controller_linear_fade.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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); | 57 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); |
58 scrollbar_layer_ = scrollbar.get(); | 58 scrollbar_layer_ = scrollbar.get(); |
59 scrollbar_layer_->test_properties()->opacity_can_animate = true; | 59 scrollbar_layer_->test_properties()->opacity_can_animate = true; |
60 std::unique_ptr<LayerImpl> clip = | 60 std::unique_ptr<LayerImpl> clip = |
61 LayerImpl::Create(host_impl_.active_tree(), 3); | 61 LayerImpl::Create(host_impl_.active_tree(), 3); |
62 clip_layer_ = clip.get(); | 62 clip_layer_ = clip.get(); |
63 scroll_layer->SetScrollClipLayer(clip_layer_->id()); | 63 scroll_layer->SetScrollClipLayer(clip_layer_->id()); |
64 LayerImpl* scroll_layer_ptr = scroll_layer.get(); | 64 LayerImpl* scroll_layer_ptr = scroll_layer.get(); |
65 scroll_layer->test_properties()->AddChild(std::move(scrollbar)); | 65 scroll_layer->test_properties()->AddChild(std::move(scrollbar)); |
66 clip->test_properties()->AddChild(std::move(scroll_layer)); | 66 clip->test_properties()->AddChild(std::move(scroll_layer)); |
67 host_impl_.active_tree()->SetRootLayer(std::move(clip)); | 67 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip)); |
68 | 68 |
69 scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); | 69 scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); |
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_ = ScrollbarAnimationControllerLinearFade::Create( | 74 scrollbar_controller_ = ScrollbarAnimationControllerLinearFade::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)); |
77 } | 77 } |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); | 482 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); |
483 | 483 |
484 time += base::TimeDelta::FromSeconds(1); | 484 time += base::TimeDelta::FromSeconds(1); |
485 scrollbar_controller_->DidScrollEnd(); | 485 scrollbar_controller_->DidScrollEnd(); |
486 EXPECT_FALSE(did_request_animate_); | 486 EXPECT_FALSE(did_request_animate_); |
487 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); | 487 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); |
488 } | 488 } |
489 | 489 |
490 } // namespace | 490 } // namespace |
491 } // namespace cc | 491 } // namespace cc |
OLD | NEW |