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/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 ScrollbarAnimationControllerLinearFadeTest : public testing::Test { | 16 class ScrollbarAnimationControllerLinearFadeTest : public testing::Test { |
17 public: | 17 public: |
18 ScrollbarAnimationControllerLinearFadeTest() | 18 ScrollbarAnimationControllerLinearFadeTest() |
19 : host_impl_(&proxy_, &shared_bitmap_manager_) {} | 19 : host_impl_(&proxy_, &shared_bitmap_manager_) {} |
20 | 20 |
21 protected: | 21 protected: |
22 virtual void SetUp() { | 22 virtual void SetUp() { |
23 const int kThumbThickness = 10; | 23 const int kThumbThickness = 10; |
| 24 const int kTrackStart = 0; |
24 const bool kIsLeftSideVerticalScrollbar = false; | 25 const bool kIsLeftSideVerticalScrollbar = false; |
25 const bool kIsOverlayScrollbar = true; // Allow opacity animations. | 26 const bool kIsOverlayScrollbar = true; // Allow opacity animations. |
26 | 27 |
27 scoped_ptr<LayerImpl> scroll_layer = | 28 scoped_ptr<LayerImpl> scroll_layer = |
28 LayerImpl::Create(host_impl_.active_tree(), 1); | 29 LayerImpl::Create(host_impl_.active_tree(), 1); |
29 scrollbar_layer_ = | 30 scrollbar_layer_ = |
30 SolidColorScrollbarLayerImpl::Create(host_impl_.active_tree(), | 31 SolidColorScrollbarLayerImpl::Create(host_impl_.active_tree(), |
31 2, | 32 2, |
32 HORIZONTAL, | 33 HORIZONTAL, |
33 kThumbThickness, | 34 kThumbThickness, |
| 35 kTrackStart, |
34 kIsLeftSideVerticalScrollbar, | 36 kIsLeftSideVerticalScrollbar, |
35 kIsOverlayScrollbar); | 37 kIsOverlayScrollbar); |
36 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3); | 38 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3); |
37 scroll_layer->SetScrollClipLayer(clip_layer_->id()); | 39 scroll_layer->SetScrollClipLayer(clip_layer_->id()); |
38 LayerImpl* scroll_layer_ptr = scroll_layer.get(); | 40 LayerImpl* scroll_layer_ptr = scroll_layer.get(); |
39 clip_layer_->AddChild(scroll_layer.Pass()); | 41 clip_layer_->AddChild(scroll_layer.Pass()); |
40 | 42 |
41 scrollbar_layer_->SetClipLayerById(clip_layer_->id()); | 43 scrollbar_layer_->SetClipLayerById(clip_layer_->id()); |
42 scrollbar_layer_->SetScrollLayerById(scroll_layer_ptr->id()); | 44 scrollbar_layer_->SetScrollLayerById(scroll_layer_ptr->id()); |
43 clip_layer_->SetBounds(gfx::Size(100, 100)); | 45 clip_layer_->SetBounds(gfx::Size(100, 100)); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); | 257 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); |
256 | 258 |
257 time += base::TimeDelta::FromSeconds(1); | 259 time += base::TimeDelta::FromSeconds(1); |
258 scrollbar_controller_->DidScrollGestureEnd(time); | 260 scrollbar_controller_->DidScrollGestureEnd(time); |
259 EXPECT_TRUE(scrollbar_controller_->IsAnimating()); | 261 EXPECT_TRUE(scrollbar_controller_->IsAnimating()); |
260 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); | 262 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); |
261 } | 263 } |
262 | 264 |
263 } // namespace | 265 } // namespace |
264 } // namespace cc | 266 } // namespace cc |
OLD | NEW |