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/animation/scrollbar_animation_controller_thinning.h" | 5 #include "cc/animation/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_proxy.h" | 8 #include "cc/test/fake_impl_proxy.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_shared_bitmap_manager.h" | 11 #include "cc/test/test_shared_bitmap_manager.h" |
12 #include "cc/trees/layer_tree_impl.h" | 12 #include "cc/trees/layer_tree_impl.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 namespace { | 16 namespace { |
17 | 17 |
18 class ScrollbarAnimationControllerThinningTest | 18 class ScrollbarAnimationControllerThinningTest |
19 : public testing::Test, | 19 : public testing::Test, |
20 public ScrollbarAnimationControllerClient { | 20 public ScrollbarAnimationControllerClient { |
21 public: | 21 public: |
22 ScrollbarAnimationControllerThinningTest() | 22 ScrollbarAnimationControllerThinningTest() |
23 : host_impl_(&proxy_, &shared_bitmap_manager_) {} | 23 : host_impl_(&proxy_, &shared_bitmap_manager_) {} |
24 | 24 |
25 virtual void PostDelayedScrollbarFade(const base::Closure& start_fade, | 25 void PostDelayedScrollbarFade(const base::Closure& start_fade, |
26 base::TimeDelta delay) override { | 26 base::TimeDelta delay) override { |
27 start_fade_ = start_fade; | 27 start_fade_ = start_fade; |
28 } | 28 } |
29 virtual void SetNeedsScrollbarAnimationFrame() override {} | 29 void SetNeedsScrollbarAnimationFrame() override {} |
30 | 30 |
31 protected: | 31 protected: |
32 virtual void SetUp() { | 32 virtual void SetUp() { |
33 scoped_ptr<LayerImpl> scroll_layer = | 33 scoped_ptr<LayerImpl> scroll_layer = |
34 LayerImpl::Create(host_impl_.active_tree(), 1); | 34 LayerImpl::Create(host_impl_.active_tree(), 1); |
35 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3); | 35 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3); |
36 scroll_layer->SetScrollClipLayer(clip_layer_->id()); | 36 scroll_layer->SetScrollClipLayer(clip_layer_->id()); |
37 LayerImpl* scroll_layer_ptr = scroll_layer.get(); | 37 LayerImpl* scroll_layer_ptr = scroll_layer.get(); |
38 clip_layer_->AddChild(scroll_layer.Pass()); | 38 clip_layer_->AddChild(scroll_layer.Pass()); |
39 | 39 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 365 |
366 time += base::TimeDelta::FromSeconds(1); | 366 time += base::TimeDelta::FromSeconds(1); |
367 scrollbar_controller_->Animate(time); | 367 scrollbar_controller_->Animate(time); |
368 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity()); | 368 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity()); |
369 // The thickness now gets big again. | 369 // The thickness now gets big again. |
370 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); | 370 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); |
371 } | 371 } |
372 | 372 |
373 } // namespace | 373 } // namespace |
374 } // namespace cc | 374 } // namespace cc |
OLD | NEW |