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

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

Issue 2273933002: cc : Delete LayerImpl::OnOpacityAnimated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 4 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 bool did_request_animate_; 92 bool did_request_animate_;
93 }; 93 };
94 94
95 class VerticalScrollbarAnimationControllerLinearFadeTest 95 class VerticalScrollbarAnimationControllerLinearFadeTest
96 : public ScrollbarAnimationControllerLinearFadeTest { 96 : public ScrollbarAnimationControllerLinearFadeTest {
97 protected: 97 protected:
98 ScrollbarOrientation orientation() const override { return VERTICAL; } 98 ScrollbarOrientation orientation() const override { return VERTICAL; }
99 }; 99 };
100 100
101 TEST_F(ScrollbarAnimationControllerLinearFadeTest, DelayAnimationOnResize) { 101 TEST_F(ScrollbarAnimationControllerLinearFadeTest, DelayAnimationOnResize) {
102 scrollbar_layer_->OnOpacityAnimated(0.0f); 102 scrollbar_layer_->layer_tree_impl()
103 ->property_trees()
104 ->effect_tree.OnOpacityAnimated(0.0f,
105 scrollbar_layer_->effect_tree_index(),
106 scrollbar_layer_->layer_tree_impl());
103 scrollbar_controller_->DidScrollBegin(); 107 scrollbar_controller_->DidScrollBegin();
104 scrollbar_controller_->DidScrollUpdate(true); 108 scrollbar_controller_->DidScrollUpdate(true);
105 scrollbar_controller_->DidScrollEnd(); 109 scrollbar_controller_->DidScrollEnd();
106 // Normal Animation delay of 2 seconds. 110 // Normal Animation delay of 2 seconds.
107 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 111 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
108 EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(2)); 112 EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(2));
109 113
110 scrollbar_layer_->OnOpacityAnimated(0.0f); 114 scrollbar_layer_->layer_tree_impl()
115 ->property_trees()
116 ->effect_tree.OnOpacityAnimated(0.0f,
117 scrollbar_layer_->effect_tree_index(),
118 scrollbar_layer_->layer_tree_impl());
111 scrollbar_controller_->DidScrollUpdate(true); 119 scrollbar_controller_->DidScrollUpdate(true);
112 // Delay animation on resize to 5 seconds. 120 // Delay animation on resize to 5 seconds.
113 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 121 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
114 EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(5)); 122 EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(5));
115 } 123 }
116 124
117 TEST_F(ScrollbarAnimationControllerLinearFadeTest, HiddenInBegin) { 125 TEST_F(ScrollbarAnimationControllerLinearFadeTest, HiddenInBegin) {
118 scrollbar_layer_->OnOpacityAnimated(0.0f); 126 scrollbar_layer_->layer_tree_impl()
127 ->property_trees()
128 ->effect_tree.OnOpacityAnimated(0.0f,
129 scrollbar_layer_->effect_tree_index(),
130 scrollbar_layer_->layer_tree_impl());
119 scrollbar_controller_->Animate(base::TimeTicks()); 131 scrollbar_controller_->Animate(base::TimeTicks());
120 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity()); 132 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
121 } 133 }
122 134
123 TEST_F(ScrollbarAnimationControllerLinearFadeTest, 135 TEST_F(ScrollbarAnimationControllerLinearFadeTest,
124 HiddenAfterNonScrollingGesture) { 136 HiddenAfterNonScrollingGesture) {
125 scrollbar_layer_->OnOpacityAnimated(0.0f); 137 scrollbar_layer_->layer_tree_impl()
138 ->property_trees()
139 ->effect_tree.OnOpacityAnimated(0.0f,
140 scrollbar_layer_->effect_tree_index(),
141 scrollbar_layer_->layer_tree_impl());
126 scrollbar_controller_->DidScrollBegin(); 142 scrollbar_controller_->DidScrollBegin();
127 143
128 base::TimeTicks time; 144 base::TimeTicks time;
129 time += base::TimeDelta::FromSeconds(100); 145 time += base::TimeDelta::FromSeconds(100);
130 scrollbar_controller_->Animate(time); 146 scrollbar_controller_->Animate(time);
131 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity()); 147 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
132 scrollbar_controller_->DidScrollEnd(); 148 scrollbar_controller_->DidScrollEnd();
133 149
134 EXPECT_TRUE(start_fade_.Equals(base::Closure())); 150 EXPECT_TRUE(start_fade_.Equals(base::Closure()));
135 151
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); 498 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
483 499
484 time += base::TimeDelta::FromSeconds(1); 500 time += base::TimeDelta::FromSeconds(1);
485 scrollbar_controller_->DidScrollEnd(); 501 scrollbar_controller_->DidScrollEnd();
486 EXPECT_FALSE(did_request_animate_); 502 EXPECT_FALSE(did_request_animate_);
487 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); 503 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
488 } 504 }
489 505
490 } // namespace 506 } // namespace
491 } // namespace cc 507 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/scrollbar_animation_controller_linear_fade.cc ('k') | cc/input/scrollbar_animation_controller_thinning.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698