Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc

Issue 645853008: Standardize usage of virtual/override/final in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/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 ScrollbarAnimationControllerLinearFadeTest 18 class ScrollbarAnimationControllerLinearFadeTest
19 : public testing::Test, 19 : public testing::Test,
20 public ScrollbarAnimationControllerClient { 20 public ScrollbarAnimationControllerClient {
21 public: 21 public:
22 ScrollbarAnimationControllerLinearFadeTest() 22 ScrollbarAnimationControllerLinearFadeTest()
23 : host_impl_(&proxy_, &shared_bitmap_manager_), needs_frame_count_(0) {} 23 : host_impl_(&proxy_, &shared_bitmap_manager_), needs_frame_count_(0) {}
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 delay_ = delay; 28 delay_ = delay;
29 } 29 }
30 virtual void SetNeedsScrollbarAnimationFrame() override { 30 void SetNeedsScrollbarAnimationFrame() override { needs_frame_count_++; }
31 needs_frame_count_++;
32 }
33 31
34 protected: 32 protected:
35 virtual void SetUp() { 33 virtual void SetUp() {
36 const int kThumbThickness = 10; 34 const int kThumbThickness = 10;
37 const int kTrackStart = 0; 35 const int kTrackStart = 0;
38 const bool kIsLeftSideVerticalScrollbar = false; 36 const bool kIsLeftSideVerticalScrollbar = false;
39 const bool kIsOverlayScrollbar = true; // Allow opacity animations. 37 const bool kIsOverlayScrollbar = true; // Allow opacity animations.
40 38
41 scoped_ptr<LayerImpl> scroll_layer = 39 scoped_ptr<LayerImpl> scroll_layer =
42 LayerImpl::Create(host_impl_.active_tree(), 1); 40 LayerImpl::Create(host_impl_.active_tree(), 1);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar_layer_; 74 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar_layer_;
77 75
78 base::Closure start_fade_; 76 base::Closure start_fade_;
79 base::TimeDelta delay_; 77 base::TimeDelta delay_;
80 int needs_frame_count_; 78 int needs_frame_count_;
81 }; 79 };
82 80
83 class VerticalScrollbarAnimationControllerLinearFadeTest 81 class VerticalScrollbarAnimationControllerLinearFadeTest
84 : public ScrollbarAnimationControllerLinearFadeTest { 82 : public ScrollbarAnimationControllerLinearFadeTest {
85 protected: 83 protected:
86 virtual ScrollbarOrientation orientation() const override { return VERTICAL; } 84 ScrollbarOrientation orientation() const override { return VERTICAL; }
87 }; 85 };
88 86
89 TEST_F(ScrollbarAnimationControllerLinearFadeTest, DelayAnimationOnResize) { 87 TEST_F(ScrollbarAnimationControllerLinearFadeTest, DelayAnimationOnResize) {
90 scrollbar_layer_->SetOpacity(0.0f); 88 scrollbar_layer_->SetOpacity(0.0f);
91 scrollbar_controller_->DidScrollBegin(); 89 scrollbar_controller_->DidScrollBegin();
92 scrollbar_controller_->DidScrollUpdate(true); 90 scrollbar_controller_->DidScrollUpdate(true);
93 scrollbar_controller_->DidScrollEnd(); 91 scrollbar_controller_->DidScrollEnd();
94 // Normal Animation delay of 2 seconds. 92 // Normal Animation delay of 2 seconds.
95 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); 93 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
96 EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(2)); 94 EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(2));
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 scrollbar_controller_->DidScrollUpdate(false); 410 scrollbar_controller_->DidScrollUpdate(false);
413 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); 411 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity());
414 412
415 time += base::TimeDelta::FromSeconds(1); 413 time += base::TimeDelta::FromSeconds(1);
416 scrollbar_controller_->DidScrollEnd(); 414 scrollbar_controller_->DidScrollEnd();
417 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); 415 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity());
418 } 416 }
419 417
420 } // namespace 418 } // namespace
421 } // namespace cc 419 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/scrollbar_animation_controller_linear_fade.h ('k') | cc/animation/scrollbar_animation_controller_thinning.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698