| 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/test_shared_bitmap_manager.h" | 10 #include "cc/test/test_shared_bitmap_manager.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 class ScrollbarAnimationControllerThinningTest | 16 class ScrollbarAnimationControllerThinningTest |
| 17 : public testing::Test, | 17 : public testing::Test, |
| 18 public ScrollbarAnimationControllerClient { | 18 public ScrollbarAnimationControllerClient { |
| 19 public: | 19 public: |
| 20 ScrollbarAnimationControllerThinningTest() | 20 ScrollbarAnimationControllerThinningTest() |
| 21 : host_impl_(&proxy_, &shared_bitmap_manager_) {} | 21 : host_impl_(&proxy_, &shared_bitmap_manager_) {} |
| 22 | 22 |
| 23 virtual void PostDelayedScrollbarFade(const base::Closure& start_fade, | 23 virtual void PostDelayedScrollbarFade(const base::Closure& start_fade, |
| 24 base::TimeDelta delay) OVERRIDE { | 24 base::TimeDelta delay) override { |
| 25 start_fade_ = start_fade; | 25 start_fade_ = start_fade; |
| 26 } | 26 } |
| 27 virtual void SetNeedsScrollbarAnimationFrame() OVERRIDE {} | 27 virtual void SetNeedsScrollbarAnimationFrame() override {} |
| 28 | 28 |
| 29 protected: | 29 protected: |
| 30 virtual void SetUp() { | 30 virtual void SetUp() { |
| 31 scoped_ptr<LayerImpl> scroll_layer = | 31 scoped_ptr<LayerImpl> scroll_layer = |
| 32 LayerImpl::Create(host_impl_.active_tree(), 1); | 32 LayerImpl::Create(host_impl_.active_tree(), 1); |
| 33 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3); | 33 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3); |
| 34 scroll_layer->SetScrollClipLayer(clip_layer_->id()); | 34 scroll_layer->SetScrollClipLayer(clip_layer_->id()); |
| 35 LayerImpl* scroll_layer_ptr = scroll_layer.get(); | 35 LayerImpl* scroll_layer_ptr = scroll_layer.get(); |
| 36 clip_layer_->AddChild(scroll_layer.Pass()); | 36 clip_layer_->AddChild(scroll_layer.Pass()); |
| 37 | 37 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 time += base::TimeDelta::FromSeconds(1); | 331 time += base::TimeDelta::FromSeconds(1); |
| 332 scrollbar_controller_->Animate(time); | 332 scrollbar_controller_->Animate(time); |
| 333 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity()); | 333 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity()); |
| 334 // The thickness now gets big again. | 334 // The thickness now gets big again. |
| 335 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); | 335 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); |
| 336 } | 336 } |
| 337 | 337 |
| 338 } // namespace | 338 } // namespace |
| 339 } // namespace cc | 339 } // namespace cc |
| OLD | NEW |