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/animation/scrollbar_animation_controller_linear_fade.h" | 5 #include "cc/animation/scrollbar_animation_controller_linear_fade.h" |
6 | 6 |
7 #include "cc/layers/scrollbar_layer_impl.h" | 7 #include "cc/layers/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/trees/single_thread_proxy.h" | 10 #include "cc/trees/single_thread_proxy.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 ScrollbarAnimationControllerLinearFadeTest : public testing::Test { | 16 class ScrollbarAnimationControllerLinearFadeTest : public testing::Test { |
17 public: | 17 public: |
18 ScrollbarAnimationControllerLinearFadeTest() : host_impl_(&proxy_) {} | 18 ScrollbarAnimationControllerLinearFadeTest() : host_impl_(&proxy_) {} |
19 | 19 |
20 protected: | 20 protected: |
21 virtual void SetUp() { | 21 virtual void SetUp() { |
22 scroll_layer_ = LayerImpl::Create(host_impl_.active_tree(), 1); | 22 scroll_layer_ = LayerImpl::Create(host_impl_.active_tree(), 1); |
23 scrollbar_layer_ = ScrollbarLayerImpl::Create( | 23 scrollbar_layer_ = ScrollbarLayerImpl::Create( |
24 host_impl_.active_tree(), 2, HORIZONTAL); | 24 host_impl_.active_tree(), 2, HORIZONTAL, false); |
25 | 25 |
26 scroll_layer_->SetMaxScrollOffset(gfx::Vector2d(50, 50)); | 26 scroll_layer_->SetMaxScrollOffset(gfx::Vector2d(50, 50)); |
27 scroll_layer_->SetBounds(gfx::Size(50, 50)); | 27 scroll_layer_->SetBounds(gfx::Size(50, 50)); |
28 scroll_layer_->SetHorizontalScrollbarLayer(scrollbar_layer_.get()); | 28 scroll_layer_->SetHorizontalScrollbarLayer(scrollbar_layer_.get()); |
29 | 29 |
30 scrollbar_controller_ = ScrollbarAnimationControllerLinearFade::Create( | 30 scrollbar_controller_ = ScrollbarAnimationControllerLinearFade::Create( |
31 scroll_layer_.get(), | 31 scroll_layer_.get(), |
32 base::TimeDelta::FromSeconds(2), | 32 base::TimeDelta::FromSeconds(2), |
33 base::TimeDelta::FromSeconds(3)); | 33 base::TimeDelta::FromSeconds(3)); |
34 } | 34 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 scrollbar_controller_->Animate(time); | 153 scrollbar_controller_->Animate(time); |
154 EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity()); | 154 EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity()); |
155 | 155 |
156 time += base::TimeDelta::FromSeconds(1); | 156 time += base::TimeDelta::FromSeconds(1); |
157 scrollbar_controller_->Animate(time); | 157 scrollbar_controller_->Animate(time); |
158 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); | 158 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); |
159 } | 159 } |
160 | 160 |
161 } // namespace | 161 } // namespace |
162 } // namespace cc | 162 } // namespace cc |
OLD | NEW |