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

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

Issue 2453553003: Disable overlay scrollbars in Blink when hidden by the compositor. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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/layers/layer.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"
11 #include "cc/test/test_task_graph_runner.h" 11 #include "cc/test/test_task_graph_runner.h"
12 #include "cc/trees/layer_tree_impl.h" 12 #include "cc/trees/layer_tree_impl.h"
13 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
16 using testing::AtLeast;
17 using testing::Mock;
18 using testing::NiceMock;
19 using testing::_;
20
15 namespace cc { 21 namespace cc {
16 namespace { 22 namespace {
17 23
18 // These constants are hard-coded and should match the values in 24 // These constants are hard-coded and should match the values in
19 // scrollbar_animation_controller_thinning.cc. 25 // scrollbar_animation_controller_thinning.cc.
20 const float kIdleThicknessScale = 0.4f; 26 const float kIdleThicknessScale = 0.4f;
21 const float kDefaultMouseMoveDistanceToTriggerAnimation = 25.f; 27 const float kDefaultMouseMoveDistanceToTriggerAnimation = 25.f;
22 28
23 class ScrollbarAnimationControllerThinningTest 29 class MockScrollbarAnimationControllerClient
24 : public testing::Test, 30 : public ScrollbarAnimationControllerClient {
25 public ScrollbarAnimationControllerClient {
26 public: 31 public:
27 ScrollbarAnimationControllerThinningTest() 32 explicit MockScrollbarAnimationControllerClient(LayerTreeHostImpl* host_impl)
28 : host_impl_(&task_runner_provider_, 33 : host_impl_(host_impl) {}
29 &task_graph_runner_) {} 34 virtual ~MockScrollbarAnimationControllerClient() {}
30 35
31 void PostDelayedScrollbarAnimationTask(const base::Closure& start_fade, 36 void PostDelayedScrollbarAnimationTask(const base::Closure& start_fade,
32 base::TimeDelta delay) override { 37 base::TimeDelta delay) override {
33 start_fade_ = start_fade; 38 start_fade_ = start_fade;
34 delay_ = delay; 39 delay_ = delay;
35 } 40 }
36 void SetNeedsRedrawForScrollbarAnimation() override { 41 void SetNeedsRedrawForScrollbarAnimation() override {}
37 did_request_redraw_ = true; 42 void SetNeedsAnimateForScrollbarAnimation() override {}
43 ScrollbarSet ScrollbarsFor(int scroll_layer_id) const override {
44 return host_impl_->ScrollbarsFor(scroll_layer_id);
38 } 45 }
39 void SetNeedsAnimateForScrollbarAnimation() override { 46 MOCK_METHOD0(DidChangeScrollbarVisibility, void());
40 did_request_animate_ = true; 47
41 } 48 base::Closure& start_fade() { return start_fade_; }
42 ScrollbarSet ScrollbarsFor(int scroll_layer_id) const override { 49 base::TimeDelta& delay() { return delay_; }
43 return host_impl_.ScrollbarsFor(scroll_layer_id); 50
44 } 51 private:
52 base::Closure start_fade_;
53 base::TimeDelta delay_;
54 LayerTreeHostImpl* host_impl_;
55 };
56
57 class ScrollbarAnimationControllerThinningTest : public testing::Test {
58 public:
59 ScrollbarAnimationControllerThinningTest()
60 : host_impl_(&task_runner_provider_, &task_graph_runner_),
61 client_(&host_impl_) {}
45 62
46 protected: 63 protected:
47 const base::TimeDelta kDelayBeforeStarting = base::TimeDelta::FromSeconds(2); 64 const base::TimeDelta kDelayBeforeStarting = base::TimeDelta::FromSeconds(2);
48 const base::TimeDelta kResizeDelayBeforeStarting = 65 const base::TimeDelta kResizeDelayBeforeStarting =
49 base::TimeDelta::FromSeconds(5); 66 base::TimeDelta::FromSeconds(5);
50 const base::TimeDelta kFadeDuration = base::TimeDelta::FromSeconds(3); 67 const base::TimeDelta kFadeDuration = base::TimeDelta::FromSeconds(3);
51 const base::TimeDelta kThinningDuration = base::TimeDelta::FromSeconds(2); 68 const base::TimeDelta kThinningDuration = base::TimeDelta::FromSeconds(2);
52 69
53 void SetUp() override { 70 void SetUp() override {
54 std::unique_ptr<LayerImpl> scroll_layer = 71 std::unique_ptr<LayerImpl> scroll_layer =
(...skipping 20 matching lines...) Expand all
75 clip_layer_->test_properties()->AddChild(std::move(scroll_layer)); 92 clip_layer_->test_properties()->AddChild(std::move(scroll_layer));
76 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip)); 93 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip));
77 94
78 scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); 95 scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id());
79 scrollbar_layer_->test_properties()->opacity_can_animate = true; 96 scrollbar_layer_->test_properties()->opacity_can_animate = true;
80 clip_layer_->SetBounds(gfx::Size(100, 100)); 97 clip_layer_->SetBounds(gfx::Size(100, 100));
81 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); 98 scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
82 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); 99 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting();
83 100
84 scrollbar_controller_ = ScrollbarAnimationControllerThinning::Create( 101 scrollbar_controller_ = ScrollbarAnimationControllerThinning::Create(
85 scroll_layer_ptr->id(), this, kDelayBeforeStarting, 102 scroll_layer_ptr->id(), &client_, kDelayBeforeStarting,
86 kResizeDelayBeforeStarting, kFadeDuration, kThinningDuration); 103 kResizeDelayBeforeStarting, kFadeDuration, kThinningDuration);
87 } 104 }
88 105
89 FakeImplTaskRunnerProvider task_runner_provider_; 106 FakeImplTaskRunnerProvider task_runner_provider_;
90 TestTaskGraphRunner task_graph_runner_; 107 TestTaskGraphRunner task_graph_runner_;
91 FakeLayerTreeHostImpl host_impl_; 108 FakeLayerTreeHostImpl host_impl_;
92 std::unique_ptr<ScrollbarAnimationControllerThinning> scrollbar_controller_; 109 std::unique_ptr<ScrollbarAnimationControllerThinning> scrollbar_controller_;
93 LayerImpl* clip_layer_; 110 LayerImpl* clip_layer_;
94 SolidColorScrollbarLayerImpl* scrollbar_layer_; 111 SolidColorScrollbarLayerImpl* scrollbar_layer_;
95 112 NiceMock<MockScrollbarAnimationControllerClient> client_;
96 base::Closure start_fade_;
97 base::TimeDelta delay_;
98 bool did_request_redraw_;
99 bool did_request_animate_;
100 }; 113 };
101 114
102 // Check initialization of scrollbar. Should start off invisible and thin. 115 // Check initialization of scrollbar. Should start off invisible and thin.
103 TEST_F(ScrollbarAnimationControllerThinningTest, Idle) { 116 TEST_F(ScrollbarAnimationControllerThinningTest, Idle) {
104 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity()); 117 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
105 EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor()); 118 EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
106 } 119 }
107 120
108 // Check that scrollbar appears again when the layer becomes scrollable. 121 // Check that scrollbar appears again when the layer becomes scrollable.
109 TEST_F(ScrollbarAnimationControllerThinningTest, AppearOnResize) { 122 TEST_F(ScrollbarAnimationControllerThinningTest, AppearOnResize) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 scrollbar_controller_->DidScrollBegin(); 180 scrollbar_controller_->DidScrollBegin();
168 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity()); 181 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
169 182
170 scrollbar_controller_->DidScrollUpdate(false); 183 scrollbar_controller_->DidScrollUpdate(false);
171 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 184 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
172 185
173 scrollbar_controller_->DidScrollEnd(); 186 scrollbar_controller_->DidScrollEnd();
174 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 187 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
175 188
176 // An animation should have been enqueued. 189 // An animation should have been enqueued.
177 EXPECT_EQ(kDelayBeforeStarting, delay_); 190 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
178 EXPECT_FALSE(start_fade_.is_null()); 191 EXPECT_FALSE(client_.start_fade().is_null());
179 start_fade_.Run(); 192 client_.start_fade().Run();
180 193
181 // Scrollbar should fade out over kFadeDuration. 194 // Scrollbar should fade out over kFadeDuration.
182 scrollbar_controller_->Animate(time); 195 scrollbar_controller_->Animate(time);
183 time += kFadeDuration; 196 time += kFadeDuration;
184 scrollbar_controller_->Animate(time); 197 scrollbar_controller_->Animate(time);
185 198
186 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity()); 199 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
187 } 200 }
188 201
189 // Scroll content. Move the mouse near the scrollbar and confirm it becomes 202 // Scroll content. Move the mouse near the scrollbar and confirm it becomes
190 // thick. Ensure it fades out after that. 203 // thick. Ensure it fades out after that.
191 TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearAndFadeOut) { 204 TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearAndFadeOut) {
192 base::TimeTicks time; 205 base::TimeTicks time;
193 time += base::TimeDelta::FromSeconds(1); 206 time += base::TimeDelta::FromSeconds(1);
194 207
195 scrollbar_controller_->DidScrollBegin(); 208 scrollbar_controller_->DidScrollBegin();
196 scrollbar_controller_->DidScrollUpdate(false); 209 scrollbar_controller_->DidScrollUpdate(false);
197 scrollbar_controller_->DidScrollEnd(); 210 scrollbar_controller_->DidScrollEnd();
198 211
199 // An animation should have been enqueued. 212 // An animation should have been enqueued.
200 EXPECT_EQ(kDelayBeforeStarting, delay_); 213 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
201 EXPECT_FALSE(start_fade_.is_null()); 214 EXPECT_FALSE(client_.start_fade().is_null());
202 215
203 // Now move the mouse near the scrollbar. This should cancel the currently 216 // Now move the mouse near the scrollbar. This should cancel the currently
204 // queued fading animation and start animating thickness. 217 // queued fading animation and start animating thickness.
205 scrollbar_controller_->DidMouseMoveNear(1); 218 scrollbar_controller_->DidMouseMoveNear(1);
206 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 219 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
207 EXPECT_FLOAT_EQ(kIdleThicknessScale, 220 EXPECT_FLOAT_EQ(kIdleThicknessScale,
208 scrollbar_layer_->thumb_thickness_scale_factor()); 221 scrollbar_layer_->thumb_thickness_scale_factor());
209 EXPECT_TRUE(start_fade_.IsCancelled()); 222 EXPECT_TRUE(client_.start_fade().IsCancelled());
210 223
211 // Scrollbar should become thick. 224 // Scrollbar should become thick.
212 scrollbar_controller_->Animate(time); 225 scrollbar_controller_->Animate(time);
213 time += kThinningDuration; 226 time += kThinningDuration;
214 scrollbar_controller_->Animate(time); 227 scrollbar_controller_->Animate(time);
215 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 228 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
216 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 229 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
217 230
218 // Once the thickening animation is complete, it should enqueue the delayed 231 // Once the thickening animation is complete, it should enqueue the delayed
219 // fade animation. 232 // fade animation.
220 EXPECT_FALSE(start_fade_.is_null()); 233 EXPECT_FALSE(client_.start_fade().is_null());
221 EXPECT_FALSE(start_fade_.IsCancelled()); 234 EXPECT_FALSE(client_.start_fade().IsCancelled());
222 } 235 }
223 236
224 // Scroll content. Move the mouse over the scrollbar and confirm it becomes 237 // Scroll content. Move the mouse over the scrollbar and confirm it becomes
225 // thick. Ensure it fades out after that. 238 // thick. Ensure it fades out after that.
226 TEST_F(ScrollbarAnimationControllerThinningTest, MoveOverAndFadeOut) { 239 TEST_F(ScrollbarAnimationControllerThinningTest, MoveOverAndFadeOut) {
227 base::TimeTicks time; 240 base::TimeTicks time;
228 time += base::TimeDelta::FromSeconds(1); 241 time += base::TimeDelta::FromSeconds(1);
229 242
230 scrollbar_controller_->DidScrollBegin(); 243 scrollbar_controller_->DidScrollBegin();
231 scrollbar_controller_->DidScrollUpdate(false); 244 scrollbar_controller_->DidScrollUpdate(false);
232 scrollbar_controller_->DidScrollEnd(); 245 scrollbar_controller_->DidScrollEnd();
233 246
234 // An animation should have been enqueued. 247 // An animation should have been enqueued.
235 EXPECT_EQ(kDelayBeforeStarting, delay_); 248 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
236 EXPECT_FALSE(start_fade_.is_null()); 249 EXPECT_FALSE(client_.start_fade().is_null());
237 250
238 // Now move the mouse over the scrollbar. This should cancel the currently 251 // Now move the mouse over the scrollbar. This should cancel the currently
239 // queued fading animation and start animating thickness. 252 // queued fading animation and start animating thickness.
240 scrollbar_controller_->DidMouseMoveNear(0); 253 scrollbar_controller_->DidMouseMoveNear(0);
241 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 254 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
242 EXPECT_FLOAT_EQ(kIdleThicknessScale, 255 EXPECT_FLOAT_EQ(kIdleThicknessScale,
243 scrollbar_layer_->thumb_thickness_scale_factor()); 256 scrollbar_layer_->thumb_thickness_scale_factor());
244 EXPECT_TRUE(start_fade_.IsCancelled()); 257 EXPECT_TRUE(client_.start_fade().IsCancelled());
245 258
246 // Scrollbar should become thick. 259 // Scrollbar should become thick.
247 scrollbar_controller_->Animate(time); 260 scrollbar_controller_->Animate(time);
248 time += kThinningDuration; 261 time += kThinningDuration;
249 scrollbar_controller_->Animate(time); 262 scrollbar_controller_->Animate(time);
250 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 263 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
251 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 264 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
252 265
253 // Once the thickening animation is complete, it should enqueue the delayed 266 // Once the thickening animation is complete, it should enqueue the delayed
254 // fade animation. 267 // fade animation.
255 EXPECT_FALSE(start_fade_.is_null()); 268 EXPECT_FALSE(client_.start_fade().is_null());
256 EXPECT_FALSE(start_fade_.IsCancelled()); 269 EXPECT_FALSE(client_.start_fade().IsCancelled());
257 } 270 }
258 271
259 // Make sure a scrollbar captured before the thickening animation doesn't try 272 // Make sure a scrollbar captured before the thickening animation doesn't try
260 // to fade out. 273 // to fade out.
261 TEST_F(ScrollbarAnimationControllerThinningTest, 274 TEST_F(ScrollbarAnimationControllerThinningTest,
262 DontFadeWhileCapturedBeforeThick) { 275 DontFadeWhileCapturedBeforeThick) {
263 base::TimeTicks time; 276 base::TimeTicks time;
264 time += base::TimeDelta::FromSeconds(1); 277 time += base::TimeDelta::FromSeconds(1);
265 278
266 scrollbar_controller_->DidScrollBegin(); 279 scrollbar_controller_->DidScrollBegin();
267 scrollbar_controller_->DidScrollUpdate(false); 280 scrollbar_controller_->DidScrollUpdate(false);
268 scrollbar_controller_->DidScrollEnd(); 281 scrollbar_controller_->DidScrollEnd();
269 282
270 // An animation should have been enqueued. 283 // An animation should have been enqueued.
271 EXPECT_EQ(kDelayBeforeStarting, delay_); 284 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
272 EXPECT_FALSE(start_fade_.is_null()); 285 EXPECT_FALSE(client_.start_fade().is_null());
273 286
274 // Now move the mouse over the scrollbar and capture it. It should become 287 // Now move the mouse over the scrollbar and capture it. It should become
275 // thick without need for an animation. 288 // thick without need for an animation.
276 scrollbar_controller_->DidMouseMoveNear(0); 289 scrollbar_controller_->DidMouseMoveNear(0);
277 scrollbar_controller_->DidMouseDown(); 290 scrollbar_controller_->DidMouseDown();
278 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 291 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
279 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 292 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
280 293
281 // The fade animation should have been cancelled. 294 // The fade animation should have been cancelled.
282 EXPECT_FALSE(start_fade_.is_null()); 295 EXPECT_FALSE(client_.start_fade().is_null());
283 EXPECT_TRUE(start_fade_.IsCancelled()); 296 EXPECT_TRUE(client_.start_fade().IsCancelled());
284 } 297 }
285 298
286 // Make sure a scrollbar captured after a thickening animation doesn't try to 299 // Make sure a scrollbar captured after a thickening animation doesn't try to
287 // fade out. 300 // fade out.
288 TEST_F(ScrollbarAnimationControllerThinningTest, DontFadeWhileCaptured) { 301 TEST_F(ScrollbarAnimationControllerThinningTest, DontFadeWhileCaptured) {
289 base::TimeTicks time; 302 base::TimeTicks time;
290 time += base::TimeDelta::FromSeconds(1); 303 time += base::TimeDelta::FromSeconds(1);
291 304
292 scrollbar_controller_->DidScrollBegin(); 305 scrollbar_controller_->DidScrollBegin();
293 scrollbar_controller_->DidScrollUpdate(false); 306 scrollbar_controller_->DidScrollUpdate(false);
294 scrollbar_controller_->DidScrollEnd(); 307 scrollbar_controller_->DidScrollEnd();
295 308
296 // An animation should have been enqueued. 309 // An animation should have been enqueued.
297 EXPECT_EQ(kDelayBeforeStarting, delay_); 310 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
298 EXPECT_FALSE(start_fade_.is_null()); 311 EXPECT_FALSE(client_.start_fade().is_null());
299 312
300 // Now move the mouse over the scrollbar and animate it until it's thick. 313 // Now move the mouse over the scrollbar and animate it until it's thick.
301 scrollbar_controller_->DidMouseMoveNear(0); 314 scrollbar_controller_->DidMouseMoveNear(0);
302 scrollbar_controller_->Animate(time); 315 scrollbar_controller_->Animate(time);
303 time += kThinningDuration; 316 time += kThinningDuration;
304 scrollbar_controller_->Animate(time); 317 scrollbar_controller_->Animate(time);
305 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 318 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
306 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 319 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
307 320
308 // Since the scrollbar became thick, it should have queued up a fade. 321 // Since the scrollbar became thick, it should have queued up a fade.
309 EXPECT_FALSE(start_fade_.is_null()); 322 EXPECT_FALSE(client_.start_fade().is_null());
310 EXPECT_FALSE(start_fade_.IsCancelled()); 323 EXPECT_FALSE(client_.start_fade().IsCancelled());
311 324
312 // Make sure capturing the scrollbar stops the fade. 325 // Make sure capturing the scrollbar stops the fade.
313 scrollbar_controller_->DidMouseDown(); 326 scrollbar_controller_->DidMouseDown();
314 EXPECT_FALSE(start_fade_.is_null()); 327 EXPECT_FALSE(client_.start_fade().is_null());
315 EXPECT_TRUE(start_fade_.IsCancelled()); 328 EXPECT_TRUE(client_.start_fade().IsCancelled());
316 } 329 }
317 330
318 // Make sure releasing a captured scrollbar causes it to fade out. 331 // Make sure releasing a captured scrollbar causes it to fade out.
319 TEST_F(ScrollbarAnimationControllerThinningTest, FadeAfterReleased) { 332 TEST_F(ScrollbarAnimationControllerThinningTest, FadeAfterReleased) {
320 base::TimeTicks time; 333 base::TimeTicks time;
321 time += base::TimeDelta::FromSeconds(1); 334 time += base::TimeDelta::FromSeconds(1);
322 335
323 scrollbar_controller_->DidScrollBegin(); 336 scrollbar_controller_->DidScrollBegin();
324 scrollbar_controller_->DidScrollUpdate(false); 337 scrollbar_controller_->DidScrollUpdate(false);
325 scrollbar_controller_->DidScrollEnd(); 338 scrollbar_controller_->DidScrollEnd();
326 339
327 // An animation should have been enqueued. 340 // An animation should have been enqueued.
328 EXPECT_EQ(kDelayBeforeStarting, delay_); 341 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
329 EXPECT_FALSE(start_fade_.is_null()); 342 EXPECT_FALSE(client_.start_fade().is_null());
330 343
331 // Now move the mouse over the scrollbar and capture it. 344 // Now move the mouse over the scrollbar and capture it.
332 scrollbar_controller_->DidMouseMoveNear(0); 345 scrollbar_controller_->DidMouseMoveNear(0);
333 scrollbar_controller_->DidMouseDown(); 346 scrollbar_controller_->DidMouseDown();
334 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 347 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
335 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 348 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
336 349
337 // Since the scrollbar became thick, it should have queued up a fade. 350 // Since the scrollbar became thick, it should have queued up a fade.
338 EXPECT_FALSE(start_fade_.is_null()); 351 EXPECT_FALSE(client_.start_fade().is_null());
339 EXPECT_TRUE(start_fade_.IsCancelled()); 352 EXPECT_TRUE(client_.start_fade().IsCancelled());
340 353
341 scrollbar_controller_->DidMouseUp(); 354 scrollbar_controller_->DidMouseUp();
342 EXPECT_FALSE(start_fade_.is_null()); 355 EXPECT_FALSE(client_.start_fade().is_null());
343 EXPECT_FALSE(start_fade_.IsCancelled()); 356 EXPECT_FALSE(client_.start_fade().IsCancelled());
344 } 357 }
345 358
346 // Make sure moving near a scrollbar while it's fading out causes it to reset 359 // Make sure moving near a scrollbar while it's fading out causes it to reset
347 // the opacity and thicken. 360 // the opacity and thicken.
348 TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearScrollbarWhileFading) { 361 TEST_F(ScrollbarAnimationControllerThinningTest, MoveNearScrollbarWhileFading) {
349 base::TimeTicks time; 362 base::TimeTicks time;
350 time += base::TimeDelta::FromSeconds(1); 363 time += base::TimeDelta::FromSeconds(1);
351 364
352 scrollbar_controller_->DidScrollBegin(); 365 scrollbar_controller_->DidScrollBegin();
353 scrollbar_controller_->DidScrollUpdate(false); 366 scrollbar_controller_->DidScrollUpdate(false);
354 scrollbar_controller_->DidScrollEnd(); 367 scrollbar_controller_->DidScrollEnd();
355 368
356 // An animation should have been enqueued. Start it. 369 // An animation should have been enqueued. Start it.
357 EXPECT_EQ(kDelayBeforeStarting, delay_); 370 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
358 EXPECT_FALSE(start_fade_.is_null()); 371 EXPECT_FALSE(client_.start_fade().is_null());
359 start_fade_.Run(); 372 client_.start_fade().Run();
360 373
361 scrollbar_controller_->Animate(time); 374 scrollbar_controller_->Animate(time);
362 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 375 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
363 376
364 // Proceed half way through the fade out animation. 377 // Proceed half way through the fade out animation.
365 time += kFadeDuration / 2; 378 time += kFadeDuration / 2;
366 scrollbar_controller_->Animate(time); 379 scrollbar_controller_->Animate(time);
367 EXPECT_FLOAT_EQ(0.5f, scrollbar_layer_->Opacity()); 380 EXPECT_FLOAT_EQ(0.5f, scrollbar_layer_->Opacity());
368 381
369 // Now move the mouse near the scrollbar. It should reset opacity to 1 382 // Now move the mouse near the scrollbar. It should reset opacity to 1
(...skipping 22 matching lines...) Expand all
392 405
393 // Move mouse over the scrollbar. 406 // Move mouse over the scrollbar.
394 scrollbar_controller_->DidMouseMoveNear(0); 407 scrollbar_controller_->DidMouseMoveNear(0);
395 scrollbar_controller_->Animate(time); 408 scrollbar_controller_->Animate(time);
396 time += kThinningDuration; 409 time += kThinningDuration;
397 scrollbar_controller_->Animate(time); 410 scrollbar_controller_->Animate(time);
398 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 411 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
399 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 412 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
400 413
401 // A fade animation should have been enqueued. Start it. 414 // A fade animation should have been enqueued. Start it.
402 EXPECT_EQ(kDelayBeforeStarting, delay_); 415 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
403 EXPECT_FALSE(start_fade_.is_null()); 416 EXPECT_FALSE(client_.start_fade().is_null());
404 start_fade_.Run(); 417 client_.start_fade().Run();
405 418
406 scrollbar_controller_->Animate(time); 419 scrollbar_controller_->Animate(time);
407 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 420 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
408 421
409 // Proceed half way through the fade out animation. 422 // Proceed half way through the fade out animation.
410 time += kFadeDuration / 2; 423 time += kFadeDuration / 2;
411 scrollbar_controller_->Animate(time); 424 scrollbar_controller_->Animate(time);
412 EXPECT_FLOAT_EQ(0.5f, scrollbar_layer_->Opacity()); 425 EXPECT_FLOAT_EQ(0.5f, scrollbar_layer_->Opacity());
413 426
414 // Now capture the scrollbar. It should reset opacity to 1 instantly. 427 // Now capture the scrollbar. It should reset opacity to 1 instantly.
(...skipping 13 matching lines...) Expand all
428 441
429 // Move mouse over the scrollbar. 442 // Move mouse over the scrollbar.
430 scrollbar_controller_->DidMouseMoveNear(0); 443 scrollbar_controller_->DidMouseMoveNear(0);
431 scrollbar_controller_->Animate(time); 444 scrollbar_controller_->Animate(time);
432 time += kThinningDuration; 445 time += kThinningDuration;
433 scrollbar_controller_->Animate(time); 446 scrollbar_controller_->Animate(time);
434 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 447 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
435 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 448 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
436 449
437 // A fade animation should have been enqueued. Start it. 450 // A fade animation should have been enqueued. Start it.
438 EXPECT_EQ(kDelayBeforeStarting, delay_); 451 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
439 EXPECT_FALSE(start_fade_.is_null()); 452 EXPECT_FALSE(client_.start_fade().is_null());
440 start_fade_.Run(); 453 client_.start_fade().Run();
441 scrollbar_controller_->Animate(time); 454 scrollbar_controller_->Animate(time);
442 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 455 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
443 456
444 // Fade the scrollbar out completely. 457 // Fade the scrollbar out completely.
445 time += kFadeDuration; 458 time += kFadeDuration;
446 scrollbar_controller_->Animate(time); 459 scrollbar_controller_->Animate(time);
447 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity()); 460 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
448 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 461 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
449 462
450 start_fade_.Reset(); 463 client_.start_fade().Reset();
451 464
452 // Now try to capture the scrollbar. It shouldn't do anything since it's 465 // Now try to capture the scrollbar. It shouldn't do anything since it's
453 // completely faded out. 466 // completely faded out.
454 scrollbar_controller_->DidMouseDown(); 467 scrollbar_controller_->DidMouseDown();
455 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity()); 468 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
456 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 469 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
457 EXPECT_TRUE(start_fade_.is_null()); 470 EXPECT_TRUE(client_.start_fade().is_null());
458 471
459 // Similarly, releasing the scrollbar should have no effect. 472 // Similarly, releasing the scrollbar should have no effect.
460 scrollbar_controller_->DidMouseUp(); 473 scrollbar_controller_->DidMouseUp();
461 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity()); 474 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
462 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 475 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
463 EXPECT_TRUE(start_fade_.is_null()); 476 EXPECT_TRUE(client_.start_fade().is_null());
464 } 477 }
465 478
466 // Initiate a scroll when the pointer is already near the scrollbar. It should 479 // Initiate a scroll when the pointer is already near the scrollbar. It should
467 // appear thick and remain thick. 480 // appear thick and remain thick.
468 TEST_F(ScrollbarAnimationControllerThinningTest, ScrollWithMouseNear) { 481 TEST_F(ScrollbarAnimationControllerThinningTest, ScrollWithMouseNear) {
469 base::TimeTicks time; 482 base::TimeTicks time;
470 time += base::TimeDelta::FromSeconds(1); 483 time += base::TimeDelta::FromSeconds(1);
471 484
472 scrollbar_controller_->DidMouseMoveNear(1); 485 scrollbar_controller_->DidMouseMoveNear(1);
473 scrollbar_controller_->Animate(time); 486 scrollbar_controller_->Animate(time);
474 time += kThinningDuration; 487 time += kThinningDuration;
475 488
476 // Since the scrollbar isn't visible yet (because we haven't scrolled), we 489 // Since the scrollbar isn't visible yet (because we haven't scrolled), we
477 // shouldn't have applied the thickening. 490 // shouldn't have applied the thickening.
478 scrollbar_controller_->Animate(time); 491 scrollbar_controller_->Animate(time);
479 EXPECT_FLOAT_EQ(kIdleThicknessScale, 492 EXPECT_FLOAT_EQ(kIdleThicknessScale,
480 scrollbar_layer_->thumb_thickness_scale_factor()); 493 scrollbar_layer_->thumb_thickness_scale_factor());
481 494
482 scrollbar_controller_->DidScrollBegin(); 495 scrollbar_controller_->DidScrollBegin();
483 scrollbar_controller_->DidScrollUpdate(false); 496 scrollbar_controller_->DidScrollUpdate(false);
484 497
485 // Now that we've received a scroll, we should be thick without an animation. 498 // Now that we've received a scroll, we should be thick without an animation.
486 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 499 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
487 500
488 // An animation for the fade should have been enqueued. 501 // An animation for the fade should have been enqueued.
489 scrollbar_controller_->DidScrollEnd(); 502 scrollbar_controller_->DidScrollEnd();
490 EXPECT_EQ(kDelayBeforeStarting, delay_); 503 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
491 EXPECT_FALSE(start_fade_.is_null()); 504 EXPECT_FALSE(client_.start_fade().is_null());
492 505
493 start_fade_.Run(); 506 client_.start_fade().Run();
494 scrollbar_controller_->Animate(time); 507 scrollbar_controller_->Animate(time);
495 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 508 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
496 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 509 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
497 510
498 // Scrollbar should still be thick, even though the scrollbar fades out. 511 // Scrollbar should still be thick, even though the scrollbar fades out.
499 time += kFadeDuration; 512 time += kFadeDuration;
500 scrollbar_controller_->Animate(time); 513 scrollbar_controller_->Animate(time);
501 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity()); 514 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
502 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 515 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
503 } 516 }
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 861
849 time += kThinningDuration / 2; 862 time += kThinningDuration / 2;
850 scrollbar_controller_->Animate(time); 863 scrollbar_controller_->Animate(time);
851 EXPECT_FLOAT_EQ(kIdleThicknessScale, 864 EXPECT_FLOAT_EQ(kIdleThicknessScale,
852 scrollbar_layer_->thumb_thickness_scale_factor()); 865 scrollbar_layer_->thumb_thickness_scale_factor());
853 } 866 }
854 867
855 // Tests that main thread scroll updates immediatley queue a fade animation 868 // Tests that main thread scroll updates immediatley queue a fade animation
856 // without requiring a ScrollEnd. 869 // without requiring a ScrollEnd.
857 TEST_F(ScrollbarAnimationControllerThinningTest, MainThreadScrollQueuesFade) { 870 TEST_F(ScrollbarAnimationControllerThinningTest, MainThreadScrollQueuesFade) {
858 ASSERT_TRUE(start_fade_.is_null()); 871 ASSERT_TRUE(client_.start_fade().is_null());
859 872
860 // A ScrollUpdate without a ScrollBegin indicates a main thread scroll update 873 // A ScrollUpdate without a ScrollBegin indicates a main thread scroll update
861 // so we should schedule a fade animation without waiting for a ScrollEnd 874 // so we should schedule a fade animation without waiting for a ScrollEnd
862 // (which will never come). 875 // (which will never come).
863 scrollbar_controller_->DidScrollUpdate(false); 876 scrollbar_controller_->DidScrollUpdate(false);
864 EXPECT_FALSE(start_fade_.is_null()); 877 EXPECT_FALSE(client_.start_fade().is_null());
865 EXPECT_EQ(kDelayBeforeStarting, delay_); 878 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
866 879
867 start_fade_.Reset(); 880 client_.start_fade().Reset();
868 881
869 // If we got a ScrollBegin, we shouldn't schedule the fade animation until we 882 // If we got a ScrollBegin, we shouldn't schedule the fade animation until we
870 // get a corresponding ScrollEnd. 883 // get a corresponding ScrollEnd.
871 scrollbar_controller_->DidScrollBegin(); 884 scrollbar_controller_->DidScrollBegin();
872 scrollbar_controller_->DidScrollUpdate(false); 885 scrollbar_controller_->DidScrollUpdate(false);
873 EXPECT_TRUE(start_fade_.is_null()); 886 EXPECT_TRUE(client_.start_fade().is_null());
874 scrollbar_controller_->DidScrollEnd(); 887 scrollbar_controller_->DidScrollEnd();
875 EXPECT_FALSE(start_fade_.is_null()); 888 EXPECT_FALSE(client_.start_fade().is_null());
876 EXPECT_EQ(kDelayBeforeStarting, delay_); 889 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
877 } 890 }
878 891
879 // Make sure that if the scroll update is as a result of a resize, we use the 892 // Make sure that if the scroll update is as a result of a resize, we use the
880 // resize delay time instead of the default one. 893 // resize delay time instead of the default one.
881 TEST_F(ScrollbarAnimationControllerThinningTest, ResizeFadeDuration) { 894 TEST_F(ScrollbarAnimationControllerThinningTest, ResizeFadeDuration) {
882 ASSERT_TRUE(delay_.is_zero()); 895 ASSERT_TRUE(client_.delay().is_zero());
883 896
884 scrollbar_controller_->DidScrollUpdate(true); 897 scrollbar_controller_->DidScrollUpdate(true);
885 EXPECT_FALSE(start_fade_.is_null()); 898 EXPECT_FALSE(client_.start_fade().is_null());
886 EXPECT_EQ(kResizeDelayBeforeStarting, delay_); 899 EXPECT_EQ(kResizeDelayBeforeStarting, client_.delay());
887 900
888 delay_ = base::TimeDelta(); 901 client_.delay() = base::TimeDelta();
889 902
890 // We should use the gesture delay rather than the resize delay if we're in a 903 // We should use the gesture delay rather than the resize delay if we're in a
891 // gesture scroll, even if the resize param is set. 904 // gesture scroll, even if the resize param is set.
892 scrollbar_controller_->DidScrollBegin(); 905 scrollbar_controller_->DidScrollBegin();
893 scrollbar_controller_->DidScrollUpdate(true); 906 scrollbar_controller_->DidScrollUpdate(true);
894 scrollbar_controller_->DidScrollEnd(); 907 scrollbar_controller_->DidScrollEnd();
895 908
896 EXPECT_FALSE(start_fade_.is_null()); 909 EXPECT_FALSE(client_.start_fade().is_null());
897 EXPECT_EQ(kDelayBeforeStarting, delay_); 910 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
898 } 911 }
899 912
900 // Tests that the fade effect is animated. 913 // Tests that the fade effect is animated.
901 TEST_F(ScrollbarAnimationControllerThinningTest, FadeAnimated) { 914 TEST_F(ScrollbarAnimationControllerThinningTest, FadeAnimated) {
902 // Scroll to make the scrollbars visible. 915 // Scroll to make the scrollbars visible.
903 scrollbar_controller_->DidScrollBegin(); 916 scrollbar_controller_->DidScrollBegin();
904 scrollbar_controller_->DidScrollUpdate(false); 917 scrollbar_controller_->DidScrollUpdate(false);
905 scrollbar_controller_->DidScrollEnd(); 918 scrollbar_controller_->DidScrollEnd();
906 919
907 // Appearance is instant. 920 // Appearance is instant.
908 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 921 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
909 922
910 // An animation should have been enqueued. 923 // An animation should have been enqueued.
911 EXPECT_EQ(kDelayBeforeStarting, delay_); 924 EXPECT_EQ(kDelayBeforeStarting, client_.delay());
912 EXPECT_FALSE(start_fade_.is_null()); 925 EXPECT_FALSE(client_.start_fade().is_null());
913 start_fade_.Run(); 926 client_.start_fade().Run();
914 927
915 base::TimeTicks time; 928 base::TimeTicks time;
916 time += base::TimeDelta::FromSeconds(1); 929 time += base::TimeDelta::FromSeconds(1);
917 930
918 // Test that at half the fade duration time, the opacity is at half. 931 // Test that at half the fade duration time, the opacity is at half.
919 scrollbar_controller_->Animate(time); 932 scrollbar_controller_->Animate(time);
920 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); 933 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
921 934
922 time += kFadeDuration / 2; 935 time += kFadeDuration / 2;
923 scrollbar_controller_->Animate(time); 936 scrollbar_controller_->Animate(time);
924 EXPECT_FLOAT_EQ(0.5f, scrollbar_layer_->Opacity()); 937 EXPECT_FLOAT_EQ(0.5f, scrollbar_layer_->Opacity());
925 938
926 time += kFadeDuration / 2; 939 time += kFadeDuration / 2;
927 scrollbar_controller_->Animate(time); 940 scrollbar_controller_->Animate(time);
928 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity()); 941 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
929 } 942 }
930 943
944 // Tests that the controller tells the client when the scrollbars hide/show.
945 TEST_F(ScrollbarAnimationControllerThinningTest, NotifyChangedVisibility) {
946 base::TimeTicks time;
947 time += base::TimeDelta::FromSeconds(1);
948
949 EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(1);
950 // Scroll to make the scrollbars visible.
951 scrollbar_controller_->DidScrollBegin();
952 scrollbar_controller_->DidScrollUpdate(false);
953 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden());
954 Mock::VerifyAndClearExpectations(&client_);
955
956 scrollbar_controller_->DidScrollEnd();
957
958 // Play out the fade animation. We shouldn't notify that the scrollbars are
959 // hidden until the animation is completly over. We can (but don't have to)
960 // notify during the animation that the scrollbars are still visible.
961 EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(0);
962 ASSERT_FALSE(client_.start_fade().is_null());
963 client_.start_fade().Run();
964 scrollbar_controller_->Animate(time);
965 time += kFadeDuration / 4;
966 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden());
967 scrollbar_controller_->Animate(time);
968 time += kFadeDuration / 4;
969 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden());
970 scrollbar_controller_->Animate(time);
971 time += kFadeDuration / 4;
972 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden());
973 scrollbar_controller_->Animate(time);
974 EXPECT_FLOAT_EQ(0.25f, scrollbar_layer_->Opacity());
975 Mock::VerifyAndClearExpectations(&client_);
976
977 EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(1);
978 time += kFadeDuration / 4;
979 scrollbar_controller_->Animate(time);
980 EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden());
981 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
982 Mock::VerifyAndClearExpectations(&client_);
983
984 // Calling DidScrollUpdate without a begin (i.e. update from commit) should
985 // also notify.
986 EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(1);
987 scrollbar_controller_->DidScrollUpdate(false);
988 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden());
989 Mock::VerifyAndClearExpectations(&client_);
990 }
991
931 } // namespace 992 } // namespace
932 } // namespace cc 993 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/scrollbar_animation_controller_thinning.cc ('k') | cc/layers/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698