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

Side by Side Diff: cc/input/scrollbar_animation_controller_thinning_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
« no previous file with comments | « cc/input/scrollbar_animation_controller_thinning.cc ('k') | cc/input/top_controls_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_thinning.h" 5 #include "cc/input/scrollbar_animation_controller_thinning.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 24 matching lines...) Expand all
35 } 35 }
36 void SetNeedsAnimateForScrollbarAnimation() override { 36 void SetNeedsAnimateForScrollbarAnimation() override {
37 did_request_animate_ = true; 37 did_request_animate_ = true;
38 } 38 }
39 ScrollbarSet ScrollbarsFor(int scroll_layer_id) const override { 39 ScrollbarSet ScrollbarsFor(int scroll_layer_id) const override {
40 return host_impl_.ScrollbarsFor(scroll_layer_id); 40 return host_impl_.ScrollbarsFor(scroll_layer_id);
41 } 41 }
42 42
43 protected: 43 protected:
44 void SetUp() override { 44 void SetUp() override {
45 scoped_ptr<LayerImpl> scroll_layer = 45 std::unique_ptr<LayerImpl> scroll_layer =
46 LayerImpl::Create(host_impl_.active_tree(), 1); 46 LayerImpl::Create(host_impl_.active_tree(), 1);
47 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3); 47 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3);
48 scroll_layer->SetScrollClipLayer(clip_layer_->id()); 48 scroll_layer->SetScrollClipLayer(clip_layer_->id());
49 LayerImpl* scroll_layer_ptr = scroll_layer.get(); 49 LayerImpl* scroll_layer_ptr = scroll_layer.get();
50 clip_layer_->AddChild(std::move(scroll_layer)); 50 clip_layer_->AddChild(std::move(scroll_layer));
51 51
52 const int kId = 2; 52 const int kId = 2;
53 const int kThumbThickness = 10; 53 const int kThumbThickness = 10;
54 const int kTrackStart = 0; 54 const int kTrackStart = 0;
55 const bool kIsLeftSideVerticalScrollbar = false; 55 const bool kIsLeftSideVerticalScrollbar = false;
56 const bool kIsOverlayScrollbar = true; 56 const bool kIsOverlayScrollbar = true;
57 scrollbar_layer_ = SolidColorScrollbarLayerImpl::Create( 57 scrollbar_layer_ = SolidColorScrollbarLayerImpl::Create(
58 host_impl_.active_tree(), kId, HORIZONTAL, kThumbThickness, kTrackStart, 58 host_impl_.active_tree(), kId, HORIZONTAL, kThumbThickness, kTrackStart,
59 kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); 59 kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
60 60
61 scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); 61 scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id());
62 clip_layer_->SetBounds(gfx::Size(100, 100)); 62 clip_layer_->SetBounds(gfx::Size(100, 100));
63 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); 63 scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
64 64
65 scrollbar_controller_ = ScrollbarAnimationControllerThinning::Create( 65 scrollbar_controller_ = ScrollbarAnimationControllerThinning::Create(
66 scroll_layer_ptr->id(), this, base::TimeDelta::FromSeconds(2), 66 scroll_layer_ptr->id(), this, base::TimeDelta::FromSeconds(2),
67 base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(3)); 67 base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(3));
68 } 68 }
69 69
70 FakeImplTaskRunnerProvider task_runner_provider_; 70 FakeImplTaskRunnerProvider task_runner_provider_;
71 TestSharedBitmapManager shared_bitmap_manager_; 71 TestSharedBitmapManager shared_bitmap_manager_;
72 TestTaskGraphRunner task_graph_runner_; 72 TestTaskGraphRunner task_graph_runner_;
73 FakeLayerTreeHostImpl host_impl_; 73 FakeLayerTreeHostImpl host_impl_;
74 scoped_ptr<ScrollbarAnimationControllerThinning> scrollbar_controller_; 74 std::unique_ptr<ScrollbarAnimationControllerThinning> scrollbar_controller_;
75 scoped_ptr<LayerImpl> clip_layer_; 75 std::unique_ptr<LayerImpl> clip_layer_;
76 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar_layer_; 76 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar_layer_;
77 77
78 base::Closure start_fade_; 78 base::Closure start_fade_;
79 base::TimeDelta delay_; 79 base::TimeDelta delay_;
80 bool did_request_redraw_; 80 bool did_request_redraw_;
81 bool did_request_animate_; 81 bool did_request_animate_;
82 }; 82 };
83 83
84 // Check initialization of scrollbar. 84 // Check initialization of scrollbar.
85 TEST_F(ScrollbarAnimationControllerThinningTest, Idle) { 85 TEST_F(ScrollbarAnimationControllerThinningTest, Idle) {
86 scrollbar_controller_->Animate(base::TimeTicks()); 86 scrollbar_controller_->Animate(base::TimeTicks());
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 372
373 time += base::TimeDelta::FromSeconds(1); 373 time += base::TimeDelta::FromSeconds(1);
374 scrollbar_controller_->Animate(time); 374 scrollbar_controller_->Animate(time);
375 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity()); 375 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
376 // The thickness now gets big again. 376 // The thickness now gets big again.
377 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 377 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
378 } 378 }
379 379
380 } // namespace 380 } // namespace
381 } // namespace cc 381 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/scrollbar_animation_controller_thinning.cc ('k') | cc/input/top_controls_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698