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

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

Issue 2860293002: Change cc::ElementId to be a uint64_t (Closed)
Patch Set: none Created 3 years, 7 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 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.h" 5 #include "cc/input/scrollbar_animation_controller.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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 const base::TimeDelta kFadeDelay = base::TimeDelta::FromSeconds(4); 73 const base::TimeDelta kFadeDelay = base::TimeDelta::FromSeconds(4);
74 const base::TimeDelta kFadeDuration = base::TimeDelta::FromSeconds(3); 74 const base::TimeDelta kFadeDuration = base::TimeDelta::FromSeconds(3);
75 const base::TimeDelta kThinningDuration = base::TimeDelta::FromSeconds(2); 75 const base::TimeDelta kThinningDuration = base::TimeDelta::FromSeconds(2);
76 76
77 void SetUp() override { 77 void SetUp() override {
78 std::unique_ptr<LayerImpl> scroll_layer = 78 std::unique_ptr<LayerImpl> scroll_layer =
79 LayerImpl::Create(host_impl_.active_tree(), 1); 79 LayerImpl::Create(host_impl_.active_tree(), 1);
80 std::unique_ptr<LayerImpl> clip = 80 std::unique_ptr<LayerImpl> clip =
81 LayerImpl::Create(host_impl_.active_tree(), 2); 81 LayerImpl::Create(host_impl_.active_tree(), 2);
82 clip_layer_ = clip.get(); 82 clip_layer_ = clip.get();
83 scroll_layer->SetElementId( 83 scroll_layer->SetElementId(ElementId(scroll_layer->id()));
suzyh_UTC10 (ex-contributor) 2017/05/05 04:27:30 You construct an ElementId here but not elsewhere
chrishtr 2017/05/05 05:34:52 This is incorrect, fixed.
84 LayerIdToElementIdForTesting(scroll_layer->id()));
85 scroll_layer->SetScrollClipLayer(clip_layer_->id()); 84 scroll_layer->SetScrollClipLayer(clip_layer_->id());
86 LayerImpl* scroll_layer_ptr = scroll_layer.get(); 85 LayerImpl* scroll_layer_ptr = scroll_layer.get();
87 86
88 const int kTrackStart = 0; 87 const int kTrackStart = 0;
89 const int kTrackLength = 100; 88 const int kTrackLength = 100;
90 const bool kIsLeftSideVerticalScrollbar = false; 89 const bool kIsLeftSideVerticalScrollbar = false;
91 const bool kIsOverlayScrollbar = true; 90 const bool kIsOverlayScrollbar = true;
92 91
93 std::unique_ptr<SolidColorScrollbarLayerImpl> h_scrollbar = 92 std::unique_ptr<SolidColorScrollbarLayerImpl> h_scrollbar =
94 SolidColorScrollbarLayerImpl::Create( 93 SolidColorScrollbarLayerImpl::Create(
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 LayerImpl::Create(host_impl_.active_tree(), 1); 1237 LayerImpl::Create(host_impl_.active_tree(), 1);
1239 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 1238 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
1240 SolidColorScrollbarLayerImpl::Create( 1239 SolidColorScrollbarLayerImpl::Create(
1241 host_impl_.active_tree(), 2, orientation(), kThumbThickness, 1240 host_impl_.active_tree(), 2, orientation(), kThumbThickness,
1242 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); 1241 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
1243 scrollbar_layer_ = scrollbar.get(); 1242 scrollbar_layer_ = scrollbar.get();
1244 scrollbar_layer_->test_properties()->opacity_can_animate = true; 1243 scrollbar_layer_->test_properties()->opacity_can_animate = true;
1245 std::unique_ptr<LayerImpl> clip = 1244 std::unique_ptr<LayerImpl> clip =
1246 LayerImpl::Create(host_impl_.active_tree(), 3); 1245 LayerImpl::Create(host_impl_.active_tree(), 3);
1247 clip_layer_ = clip.get(); 1246 clip_layer_ = clip.get();
1248 scroll_layer->SetElementId( 1247 scroll_layer->SetElementId(scroll_layer->id());
1249 LayerIdToElementIdForTesting(scroll_layer->id()));
1250 1248
1251 scroll_layer->SetScrollClipLayer(clip_layer_->id()); 1249 scroll_layer->SetScrollClipLayer(clip_layer_->id());
1252 LayerImpl* scroll_layer_ptr = scroll_layer.get(); 1250 LayerImpl* scroll_layer_ptr = scroll_layer.get();
1253 scroll_layer->test_properties()->AddChild(std::move(scrollbar)); 1251 scroll_layer->test_properties()->AddChild(std::move(scrollbar));
1254 clip->test_properties()->AddChild(std::move(scroll_layer)); 1252 clip->test_properties()->AddChild(std::move(scroll_layer));
1255 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip)); 1253 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip));
1256 1254
1257 scrollbar_layer_->SetScrollElementId(scroll_layer_ptr->element_id()); 1255 scrollbar_layer_->SetScrollElementId(scroll_layer_ptr->element_id());
1258 clip_layer_->SetBounds(gfx::Size(100, 100)); 1256 clip_layer_->SetBounds(gfx::Size(100, 100));
1259 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); 1257 scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); 1669 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
1672 1670
1673 time += base::TimeDelta::FromSeconds(1); 1671 time += base::TimeDelta::FromSeconds(1);
1674 scrollbar_controller_->DidScrollEnd(); 1672 scrollbar_controller_->DidScrollEnd();
1675 EXPECT_FALSE(did_request_animate_); 1673 EXPECT_FALSE(did_request_animate_);
1676 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); 1674 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
1677 } 1675 }
1678 1676
1679 } // namespace 1677 } // namespace
1680 } // namespace cc 1678 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698