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

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

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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/input/scrollbar_animation_controller_linear_fade.h" 5 #include "cc/input/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_task_runner_provider.h" 8 #include "cc/test/fake_impl_task_runner_provider.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"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return host_impl_.ScrollbarsFor(scroll_layer_id); 42 return host_impl_.ScrollbarsFor(scroll_layer_id);
43 } 43 }
44 44
45 protected: 45 protected:
46 void SetUp() override { 46 void SetUp() override {
47 const int kThumbThickness = 10; 47 const int kThumbThickness = 10;
48 const int kTrackStart = 0; 48 const int kTrackStart = 0;
49 const bool kIsLeftSideVerticalScrollbar = false; 49 const bool kIsLeftSideVerticalScrollbar = false;
50 const bool kIsOverlayScrollbar = true; // Allow opacity animations. 50 const bool kIsOverlayScrollbar = true; // Allow opacity animations.
51 51
52 scoped_ptr<LayerImpl> scroll_layer = 52 std::unique_ptr<LayerImpl> scroll_layer =
53 LayerImpl::Create(host_impl_.active_tree(), 1); 53 LayerImpl::Create(host_impl_.active_tree(), 1);
54 scrollbar_layer_ = SolidColorScrollbarLayerImpl::Create( 54 scrollbar_layer_ = SolidColorScrollbarLayerImpl::Create(
55 host_impl_.active_tree(), 2, orientation(), kThumbThickness, 55 host_impl_.active_tree(), 2, orientation(), kThumbThickness,
56 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); 56 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
57 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3); 57 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3);
58 scroll_layer->SetScrollClipLayer(clip_layer_->id()); 58 scroll_layer->SetScrollClipLayer(clip_layer_->id());
59 LayerImpl* scroll_layer_ptr = scroll_layer.get(); 59 LayerImpl* scroll_layer_ptr = scroll_layer.get();
60 clip_layer_->AddChild(std::move(scroll_layer)); 60 clip_layer_->AddChild(std::move(scroll_layer));
61 61
62 scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); 62 scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id());
63 clip_layer_->SetBounds(gfx::Size(100, 100)); 63 clip_layer_->SetBounds(gfx::Size(100, 100));
64 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); 64 scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
65 65
66 scrollbar_controller_ = ScrollbarAnimationControllerLinearFade::Create( 66 scrollbar_controller_ = ScrollbarAnimationControllerLinearFade::Create(
67 scroll_layer_ptr->id(), this, base::TimeDelta::FromSeconds(2), 67 scroll_layer_ptr->id(), this, base::TimeDelta::FromSeconds(2),
68 base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(3)); 68 base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(3));
69 } 69 }
70 70
71 virtual ScrollbarOrientation orientation() const { return HORIZONTAL; } 71 virtual ScrollbarOrientation orientation() const { return HORIZONTAL; }
72 72
73 FakeImplTaskRunnerProvider task_runner_provider_; 73 FakeImplTaskRunnerProvider task_runner_provider_;
74 TestSharedBitmapManager shared_bitmap_manager_; 74 TestSharedBitmapManager shared_bitmap_manager_;
75 TestTaskGraphRunner task_graph_runner_; 75 TestTaskGraphRunner task_graph_runner_;
76 FakeLayerTreeHostImpl host_impl_; 76 FakeLayerTreeHostImpl host_impl_;
77 scoped_ptr<ScrollbarAnimationControllerLinearFade> scrollbar_controller_; 77 std::unique_ptr<ScrollbarAnimationControllerLinearFade> scrollbar_controller_;
78 scoped_ptr<LayerImpl> clip_layer_; 78 std::unique_ptr<LayerImpl> clip_layer_;
79 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar_layer_; 79 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar_layer_;
80 80
81 base::Closure start_fade_; 81 base::Closure start_fade_;
82 base::TimeDelta delay_; 82 base::TimeDelta delay_;
83 bool did_request_redraw_; 83 bool did_request_redraw_;
84 bool did_request_animate_; 84 bool did_request_animate_;
85 }; 85 };
86 86
87 class VerticalScrollbarAnimationControllerLinearFadeTest 87 class VerticalScrollbarAnimationControllerLinearFadeTest
88 : public ScrollbarAnimationControllerLinearFadeTest { 88 : public ScrollbarAnimationControllerLinearFadeTest {
89 protected: 89 protected:
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); 474 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity());
475 475
476 time += base::TimeDelta::FromSeconds(1); 476 time += base::TimeDelta::FromSeconds(1);
477 scrollbar_controller_->DidScrollEnd(); 477 scrollbar_controller_->DidScrollEnd();
478 EXPECT_FALSE(did_request_animate_); 478 EXPECT_FALSE(did_request_animate_);
479 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); 479 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity());
480 } 480 }
481 481
482 } // namespace 482 } // namespace
483 } // namespace cc 483 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/scrollbar_animation_controller_linear_fade.cc ('k') | cc/input/scrollbar_animation_controller_thinning.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698