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

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

Issue 2816063003: Replace layer id with Element id for tracking scrollbar animation controllers (Closed)
Patch Set: Address reviewer comments, pull element_id.h change to another patch Created 3 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 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/single_scrollbar_animation_controller_thinning.h" 5 #include "cc/input/single_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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 78 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
79 SolidColorScrollbarLayerImpl::Create( 79 SolidColorScrollbarLayerImpl::Create(
80 host_impl_.active_tree(), kId, HORIZONTAL, kThumbThickness, 80 host_impl_.active_tree(), kId, HORIZONTAL, kThumbThickness,
81 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); 81 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
82 scrollbar_layer_ = scrollbar.get(); 82 scrollbar_layer_ = scrollbar.get();
83 83
84 scroll_layer->test_properties()->AddChild(std::move(scrollbar)); 84 scroll_layer->test_properties()->AddChild(std::move(scrollbar));
85 clip_layer_->test_properties()->AddChild(std::move(scroll_layer)); 85 clip_layer_->test_properties()->AddChild(std::move(scroll_layer));
86 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip)); 86 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip));
87 87
88 scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); 88 scrollbar_layer_->SetScrollInfo(scroll_layer_ptr->id(),
89 scroll_layer_ptr->element_id());
89 scrollbar_layer_->test_properties()->opacity_can_animate = true; 90 scrollbar_layer_->test_properties()->opacity_can_animate = true;
90 clip_layer_->SetBounds(gfx::Size(100, 100)); 91 clip_layer_->SetBounds(gfx::Size(100, 100));
91 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); 92 scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
92 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); 93 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting();
93 94
94 scrollbar_controller_ = SingleScrollbarAnimationControllerThinning::Create( 95 scrollbar_controller_ = SingleScrollbarAnimationControllerThinning::Create(
95 scroll_layer_ptr->id(), HORIZONTAL, &client_, kThinningDuration); 96 scroll_layer_ptr->id(), HORIZONTAL, &client_, kThinningDuration);
96 } 97 }
97 98
98 FakeImplTaskRunnerProvider task_runner_provider_; 99 FakeImplTaskRunnerProvider task_runner_provider_;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 scrollbar_layer_->thumb_thickness_scale_factor()); 374 scrollbar_layer_->thumb_thickness_scale_factor());
374 375
375 time += kThinningDuration / 2; 376 time += kThinningDuration / 2;
376 scrollbar_controller_->Animate(time); 377 scrollbar_controller_->Animate(time);
377 EXPECT_FLOAT_EQ(kIdleThicknessScale, 378 EXPECT_FLOAT_EQ(kIdleThicknessScale,
378 scrollbar_layer_->thumb_thickness_scale_factor()); 379 scrollbar_layer_->thumb_thickness_scale_factor());
379 } 380 }
380 381
381 } // namespace 382 } // namespace
382 } // namespace cc 383 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698