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 | 16 class ScrollbarAnimationControllerLinearFadeTest |
17 : public testing::Test, | 17 : public testing::Test, |
18 public ScrollbarAnimationControllerClient { | 18 public ScrollbarAnimationControllerClient { |
19 public: | 19 public: |
20 ScrollbarAnimationControllerLinearFadeTest() | 20 ScrollbarAnimationControllerLinearFadeTest() |
21 : host_impl_(&proxy_, &shared_bitmap_manager_), needs_frame_count_(0) {} | 21 : host_impl_(&proxy_, &shared_bitmap_manager_), needs_frame_count_(0) {} |
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 needs_frame_count_++; | 28 needs_frame_count_++; |
29 } | 29 } |
30 | 30 |
31 protected: | 31 protected: |
32 virtual void SetUp() { | 32 virtual void SetUp() { |
33 const int kThumbThickness = 10; | 33 const int kThumbThickness = 10; |
34 const int kTrackStart = 0; | 34 const int kTrackStart = 0; |
35 const bool kIsLeftSideVerticalScrollbar = false; | 35 const bool kIsLeftSideVerticalScrollbar = false; |
36 const bool kIsOverlayScrollbar = true; // Allow opacity animations. | 36 const bool kIsOverlayScrollbar = true; // Allow opacity animations. |
37 | 37 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 scrollbar_controller_->DidScrollUpdate(); | 258 scrollbar_controller_->DidScrollUpdate(); |
259 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); | 259 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); |
260 | 260 |
261 time += base::TimeDelta::FromSeconds(1); | 261 time += base::TimeDelta::FromSeconds(1); |
262 scrollbar_controller_->DidScrollEnd(); | 262 scrollbar_controller_->DidScrollEnd(); |
263 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); | 263 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); |
264 } | 264 } |
265 | 265 |
266 } // namespace | 266 } // namespace |
267 } // namespace cc | 267 } // namespace cc |
OLD | NEW |