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

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

Issue 2841943002: Overlay scrollbars expand only when mouse is near thumb (Closed)
Patch Set: weiliangc comment addressed 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"
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/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 using testing::AtLeast; 16 using testing::AtLeast;
17 using testing::Mock; 17 using testing::Mock;
18 using testing::NiceMock; 18 using testing::NiceMock;
19 using testing::_; 19 using testing::_;
20 20
21 namespace cc { 21 namespace cc {
22 namespace { 22 namespace {
23 23
24 const float kIdleThicknessScale = 24 const float kIdleThicknessScale =
25 SingleScrollbarAnimationControllerThinning::kIdleThicknessScale; 25 SingleScrollbarAnimationControllerThinning::kIdleThicknessScale;
26 const float kDefaultMouseMoveDistanceToTriggerAnimation =
27 SingleScrollbarAnimationControllerThinning::
28 kDefaultMouseMoveDistanceToTriggerAnimation;
29 const float kMouseMoveDistanceToTriggerFadeIn = 26 const float kMouseMoveDistanceToTriggerFadeIn =
30 ScrollbarAnimationController::kMouseMoveDistanceToTriggerFadeIn; 27 ScrollbarAnimationController::kMouseMoveDistanceToTriggerFadeIn;
28 const float kMouseMoveDistanceToTriggerExpand =
29 SingleScrollbarAnimationControllerThinning::
30 kMouseMoveDistanceToTriggerExpand;
31 const int kThumbThickness = 10; 31 const int kThumbThickness = 10;
32 32
33 class MockScrollbarAnimationControllerClient 33 class MockScrollbarAnimationControllerClient
34 : public ScrollbarAnimationControllerClient { 34 : public ScrollbarAnimationControllerClient {
35 public: 35 public:
36 explicit MockScrollbarAnimationControllerClient(LayerTreeHostImpl* host_impl) 36 explicit MockScrollbarAnimationControllerClient(LayerTreeHostImpl* host_impl)
37 : host_impl_(host_impl) {} 37 : host_impl_(host_impl) {}
38 virtual ~MockScrollbarAnimationControllerClient() {} 38 virtual ~MockScrollbarAnimationControllerClient() {}
39 39
40 void PostDelayedScrollbarAnimationTask(const base::Closure& start_fade, 40 void PostDelayedScrollbarAnimationTask(const base::Closure& start_fade,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
84 LayerIdToElementIdForTesting(scroll_layer->id())); 84 LayerIdToElementIdForTesting(scroll_layer->id()));
85 scroll_layer->SetScrollClipLayer(clip_layer_->id()); 85 scroll_layer->SetScrollClipLayer(clip_layer_->id());
86 LayerImpl* scroll_layer_ptr = scroll_layer.get(); 86 LayerImpl* scroll_layer_ptr = scroll_layer.get();
87 87
88 const int kTrackStart = 0; 88 const int kTrackStart = 0;
89 const int kTrackLength = 100;
89 const bool kIsLeftSideVerticalScrollbar = false; 90 const bool kIsLeftSideVerticalScrollbar = false;
90 const bool kIsOverlayScrollbar = true; 91 const bool kIsOverlayScrollbar = true;
91 92
92 std::unique_ptr<SolidColorScrollbarLayerImpl> h_scrollbar = 93 std::unique_ptr<SolidColorScrollbarLayerImpl> h_scrollbar =
93 SolidColorScrollbarLayerImpl::Create( 94 SolidColorScrollbarLayerImpl::Create(
94 host_impl_.active_tree(), 3, HORIZONTAL, kThumbThickness, 95 host_impl_.active_tree(), 3, HORIZONTAL, kThumbThickness,
95 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); 96 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
96 std::unique_ptr<SolidColorScrollbarLayerImpl> v_scrollbar = 97 std::unique_ptr<SolidColorScrollbarLayerImpl> v_scrollbar =
97 SolidColorScrollbarLayerImpl::Create( 98 SolidColorScrollbarLayerImpl::Create(
98 host_impl_.active_tree(), 4, VERTICAL, kThumbThickness, kTrackStart, 99 host_impl_.active_tree(), 4, VERTICAL, kThumbThickness, kTrackStart,
99 kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); 100 kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
100 v_scrollbar_layer_ = v_scrollbar.get(); 101 v_scrollbar_layer_ = v_scrollbar.get();
101 h_scrollbar_layer_ = h_scrollbar.get(); 102 h_scrollbar_layer_ = h_scrollbar.get();
102 103
103 scroll_layer->test_properties()->AddChild(std::move(v_scrollbar)); 104 scroll_layer->test_properties()->AddChild(std::move(v_scrollbar));
104 scroll_layer->test_properties()->AddChild(std::move(h_scrollbar)); 105 scroll_layer->test_properties()->AddChild(std::move(h_scrollbar));
105 clip_layer_->test_properties()->AddChild(std::move(scroll_layer)); 106 clip_layer_->test_properties()->AddChild(std::move(scroll_layer));
106 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip)); 107 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip));
107 108
109 v_scrollbar_layer_->SetBounds(gfx::Size(kThumbThickness, kTrackLength));
110 v_scrollbar_layer_->SetPosition(gfx::PointF(90, 0));
108 v_scrollbar_layer_->SetScrollElementId(scroll_layer_ptr->element_id()); 111 v_scrollbar_layer_->SetScrollElementId(scroll_layer_ptr->element_id());
112 v_scrollbar_layer_->test_properties()->opacity_can_animate = true;
113
114 h_scrollbar_layer_->SetBounds(gfx::Size(kTrackLength, kThumbThickness));
115 h_scrollbar_layer_->SetPosition(gfx::PointF(0, 90));
109 h_scrollbar_layer_->SetScrollElementId(scroll_layer_ptr->element_id()); 116 h_scrollbar_layer_->SetScrollElementId(scroll_layer_ptr->element_id());
110 v_scrollbar_layer_->test_properties()->opacity_can_animate = true;
111 h_scrollbar_layer_->test_properties()->opacity_can_animate = true; 117 h_scrollbar_layer_->test_properties()->opacity_can_animate = true;
118
112 clip_layer_->SetBounds(gfx::Size(100, 100)); 119 clip_layer_->SetBounds(gfx::Size(100, 100));
113 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); 120 scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
114 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); 121 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting();
115 122
116 scrollbar_controller_ = ScrollbarAnimationController:: 123 scrollbar_controller_ = ScrollbarAnimationController::
117 CreateScrollbarAnimationControllerAuraOverlay( 124 CreateScrollbarAnimationControllerAuraOverlay(
118 scroll_layer_ptr->element_id(), &client_, kFadeDelay, kFadeDuration, 125 scroll_layer_ptr->element_id(), &client_, kFadeDelay, kFadeDuration,
119 kThinningDuration); 126 kThinningDuration);
127 v_scrollbar_layer_->SetCurrentPos(0);
128 h_scrollbar_layer_->SetCurrentPos(0);
129 }
130
131 // Return a point with given offset from the top-left of vertical scrollbar.
132 gfx::PointF NearVerticalScrollbarBegin(float offset_x, float offset_y) {
133 gfx::PointF p(90, 0);
134 p.Offset(offset_x, offset_y);
135 return p;
136 }
137
138 // Return a point with given offset from the bottom-left of vertical
139 // scrollbar.
140 gfx::PointF NearVerticalScrollbarEnd(float offset_x, float offset_y) {
141 gfx::PointF p(90, 90);
142 p.Offset(offset_x, offset_y);
143 return p;
144 }
145
146 // Return a point with given offset from the top-left of horizontal scrollbar.
147 gfx::PointF NearHorizontalScrollbarBegin(float offset_x, float offset_y) {
148 gfx::PointF p(0, 90);
149 p.Offset(offset_x, offset_y);
150 return p;
120 } 151 }
121 152
122 FakeImplTaskRunnerProvider task_runner_provider_; 153 FakeImplTaskRunnerProvider task_runner_provider_;
123 TestTaskGraphRunner task_graph_runner_; 154 TestTaskGraphRunner task_graph_runner_;
124 FakeLayerTreeHostImpl host_impl_; 155 FakeLayerTreeHostImpl host_impl_;
125 std::unique_ptr<ScrollbarAnimationController> scrollbar_controller_; 156 std::unique_ptr<ScrollbarAnimationController> scrollbar_controller_;
126 LayerImpl* clip_layer_; 157 LayerImpl* clip_layer_;
127 SolidColorScrollbarLayerImpl* v_scrollbar_layer_; 158 SolidColorScrollbarLayerImpl* v_scrollbar_layer_;
128 SolidColorScrollbarLayerImpl* h_scrollbar_layer_; 159 SolidColorScrollbarLayerImpl* h_scrollbar_layer_;
129 NiceMock<MockScrollbarAnimationControllerClient> client_; 160 NiceMock<MockScrollbarAnimationControllerClient> client_;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 282
252 // Scrollbar should fade out over kFadeDuration. 283 // Scrollbar should fade out over kFadeDuration.
253 scrollbar_controller_->Animate(time); 284 scrollbar_controller_->Animate(time);
254 time += kFadeDuration; 285 time += kFadeDuration;
255 scrollbar_controller_->Animate(time); 286 scrollbar_controller_->Animate(time);
256 287
257 ExpectScrollbarsOpacity(0); 288 ExpectScrollbarsOpacity(0);
258 EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden()); 289 EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden());
259 } 290 }
260 291
261 // Scroll content. Move the mouse near the scrollbar and confirm it becomes 292 // Scroll content. Move the mouse near the scrollbar track but not near thumb
262 // thick. Ensure it remains visible as long as the mouse is near the scrollbar. 293 // and confirm it stay thin. Move the mouse near the scrollbar thumb and
294 // confirm it becomes thick.
295 TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
296 MoveNearTrackThenNearThumb) {
297 base::TimeTicks time;
298 time += base::TimeDelta::FromSeconds(1);
299
300 scrollbar_controller_->DidScrollBegin();
301 scrollbar_controller_->DidScrollUpdate();
302 scrollbar_controller_->DidScrollEnd();
303
304 // An fade out animation should have been enqueued.
305 EXPECT_EQ(kFadeDelay, client_.delay());
306 EXPECT_FALSE(client_.start_fade().is_null());
307 EXPECT_FALSE(client_.start_fade().IsCancelled());
308
309 // Now move the mouse near the vertical scrollbar track. This should cancel
310 // the currently queued fading animation and stay scrollbar thin.
311 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarEnd(-1, 0));
312 ExpectScrollbarsOpacity(1);
313 EXPECT_FLOAT_EQ(kIdleThicknessScale,
314 v_scrollbar_layer_->thumb_thickness_scale_factor());
315 EXPECT_FLOAT_EQ(kIdleThicknessScale,
316 h_scrollbar_layer_->thumb_thickness_scale_factor());
317 EXPECT_TRUE(client_.start_fade().IsCancelled());
318
319 scrollbar_controller_->Animate(time);
320 time += kThinningDuration;
321 scrollbar_controller_->Animate(time);
322
323 EXPECT_FLOAT_EQ(kIdleThicknessScale,
324 v_scrollbar_layer_->thumb_thickness_scale_factor());
325 EXPECT_FLOAT_EQ(kIdleThicknessScale,
326 h_scrollbar_layer_->thumb_thickness_scale_factor());
327
328 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
329 scrollbar_controller_->Animate(time);
330 time += kThinningDuration;
331 scrollbar_controller_->Animate(time);
332
333 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
334 EXPECT_FLOAT_EQ(kIdleThicknessScale,
335 h_scrollbar_layer_->thumb_thickness_scale_factor());
336
337 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarEnd(-1, 0));
338 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
339 EXPECT_FLOAT_EQ(kIdleThicknessScale,
340 h_scrollbar_layer_->thumb_thickness_scale_factor());
341 EXPECT_TRUE(client_.start_fade().IsCancelled());
342
343 scrollbar_controller_->Animate(time);
344 time += kThinningDuration;
345 scrollbar_controller_->Animate(time);
346
347 EXPECT_FLOAT_EQ(kIdleThicknessScale,
348 v_scrollbar_layer_->thumb_thickness_scale_factor());
349 EXPECT_FLOAT_EQ(kIdleThicknessScale,
350 h_scrollbar_layer_->thumb_thickness_scale_factor());
351 }
352
353 // Scroll content. Move the mouse near the scrollbar thumb and confirm it
354 // becomes thick. Ensure it remains visible as long as the mouse is near the
355 // scrollbar.
263 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveNearAndDontFadeOut) { 356 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveNearAndDontFadeOut) {
264 base::TimeTicks time; 357 base::TimeTicks time;
265 time += base::TimeDelta::FromSeconds(1); 358 time += base::TimeDelta::FromSeconds(1);
266 359
267 scrollbar_controller_->DidScrollBegin(); 360 scrollbar_controller_->DidScrollBegin();
268 scrollbar_controller_->DidScrollUpdate(); 361 scrollbar_controller_->DidScrollUpdate();
269 scrollbar_controller_->DidScrollEnd(); 362 scrollbar_controller_->DidScrollEnd();
270 363
271 // An fade out animation should have been enqueued. 364 // An fade out animation should have been enqueued.
272 EXPECT_EQ(kFadeDelay, client_.delay()); 365 EXPECT_EQ(kFadeDelay, client_.delay());
273 EXPECT_FALSE(client_.start_fade().is_null()); 366 EXPECT_FALSE(client_.start_fade().is_null());
274 EXPECT_FALSE(client_.start_fade().IsCancelled()); 367 EXPECT_FALSE(client_.start_fade().IsCancelled());
275 368
276 // Now move the mouse near the scrollbar. This should cancel the currently 369 // Now move the mouse near the vertical scrollbar thumb. This should cancel
277 // queued fading animation and start animating thickness. 370 // the currently queued fading animation and start animating thickness.
278 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); 371 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
279 ExpectScrollbarsOpacity(1); 372 ExpectScrollbarsOpacity(1);
280 EXPECT_FLOAT_EQ(kIdleThicknessScale, 373 EXPECT_FLOAT_EQ(kIdleThicknessScale,
281 v_scrollbar_layer_->thumb_thickness_scale_factor()); 374 v_scrollbar_layer_->thumb_thickness_scale_factor());
282 EXPECT_FLOAT_EQ(kIdleThicknessScale, 375 EXPECT_FLOAT_EQ(kIdleThicknessScale,
283 h_scrollbar_layer_->thumb_thickness_scale_factor()); 376 h_scrollbar_layer_->thumb_thickness_scale_factor());
284 EXPECT_TRUE(client_.start_fade().IsCancelled()); 377 EXPECT_TRUE(client_.start_fade().IsCancelled());
285 378
286 // Vertical scrollbar should become thick. 379 // Vertical scrollbar should become thick.
287 scrollbar_controller_->Animate(time); 380 scrollbar_controller_->Animate(time);
288 time += kThinningDuration; 381 time += kThinningDuration;
(...skipping 18 matching lines...) Expand all
307 400
308 scrollbar_controller_->DidScrollBegin(); 401 scrollbar_controller_->DidScrollBegin();
309 scrollbar_controller_->DidScrollUpdate(); 402 scrollbar_controller_->DidScrollUpdate();
310 scrollbar_controller_->DidScrollEnd(); 403 scrollbar_controller_->DidScrollEnd();
311 404
312 // An fade out animation should have been enqueued. 405 // An fade out animation should have been enqueued.
313 EXPECT_EQ(kFadeDelay, client_.delay()); 406 EXPECT_EQ(kFadeDelay, client_.delay());
314 EXPECT_FALSE(client_.start_fade().is_null()); 407 EXPECT_FALSE(client_.start_fade().is_null());
315 EXPECT_FALSE(client_.start_fade().IsCancelled()); 408 EXPECT_FALSE(client_.start_fade().IsCancelled());
316 409
317 // Now move the mouse over the scrollbar. This should cancel the currently 410 // Now move the mouse over the vertical scrollbar thumb. This should cancel
318 // queued fading animation and start animating thickness. 411 // the currently queued fading animation and start animating thickness.
319 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); 412 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
320 ExpectScrollbarsOpacity(1); 413 ExpectScrollbarsOpacity(1);
321 EXPECT_FLOAT_EQ(kIdleThicknessScale, 414 EXPECT_FLOAT_EQ(kIdleThicknessScale,
322 v_scrollbar_layer_->thumb_thickness_scale_factor()); 415 v_scrollbar_layer_->thumb_thickness_scale_factor());
323 EXPECT_FLOAT_EQ(kIdleThicknessScale, 416 EXPECT_FLOAT_EQ(kIdleThicknessScale,
324 h_scrollbar_layer_->thumb_thickness_scale_factor()); 417 h_scrollbar_layer_->thumb_thickness_scale_factor());
325 EXPECT_TRUE(client_.start_fade().IsCancelled()); 418 EXPECT_TRUE(client_.start_fade().IsCancelled());
326 419
327 // Vertical scrollbar should become thick. 420 // Vertical scrollbar should become thick.
328 scrollbar_controller_->Animate(time); 421 scrollbar_controller_->Animate(time);
329 time += kThinningDuration; 422 time += kThinningDuration;
(...skipping 18 matching lines...) Expand all
348 time += base::TimeDelta::FromSeconds(1); 441 time += base::TimeDelta::FromSeconds(1);
349 442
350 scrollbar_controller_->DidScrollBegin(); 443 scrollbar_controller_->DidScrollBegin();
351 scrollbar_controller_->DidScrollUpdate(); 444 scrollbar_controller_->DidScrollUpdate();
352 scrollbar_controller_->DidScrollEnd(); 445 scrollbar_controller_->DidScrollEnd();
353 446
354 // An fade out animation should have been enqueued. 447 // An fade out animation should have been enqueued.
355 EXPECT_EQ(kFadeDelay, client_.delay()); 448 EXPECT_EQ(kFadeDelay, client_.delay());
356 EXPECT_FALSE(client_.start_fade().is_null()); 449 EXPECT_FALSE(client_.start_fade().is_null());
357 450
358 // Now move the mouse over the scrollbar and capture it. It should become 451 // Now move the mouse over the vertical scrollbar thumb and capture it. It
359 // thick without need for an animation. 452 // should become thick without need for an animation.
360 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); 453 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
361 scrollbar_controller_->DidMouseDown(); 454 scrollbar_controller_->DidMouseDown();
362 ExpectScrollbarsOpacity(1); 455 ExpectScrollbarsOpacity(1);
363 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); 456 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
364 EXPECT_FLOAT_EQ(kIdleThicknessScale, 457 EXPECT_FLOAT_EQ(kIdleThicknessScale,
365 h_scrollbar_layer_->thumb_thickness_scale_factor()); 458 h_scrollbar_layer_->thumb_thickness_scale_factor());
366 459
367 // The fade out animation should have been cleared or cancelled. 460 // The fade out animation should have been cleared or cancelled.
368 EXPECT_TRUE(client_.start_fade().is_null() || 461 EXPECT_TRUE(client_.start_fade().is_null() ||
369 client_.start_fade().IsCancelled()); 462 client_.start_fade().IsCancelled());
370 } 463 }
371 464
372 // Make sure a scrollbar captured then move mouse away doesn't try to fade out. 465 // Make sure a scrollbar captured then move mouse away doesn't try to fade out.
373 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, 466 TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
374 DontFadeWhileCapturedThenAway) { 467 DontFadeWhileCapturedThenAway) {
375 base::TimeTicks time; 468 base::TimeTicks time;
376 time += base::TimeDelta::FromSeconds(1); 469 time += base::TimeDelta::FromSeconds(1);
377 470
378 scrollbar_controller_->DidScrollBegin(); 471 scrollbar_controller_->DidScrollBegin();
379 scrollbar_controller_->DidScrollUpdate(); 472 scrollbar_controller_->DidScrollUpdate();
380 scrollbar_controller_->DidScrollEnd(); 473 scrollbar_controller_->DidScrollEnd();
381 474
382 // An fade out animation should have been enqueued. 475 // An fade out animation should have been enqueued.
383 EXPECT_EQ(kFadeDelay, client_.delay()); 476 EXPECT_EQ(kFadeDelay, client_.delay());
384 EXPECT_FALSE(client_.start_fade().is_null()); 477 EXPECT_FALSE(client_.start_fade().is_null());
385 478
386 // Now move the mouse over the scrollbar and capture it. It should become 479 // Now move the mouse over the vertical scrollbar and capture it. It should
387 // thick without need for an animation. 480 // become thick without need for an animation.
388 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); 481 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
389 scrollbar_controller_->DidMouseDown(); 482 scrollbar_controller_->DidMouseDown();
390 ExpectScrollbarsOpacity(1); 483 ExpectScrollbarsOpacity(1);
391 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); 484 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
392 EXPECT_FLOAT_EQ(kIdleThicknessScale, 485 EXPECT_FLOAT_EQ(kIdleThicknessScale,
393 h_scrollbar_layer_->thumb_thickness_scale_factor()); 486 h_scrollbar_layer_->thumb_thickness_scale_factor());
394 487
395 // The fade out animation should have been cleared or cancelled. 488 // The fade out animation should have been cleared or cancelled.
396 EXPECT_TRUE(client_.start_fade().is_null() || 489 EXPECT_TRUE(client_.start_fade().is_null() ||
397 client_.start_fade().IsCancelled()); 490 client_.start_fade().IsCancelled());
398 491
399 // Then move mouse away, The fade out animation should have been cleared or 492 // Then move mouse away, The fade out animation should have been cleared or
400 // cancelled. 493 // cancelled.
401 scrollbar_controller_->DidMouseMoveNear( 494 scrollbar_controller_->DidMouseMove(
402 VERTICAL, kDefaultMouseMoveDistanceToTriggerAnimation); 495 NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerExpand, 0));
403 496
404 EXPECT_TRUE(client_.start_fade().is_null() || 497 EXPECT_TRUE(client_.start_fade().is_null() ||
405 client_.start_fade().IsCancelled()); 498 client_.start_fade().IsCancelled());
406 } 499 }
407 500
408 // Make sure a scrollbar captured after a thickening animation doesn't try to 501 // Make sure a scrollbar captured after a thickening animation doesn't try to
409 // fade out. 502 // fade out.
410 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeWhileCaptured) { 503 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeWhileCaptured) {
411 base::TimeTicks time; 504 base::TimeTicks time;
412 time += base::TimeDelta::FromSeconds(1); 505 time += base::TimeDelta::FromSeconds(1);
413 506
414 scrollbar_controller_->DidScrollBegin(); 507 scrollbar_controller_->DidScrollBegin();
415 scrollbar_controller_->DidScrollUpdate(); 508 scrollbar_controller_->DidScrollUpdate();
416 scrollbar_controller_->DidScrollEnd(); 509 scrollbar_controller_->DidScrollEnd();
417 510
418 // An fade out animation should have been enqueued. 511 // An fade out animation should have been enqueued.
419 EXPECT_EQ(kFadeDelay, client_.delay()); 512 EXPECT_EQ(kFadeDelay, client_.delay());
420 EXPECT_FALSE(client_.start_fade().is_null()); 513 EXPECT_FALSE(client_.start_fade().is_null());
421 EXPECT_FALSE(client_.start_fade().IsCancelled()); 514 EXPECT_FALSE(client_.start_fade().IsCancelled());
422 515
423 // Now move the mouse over the scrollbar and animate it until it's thick. 516 // Now move the mouse over the vertical scrollbar thumb and animate it until
424 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); 517 // it's thick.
518 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
425 scrollbar_controller_->Animate(time); 519 scrollbar_controller_->Animate(time);
426 time += kThinningDuration; 520 time += kThinningDuration;
427 scrollbar_controller_->Animate(time); 521 scrollbar_controller_->Animate(time);
428 ExpectScrollbarsOpacity(1); 522 ExpectScrollbarsOpacity(1);
429 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); 523 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
430 EXPECT_FLOAT_EQ(kIdleThicknessScale, 524 EXPECT_FLOAT_EQ(kIdleThicknessScale,
431 h_scrollbar_layer_->thumb_thickness_scale_factor()); 525 h_scrollbar_layer_->thumb_thickness_scale_factor());
432 526
433 // Since the mouse is over the scrollbar, it should either clear or cancel the 527 // Since the mouse is over the scrollbar, it should either clear or cancel the
434 // queued fade. 528 // queued fade.
(...skipping 15 matching lines...) Expand all
450 544
451 scrollbar_controller_->DidScrollBegin(); 545 scrollbar_controller_->DidScrollBegin();
452 scrollbar_controller_->DidScrollUpdate(); 546 scrollbar_controller_->DidScrollUpdate();
453 scrollbar_controller_->DidScrollEnd(); 547 scrollbar_controller_->DidScrollEnd();
454 548
455 // An fade out animation should have been enqueued. 549 // An fade out animation should have been enqueued.
456 EXPECT_EQ(kFadeDelay, client_.delay()); 550 EXPECT_EQ(kFadeDelay, client_.delay());
457 EXPECT_FALSE(client_.start_fade().is_null()); 551 EXPECT_FALSE(client_.start_fade().is_null());
458 EXPECT_FALSE(client_.start_fade().IsCancelled()); 552 EXPECT_FALSE(client_.start_fade().IsCancelled());
459 553
460 // Now move the mouse over the scrollbar and capture it. 554 // Now move the mouse over the vertical scrollbar thumb and capture it.
461 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); 555 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
462 scrollbar_controller_->DidMouseDown(); 556 scrollbar_controller_->DidMouseDown();
463 ExpectScrollbarsOpacity(1); 557 ExpectScrollbarsOpacity(1);
464 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); 558 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
465 EXPECT_FLOAT_EQ(kIdleThicknessScale, 559 EXPECT_FLOAT_EQ(kIdleThicknessScale,
466 h_scrollbar_layer_->thumb_thickness_scale_factor()); 560 h_scrollbar_layer_->thumb_thickness_scale_factor());
467 561
468 // Since the mouse is still near the scrollbar, the queued fade should be 562 // Since the mouse is still near the scrollbar, the queued fade should be
469 // either null or cancelled. 563 // either null or cancelled.
470 EXPECT_TRUE(client_.start_fade().is_null() || 564 EXPECT_TRUE(client_.start_fade().is_null() ||
471 client_.start_fade().IsCancelled()); 565 client_.start_fade().IsCancelled());
472 566
473 // Now move the mouse away from the scrollbar and release it. 567 // Now move the mouse away from the scrollbar and release it.
474 scrollbar_controller_->DidMouseMoveNear( 568 scrollbar_controller_->DidMouseMove(
475 VERTICAL, kDefaultMouseMoveDistanceToTriggerAnimation); 569 NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn, 0));
476 scrollbar_controller_->DidMouseUp(); 570 scrollbar_controller_->DidMouseUp();
477 571
478 scrollbar_controller_->Animate(time); 572 scrollbar_controller_->Animate(time);
479 ExpectScrollbarsOpacity(1); 573 ExpectScrollbarsOpacity(1);
480 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); 574 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
481 EXPECT_FLOAT_EQ(kIdleThicknessScale, 575 EXPECT_FLOAT_EQ(kIdleThicknessScale,
482 h_scrollbar_layer_->thumb_thickness_scale_factor()); 576 h_scrollbar_layer_->thumb_thickness_scale_factor());
483 time += kThinningDuration; 577 time += kThinningDuration;
484 scrollbar_controller_->Animate(time); 578 scrollbar_controller_->Animate(time);
485 ExpectScrollbarsOpacity(1); 579 ExpectScrollbarsOpacity(1);
(...skipping 15 matching lines...) Expand all
501 595
502 scrollbar_controller_->DidScrollBegin(); 596 scrollbar_controller_->DidScrollBegin();
503 scrollbar_controller_->DidScrollUpdate(); 597 scrollbar_controller_->DidScrollUpdate();
504 scrollbar_controller_->DidScrollEnd(); 598 scrollbar_controller_->DidScrollEnd();
505 599
506 // An fade out animation should have been enqueued. 600 // An fade out animation should have been enqueued.
507 EXPECT_EQ(kFadeDelay, client_.delay()); 601 EXPECT_EQ(kFadeDelay, client_.delay());
508 EXPECT_FALSE(client_.start_fade().is_null()); 602 EXPECT_FALSE(client_.start_fade().is_null());
509 EXPECT_FALSE(client_.start_fade().IsCancelled()); 603 EXPECT_FALSE(client_.start_fade().IsCancelled());
510 604
511 // Now move the mouse over the scrollbar and capture it. 605 // Now move the mouse over the vertical scrollbar thumb and capture it.
512 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); 606 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
513 scrollbar_controller_->DidMouseDown(); 607 scrollbar_controller_->DidMouseDown();
514 ExpectScrollbarsOpacity(1); 608 ExpectScrollbarsOpacity(1);
515 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); 609 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
516 EXPECT_FLOAT_EQ(kIdleThicknessScale, 610 EXPECT_FLOAT_EQ(kIdleThicknessScale,
517 h_scrollbar_layer_->thumb_thickness_scale_factor()); 611 h_scrollbar_layer_->thumb_thickness_scale_factor());
518 612
519 // Since the mouse is over the scrollbar, the queued fade must be either 613 // Since the mouse is over the scrollbar, the queued fade must be either
520 // null or cancelled. 614 // null or cancelled.
521 EXPECT_TRUE(client_.start_fade().is_null() || 615 EXPECT_TRUE(client_.start_fade().is_null() ||
522 client_.start_fade().IsCancelled()); 616 client_.start_fade().IsCancelled());
(...skipping 25 matching lines...) Expand all
548 client_.start_fade().Run(); 642 client_.start_fade().Run();
549 643
550 scrollbar_controller_->Animate(time); 644 scrollbar_controller_->Animate(time);
551 ExpectScrollbarsOpacity(1); 645 ExpectScrollbarsOpacity(1);
552 646
553 // Proceed half way through the fade out animation. 647 // Proceed half way through the fade out animation.
554 time += kFadeDuration / 2; 648 time += kFadeDuration / 2;
555 scrollbar_controller_->Animate(time); 649 scrollbar_controller_->Animate(time);
556 ExpectScrollbarsOpacity(.5f); 650 ExpectScrollbarsOpacity(.5f);
557 651
558 // Now move the mouse near the scrollbar. It should reset opacity to 1 652 // Now move the mouse near the vertical scrollbar thumb. It should reset
559 // instantly and start animating to thick. 653 // opacity to 1 instantly and start animating to thick.
560 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); 654 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
561 ExpectScrollbarsOpacity(1); 655 ExpectScrollbarsOpacity(1);
562 EXPECT_FLOAT_EQ(kIdleThicknessScale, 656 EXPECT_FLOAT_EQ(kIdleThicknessScale,
563 v_scrollbar_layer_->thumb_thickness_scale_factor()); 657 v_scrollbar_layer_->thumb_thickness_scale_factor());
564 EXPECT_FLOAT_EQ(kIdleThicknessScale, 658 EXPECT_FLOAT_EQ(kIdleThicknessScale,
565 h_scrollbar_layer_->thumb_thickness_scale_factor()); 659 h_scrollbar_layer_->thumb_thickness_scale_factor());
566 660
567 scrollbar_controller_->Animate(time); 661 scrollbar_controller_->Animate(time);
568 time += kThinningDuration; 662 time += kThinningDuration;
569 scrollbar_controller_->Animate(time); 663 scrollbar_controller_->Animate(time);
570 ExpectScrollbarsOpacity(1); 664 ExpectScrollbarsOpacity(1);
(...skipping 16 matching lines...) Expand all
587 EXPECT_FALSE(client_.start_fade().IsCancelled()); 681 EXPECT_FALSE(client_.start_fade().IsCancelled());
588 client_.start_fade().Run(); 682 client_.start_fade().Run();
589 scrollbar_controller_->Animate(time); 683 scrollbar_controller_->Animate(time);
590 ExpectScrollbarsOpacity(1); 684 ExpectScrollbarsOpacity(1);
591 685
592 // Fade the scrollbar out completely. 686 // Fade the scrollbar out completely.
593 time += kFadeDuration; 687 time += kFadeDuration;
594 scrollbar_controller_->Animate(time); 688 scrollbar_controller_->Animate(time);
595 ExpectScrollbarsOpacity(0); 689 ExpectScrollbarsOpacity(0);
596 690
597 // Move mouse over the scrollbar. It shouldn't thicken the scrollbar since 691 // Move mouse over the vertical scrollbar thumb. It shouldn't thicken the
598 // it's completely faded out. 692 // scrollbar since it's completely faded out.
599 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); 693 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(0, 0));
600 scrollbar_controller_->Animate(time); 694 scrollbar_controller_->Animate(time);
601 time += kThinningDuration; 695 time += kThinningDuration;
602 scrollbar_controller_->Animate(time); 696 scrollbar_controller_->Animate(time);
603 ExpectScrollbarsOpacity(0); 697 ExpectScrollbarsOpacity(0);
604 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); 698 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
605 EXPECT_FLOAT_EQ(kIdleThicknessScale, 699 EXPECT_FLOAT_EQ(kIdleThicknessScale,
606 h_scrollbar_layer_->thumb_thickness_scale_factor()); 700 h_scrollbar_layer_->thumb_thickness_scale_factor());
607 701
608 client_.start_fade().Reset(); 702 client_.start_fade().Reset();
609 703
(...skipping 14 matching lines...) Expand all
624 h_scrollbar_layer_->thumb_thickness_scale_factor()); 718 h_scrollbar_layer_->thumb_thickness_scale_factor());
625 EXPECT_TRUE(client_.start_fade().is_null()); 719 EXPECT_TRUE(client_.start_fade().is_null());
626 } 720 }
627 721
628 // Initiate a scroll when the pointer is already near the scrollbar. It should 722 // Initiate a scroll when the pointer is already near the scrollbar. It should
629 // appear thick and remain thick. 723 // appear thick and remain thick.
630 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, ScrollWithMouseNear) { 724 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, ScrollWithMouseNear) {
631 base::TimeTicks time; 725 base::TimeTicks time;
632 time += base::TimeDelta::FromSeconds(1); 726 time += base::TimeDelta::FromSeconds(1);
633 727
634 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); 728 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
635 scrollbar_controller_->Animate(time); 729 scrollbar_controller_->Animate(time);
636 time += kThinningDuration; 730 time += kThinningDuration;
637 731
638 // Since the scrollbar isn't visible yet (because we haven't scrolled), we 732 // Since the scrollbar isn't visible yet (because we haven't scrolled), we
639 // shouldn't have applied the thickening. 733 // shouldn't have applied the thickening.
640 scrollbar_controller_->Animate(time); 734 scrollbar_controller_->Animate(time);
641 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); 735 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
642 EXPECT_FLOAT_EQ(kIdleThicknessScale, 736 EXPECT_FLOAT_EQ(kIdleThicknessScale,
643 h_scrollbar_layer_->thumb_thickness_scale_factor()); 737 h_scrollbar_layer_->thumb_thickness_scale_factor());
644 738
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 // moved away. 871 // moved away.
778 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) { 872 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearEach) {
779 base::TimeTicks time; 873 base::TimeTicks time;
780 time += base::TimeDelta::FromSeconds(1); 874 time += base::TimeDelta::FromSeconds(1);
781 875
782 // Scroll to make the scrollbars visible. 876 // Scroll to make the scrollbars visible.
783 scrollbar_controller_->DidScrollBegin(); 877 scrollbar_controller_->DidScrollBegin();
784 scrollbar_controller_->DidScrollUpdate(); 878 scrollbar_controller_->DidScrollUpdate();
785 scrollbar_controller_->DidScrollEnd(); 879 scrollbar_controller_->DidScrollEnd();
786 880
787 // Near vertical scrollbar 881 // Near vertical scrollbar.
788 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); 882 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
789 scrollbar_controller_->Animate(time); 883 scrollbar_controller_->Animate(time);
790 ExpectScrollbarsOpacity(1); 884 ExpectScrollbarsOpacity(1);
791 EXPECT_FLOAT_EQ(kIdleThicknessScale, 885 EXPECT_FLOAT_EQ(kIdleThicknessScale,
792 v_scrollbar_layer_->thumb_thickness_scale_factor()); 886 v_scrollbar_layer_->thumb_thickness_scale_factor());
793 EXPECT_FLOAT_EQ(kIdleThicknessScale, 887 EXPECT_FLOAT_EQ(kIdleThicknessScale,
794 h_scrollbar_layer_->thumb_thickness_scale_factor()); 888 h_scrollbar_layer_->thumb_thickness_scale_factor());
795 889
796 // Should animate to thickened. 890 // Should animate to thickened.
797 time += kThinningDuration; 891 time += kThinningDuration;
798 scrollbar_controller_->Animate(time); 892 scrollbar_controller_->Animate(time);
799 ExpectScrollbarsOpacity(1); 893 ExpectScrollbarsOpacity(1);
800 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); 894 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
801 EXPECT_FLOAT_EQ(kIdleThicknessScale, 895 EXPECT_FLOAT_EQ(kIdleThicknessScale,
802 h_scrollbar_layer_->thumb_thickness_scale_factor()); 896 h_scrollbar_layer_->thumb_thickness_scale_factor());
803 897
804 // Subsequent moves within the nearness threshold should not change anything. 898 // Subsequent moves within the nearness threshold should not change anything.
805 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 2); 899 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-2, 0));
806 scrollbar_controller_->Animate(time); 900 scrollbar_controller_->Animate(time);
807 time += base::TimeDelta::FromSeconds(10); 901 time += base::TimeDelta::FromSeconds(10);
808 scrollbar_controller_->Animate(time); 902 scrollbar_controller_->Animate(time);
809 ExpectScrollbarsOpacity(1); 903 ExpectScrollbarsOpacity(1);
810 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); 904 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
811 EXPECT_FLOAT_EQ(kIdleThicknessScale, 905 EXPECT_FLOAT_EQ(kIdleThicknessScale,
812 h_scrollbar_layer_->thumb_thickness_scale_factor()); 906 h_scrollbar_layer_->thumb_thickness_scale_factor());
813 907
814 // Now move away from bar. 908 // Now move away from bar.
815 scrollbar_controller_->DidMouseMoveNear( 909 scrollbar_controller_->DidMouseMove(
816 VERTICAL, kDefaultMouseMoveDistanceToTriggerAnimation); 910 NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerExpand, 0));
817 scrollbar_controller_->Animate(time); 911 scrollbar_controller_->Animate(time);
818 time += kThinningDuration; 912 time += kThinningDuration;
819 scrollbar_controller_->Animate(time); 913 scrollbar_controller_->Animate(time);
820 ExpectScrollbarsOpacity(1); 914 ExpectScrollbarsOpacity(1);
821 EXPECT_FLOAT_EQ(kIdleThicknessScale, 915 EXPECT_FLOAT_EQ(kIdleThicknessScale,
822 v_scrollbar_layer_->thumb_thickness_scale_factor()); 916 v_scrollbar_layer_->thumb_thickness_scale_factor());
823 EXPECT_FLOAT_EQ(kIdleThicknessScale, 917 EXPECT_FLOAT_EQ(kIdleThicknessScale,
824 h_scrollbar_layer_->thumb_thickness_scale_factor()); 918 h_scrollbar_layer_->thumb_thickness_scale_factor());
825 919
826 // Near horizontal scrollbar 920 // Near horizontal scrollbar
827 scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 2); 921 scrollbar_controller_->DidMouseMove(NearHorizontalScrollbarBegin(0, -1));
828 scrollbar_controller_->Animate(time); 922 scrollbar_controller_->Animate(time);
829 ExpectScrollbarsOpacity(1); 923 ExpectScrollbarsOpacity(1);
830 EXPECT_FLOAT_EQ(kIdleThicknessScale, 924 EXPECT_FLOAT_EQ(kIdleThicknessScale,
831 v_scrollbar_layer_->thumb_thickness_scale_factor()); 925 v_scrollbar_layer_->thumb_thickness_scale_factor());
832 EXPECT_FLOAT_EQ(kIdleThicknessScale, 926 EXPECT_FLOAT_EQ(kIdleThicknessScale,
833 h_scrollbar_layer_->thumb_thickness_scale_factor()); 927 h_scrollbar_layer_->thumb_thickness_scale_factor());
834 928
835 // Should animate to thickened. 929 // Should animate to thickened.
836 time += kThinningDuration; 930 time += kThinningDuration;
837 scrollbar_controller_->Animate(time); 931 scrollbar_controller_->Animate(time);
838 ExpectScrollbarsOpacity(1); 932 ExpectScrollbarsOpacity(1);
839 EXPECT_FLOAT_EQ(kIdleThicknessScale, 933 EXPECT_FLOAT_EQ(kIdleThicknessScale,
840 v_scrollbar_layer_->thumb_thickness_scale_factor()); 934 v_scrollbar_layer_->thumb_thickness_scale_factor());
841 EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->thumb_thickness_scale_factor()); 935 EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->thumb_thickness_scale_factor());
842 936
843 // Subsequent moves within the nearness threshold should not change anything. 937 // Subsequent moves within the nearness threshold should not change anything.
844 scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 1); 938 scrollbar_controller_->DidMouseMove(NearHorizontalScrollbarBegin(0, -2));
845 scrollbar_controller_->Animate(time); 939 scrollbar_controller_->Animate(time);
846 time += base::TimeDelta::FromSeconds(10); 940 time += base::TimeDelta::FromSeconds(10);
847 scrollbar_controller_->Animate(time); 941 scrollbar_controller_->Animate(time);
848 ExpectScrollbarsOpacity(1); 942 ExpectScrollbarsOpacity(1);
849 EXPECT_FLOAT_EQ(kIdleThicknessScale, 943 EXPECT_FLOAT_EQ(kIdleThicknessScale,
850 v_scrollbar_layer_->thumb_thickness_scale_factor()); 944 v_scrollbar_layer_->thumb_thickness_scale_factor());
851 EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->thumb_thickness_scale_factor()); 945 EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->thumb_thickness_scale_factor());
852 946
853 // Now move away from bar. 947 // Now move away from bar.
854 scrollbar_controller_->DidMouseMoveNear( 948 scrollbar_controller_->DidMouseMove(
855 HORIZONTAL, kDefaultMouseMoveDistanceToTriggerAnimation); 949 NearHorizontalScrollbarBegin(0, -kMouseMoveDistanceToTriggerExpand));
856 scrollbar_controller_->Animate(time); 950 scrollbar_controller_->Animate(time);
857 time += kThinningDuration; 951 time += kThinningDuration;
858 scrollbar_controller_->Animate(time); 952 scrollbar_controller_->Animate(time);
859 ExpectScrollbarsOpacity(1); 953 ExpectScrollbarsOpacity(1);
860 EXPECT_FLOAT_EQ(kIdleThicknessScale, 954 EXPECT_FLOAT_EQ(kIdleThicknessScale,
861 v_scrollbar_layer_->thumb_thickness_scale_factor()); 955 v_scrollbar_layer_->thumb_thickness_scale_factor());
862 EXPECT_FLOAT_EQ(kIdleThicknessScale, 956 EXPECT_FLOAT_EQ(kIdleThicknessScale,
863 h_scrollbar_layer_->thumb_thickness_scale_factor()); 957 h_scrollbar_layer_->thumb_thickness_scale_factor());
864 958
865 // An fade out animation should have been enqueued. 959 // An fade out animation should have been enqueued.
866 EXPECT_FALSE(client_.start_fade().is_null()); 960 EXPECT_FALSE(client_.start_fade().is_null());
867 EXPECT_EQ(kFadeDelay, client_.delay()); 961 EXPECT_EQ(kFadeDelay, client_.delay());
868 } 962 }
869 963
870 // Move mouse near both scrollbars at the same time. 964 // Move mouse near both scrollbars at the same time.
871 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearBoth) { 965 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearBoth) {
872 base::TimeTicks time; 966 base::TimeTicks time;
873 time += base::TimeDelta::FromSeconds(1); 967 time += base::TimeDelta::FromSeconds(1);
874 968
875 // Scroll to make the scrollbars visible. 969 // Scroll to make the scrollbars visible.
876 scrollbar_controller_->DidScrollBegin(); 970 scrollbar_controller_->DidScrollBegin();
877 scrollbar_controller_->DidScrollUpdate(); 971 scrollbar_controller_->DidScrollUpdate();
878 scrollbar_controller_->DidScrollEnd(); 972 scrollbar_controller_->DidScrollEnd();
879 973
974 // Move scrollbar thumb to the end of track.
975 v_scrollbar_layer_->SetCurrentPos(100);
976 h_scrollbar_layer_->SetCurrentPos(100);
977
880 // Near both Scrollbar 978 // Near both Scrollbar
881 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); 979 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarEnd(-1, -1));
882 scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 1);
883 scrollbar_controller_->Animate(time); 980 scrollbar_controller_->Animate(time);
884 ExpectScrollbarsOpacity(1); 981 ExpectScrollbarsOpacity(1);
885 EXPECT_FLOAT_EQ(kIdleThicknessScale, 982 EXPECT_FLOAT_EQ(kIdleThicknessScale,
886 v_scrollbar_layer_->thumb_thickness_scale_factor()); 983 v_scrollbar_layer_->thumb_thickness_scale_factor());
887 EXPECT_FLOAT_EQ(kIdleThicknessScale, 984 EXPECT_FLOAT_EQ(kIdleThicknessScale,
888 h_scrollbar_layer_->thumb_thickness_scale_factor()); 985 h_scrollbar_layer_->thumb_thickness_scale_factor());
889 986
890 // Should animate to thickened. 987 // Should animate to thickened.
891 time += kThinningDuration; 988 time += kThinningDuration;
892 scrollbar_controller_->Animate(time); 989 scrollbar_controller_->Animate(time);
893 ExpectScrollbarsOpacity(1); 990 ExpectScrollbarsOpacity(1);
894 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); 991 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor());
895 EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->thumb_thickness_scale_factor()); 992 EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->thumb_thickness_scale_factor());
896 } 993 }
897 994
898 // Move mouse from one to the other scrollbar before animation is finished, then 995 // Move mouse from one to the other scrollbar before animation is finished, then
899 // away before animation finished. 996 // away before animation finished.
900 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, 997 TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
901 MouseNearOtherBeforeAnimationFinished) { 998 MouseNearOtherBeforeAnimationFinished) {
902 base::TimeTicks time; 999 base::TimeTicks time;
903 time += base::TimeDelta::FromSeconds(1); 1000 time += base::TimeDelta::FromSeconds(1);
904 1001
905 // Scroll to make the scrollbars visible. 1002 // Scroll to make the scrollbars visible.
906 scrollbar_controller_->DidScrollBegin(); 1003 scrollbar_controller_->DidScrollBegin();
907 scrollbar_controller_->DidScrollUpdate(); 1004 scrollbar_controller_->DidScrollUpdate();
908 scrollbar_controller_->DidScrollEnd(); 1005 scrollbar_controller_->DidScrollEnd();
909 1006
910 // Near vertical scrollbar. 1007 // Near vertical scrollbar.
911 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); 1008 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
912 scrollbar_controller_->Animate(time); 1009 scrollbar_controller_->Animate(time);
913 ExpectScrollbarsOpacity(1); 1010 ExpectScrollbarsOpacity(1);
914 EXPECT_FLOAT_EQ(kIdleThicknessScale, 1011 EXPECT_FLOAT_EQ(kIdleThicknessScale,
915 v_scrollbar_layer_->thumb_thickness_scale_factor()); 1012 v_scrollbar_layer_->thumb_thickness_scale_factor());
916 EXPECT_FLOAT_EQ(kIdleThicknessScale, 1013 EXPECT_FLOAT_EQ(kIdleThicknessScale,
917 h_scrollbar_layer_->thumb_thickness_scale_factor()); 1014 h_scrollbar_layer_->thumb_thickness_scale_factor());
918 1015
919 // Vertical scrollbar animate to half thickened. 1016 // Vertical scrollbar animate to half thickened.
920 time += kThinningDuration / 2; 1017 time += kThinningDuration / 2;
921 scrollbar_controller_->Animate(time); 1018 scrollbar_controller_->Animate(time);
922 ExpectScrollbarsOpacity(1); 1019 ExpectScrollbarsOpacity(1);
923 EXPECT_FLOAT_EQ(kIdleThicknessScale + (1.0f - kIdleThicknessScale) / 2, 1020 EXPECT_FLOAT_EQ(kIdleThicknessScale + (1.0f - kIdleThicknessScale) / 2,
924 v_scrollbar_layer_->thumb_thickness_scale_factor()); 1021 v_scrollbar_layer_->thumb_thickness_scale_factor());
925 EXPECT_FLOAT_EQ(kIdleThicknessScale, 1022 EXPECT_FLOAT_EQ(kIdleThicknessScale,
926 h_scrollbar_layer_->thumb_thickness_scale_factor()); 1023 h_scrollbar_layer_->thumb_thickness_scale_factor());
927 1024
928 // Away vertical scrollbar and near horizontal scrollbar. 1025 // Away vertical scrollbar and near horizontal scrollbar.
929 scrollbar_controller_->DidMouseMoveNear( 1026 scrollbar_controller_->DidMouseMove(gfx::PointF(0, 0));
930 VERTICAL, kDefaultMouseMoveDistanceToTriggerAnimation); 1027 scrollbar_controller_->DidMouseMove(NearHorizontalScrollbarBegin(0, -1));
931 scrollbar_controller_->DidMouseMoveNear(HORIZONTAL, 1);
932 scrollbar_controller_->Animate(time); 1028 scrollbar_controller_->Animate(time);
933 1029
934 // Vertical scrollbar animate to thin. horizontal scrollbar animate to 1030 // Vertical scrollbar animate to thin. horizontal scrollbar animate to
935 // thickened. 1031 // thickened.
936 time += kThinningDuration; 1032 time += kThinningDuration;
937 scrollbar_controller_->Animate(time); 1033 scrollbar_controller_->Animate(time);
938 ExpectScrollbarsOpacity(1); 1034 ExpectScrollbarsOpacity(1);
939 EXPECT_FLOAT_EQ(kIdleThicknessScale, 1035 EXPECT_FLOAT_EQ(kIdleThicknessScale,
940 v_scrollbar_layer_->thumb_thickness_scale_factor()); 1036 v_scrollbar_layer_->thumb_thickness_scale_factor());
941 EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->thumb_thickness_scale_factor()); 1037 EXPECT_FLOAT_EQ(1, h_scrollbar_layer_->thumb_thickness_scale_factor());
942 1038
943 // Away horizontal scrollbar. 1039 // Away horizontal scrollbar.
944 scrollbar_controller_->DidMouseMoveNear( 1040 scrollbar_controller_->DidMouseMove(gfx::PointF(0, 0));
945 HORIZONTAL, kDefaultMouseMoveDistanceToTriggerAnimation);
946 scrollbar_controller_->Animate(time); 1041 scrollbar_controller_->Animate(time);
947 1042
948 // Horizontal scrollbar animate to thin. 1043 // Horizontal scrollbar animate to thin.
949 time += kThinningDuration; 1044 time += kThinningDuration;
950 scrollbar_controller_->Animate(time); 1045 scrollbar_controller_->Animate(time);
951 ExpectScrollbarsOpacity(1); 1046 ExpectScrollbarsOpacity(1);
952 EXPECT_FLOAT_EQ(kIdleThicknessScale, 1047 EXPECT_FLOAT_EQ(kIdleThicknessScale,
953 v_scrollbar_layer_->thumb_thickness_scale_factor()); 1048 v_scrollbar_layer_->thumb_thickness_scale_factor());
954 EXPECT_FLOAT_EQ(kIdleThicknessScale, 1049 EXPECT_FLOAT_EQ(kIdleThicknessScale,
955 h_scrollbar_layer_->thumb_thickness_scale_factor()); 1050 h_scrollbar_layer_->thumb_thickness_scale_factor());
956 1051
957 // An fade out animation should have been enqueued. 1052 // An fade out animation should have been enqueued.
958 EXPECT_FALSE(client_.start_fade().is_null()); 1053 EXPECT_FALSE(client_.start_fade().is_null());
959 EXPECT_EQ(kFadeDelay, client_.delay()); 1054 EXPECT_EQ(kFadeDelay, client_.delay());
960 } 1055 }
961 1056
962 // Ensure we have a delay fadeout animation after mouse leave without a mouse 1057 // Ensure we have a delay fadeout animation after mouse leave without a mouse
963 // move. 1058 // move.
964 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseLeaveFadeOut) { 1059 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseLeaveFadeOut) {
965 base::TimeTicks time; 1060 base::TimeTicks time;
966 time += base::TimeDelta::FromSeconds(1); 1061 time += base::TimeDelta::FromSeconds(1);
967 1062
968 // Move mouse near scrollbar. 1063 // Move mouse near scrollbar.
969 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); 1064 scrollbar_controller_->DidMouseMove(NearVerticalScrollbarBegin(-1, 0));
970 1065
971 // Scroll to make the scrollbars visible. 1066 // Scroll to make the scrollbars visible.
972 scrollbar_controller_->DidScrollBegin(); 1067 scrollbar_controller_->DidScrollBegin();
973 scrollbar_controller_->DidScrollUpdate(); 1068 scrollbar_controller_->DidScrollUpdate();
974 scrollbar_controller_->DidScrollEnd(); 1069 scrollbar_controller_->DidScrollEnd();
975 1070
976 // Should not have delay fadeout animation. 1071 // Should not have delay fadeout animation.
977 EXPECT_TRUE(client_.start_fade().is_null() || 1072 EXPECT_TRUE(client_.start_fade().is_null() ||
978 client_.start_fade().IsCancelled()); 1073 client_.start_fade().IsCancelled());
979 1074
980 // Mouse leave. 1075 // Mouse leave.
981 scrollbar_controller_->DidMouseLeave(); 1076 scrollbar_controller_->DidMouseLeave();
982 1077
983 // An fade out animation should have been enqueued. 1078 // An fade out animation should have been enqueued.
984 EXPECT_FALSE(client_.start_fade().is_null()); 1079 EXPECT_FALSE(client_.start_fade().is_null());
985 EXPECT_EQ(kFadeDelay, client_.delay()); 1080 EXPECT_EQ(kFadeDelay, client_.delay());
986 } 1081 }
987 1082
988 // Scrollbars should schedule a delay fade in when mouse hover the show 1083 // Scrollbars should schedule a delay fade in when mouse hover the show
989 // scrollbar region of a hidden scrollbar. 1084 // scrollbar region of a hidden scrollbar.
990 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, BasicMouseHoverFadeIn) { 1085 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, BasicMouseHoverFadeIn) {
991 base::TimeTicks time; 1086 base::TimeTicks time;
992 time += base::TimeDelta::FromSeconds(1); 1087 time += base::TimeDelta::FromSeconds(1);
993 1088
994 // Move mouse hover the fade in scrollbar region of scrollbar. 1089 // Move mouse hover the fade in scrollbar region of scrollbar.
995 scrollbar_controller_->DidMouseMoveNear( 1090 scrollbar_controller_->DidMouseMove(
996 VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1); 1091 NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
997 1092
998 // An fade in animation should have been enqueued. 1093 // An fade in animation should have been enqueued.
999 EXPECT_FALSE(client_.start_fade().is_null()); 1094 EXPECT_FALSE(client_.start_fade().is_null());
1000 EXPECT_FALSE(client_.start_fade().IsCancelled()); 1095 EXPECT_FALSE(client_.start_fade().IsCancelled());
1001 EXPECT_EQ(kFadeDelay, client_.delay()); 1096 EXPECT_EQ(kFadeDelay, client_.delay());
1002 1097
1003 // Play the delay animation. 1098 // Play the delay animation.
1004 client_.start_fade().Run(); 1099 client_.start_fade().Run();
1005 EXPECT_TRUE(client_.start_fade().IsCancelled()); 1100 EXPECT_TRUE(client_.start_fade().IsCancelled());
1006 1101
(...skipping 12 matching lines...) Expand all
1019 } 1114 }
1020 1115
1021 // Scrollbars should not schedule a new delay fade in when the mouse hovers 1116 // Scrollbars should not schedule a new delay fade in when the mouse hovers
1022 // inside a scrollbar already scheduled a delay fade in. 1117 // inside a scrollbar already scheduled a delay fade in.
1023 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, 1118 TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
1024 MouseHoverScrollbarAndMoveInside) { 1119 MouseHoverScrollbarAndMoveInside) {
1025 base::TimeTicks time; 1120 base::TimeTicks time;
1026 time += base::TimeDelta::FromSeconds(1); 1121 time += base::TimeDelta::FromSeconds(1);
1027 1122
1028 // Move mouse hover the fade in scrollbar region of scrollbar. 1123 // Move mouse hover the fade in scrollbar region of scrollbar.
1029 scrollbar_controller_->DidMouseMoveNear( 1124 scrollbar_controller_->DidMouseMove(
1030 VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1); 1125 NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
1031 1126
1032 // An fade in animation should have been enqueued. 1127 // An fade in animation should have been enqueued.
1033 EXPECT_FALSE(client_.start_fade().is_null()); 1128 EXPECT_FALSE(client_.start_fade().is_null());
1034 EXPECT_FALSE(client_.start_fade().IsCancelled()); 1129 EXPECT_FALSE(client_.start_fade().IsCancelled());
1035 EXPECT_EQ(kFadeDelay, client_.delay()); 1130 EXPECT_EQ(kFadeDelay, client_.delay());
1036 1131
1037 base::Closure& fade = client_.start_fade(); 1132 base::Closure& fade = client_.start_fade();
1038 // Move mouse still hover the fade in scrollbar region of scrollbar should not 1133 // Move mouse still hover the fade in scrollbar region of scrollbar should not
1039 // post a new fade in. 1134 // post a new fade in.
1040 scrollbar_controller_->DidMouseMoveNear( 1135 scrollbar_controller_->DidMouseMove(
1041 VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 2); 1136 NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 2, 0));
1042 1137
1043 EXPECT_TRUE(fade.Equals(client_.start_fade())); 1138 EXPECT_TRUE(fade.Equals(client_.start_fade()));
1044 } 1139 }
1045 1140
1046 // Scrollbars should cancel delay fade in when mouse hover hidden scrollbar then 1141 // Scrollbars should cancel delay fade in when mouse hover hidden scrollbar then
1047 // move far away. 1142 // move far away.
1048 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, 1143 TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
1049 MouseHoverThenOutShouldCancelFadeIn) { 1144 MouseHoverThenOutShouldCancelFadeIn) {
1050 base::TimeTicks time; 1145 base::TimeTicks time;
1051 time += base::TimeDelta::FromSeconds(1); 1146 time += base::TimeDelta::FromSeconds(1);
1052 1147
1053 // Move mouse hover the fade in scrollbar region of scrollbar. 1148 // Move mouse hover the fade in scrollbar region of scrollbar.
1054 scrollbar_controller_->DidMouseMoveNear( 1149 scrollbar_controller_->DidMouseMove(
1055 VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1); 1150 NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
1056 1151
1057 // An fade in animation should have been enqueued. 1152 // An fade in animation should have been enqueued.
1058 EXPECT_FALSE(client_.start_fade().is_null()); 1153 EXPECT_FALSE(client_.start_fade().is_null());
1059 EXPECT_FALSE(client_.start_fade().IsCancelled()); 1154 EXPECT_FALSE(client_.start_fade().IsCancelled());
1060 EXPECT_EQ(kFadeDelay, client_.delay()); 1155 EXPECT_EQ(kFadeDelay, client_.delay());
1061 1156
1062 // Move mouse far away,delay fade in should be canceled. 1157 // Move mouse far away,delay fade in should be canceled.
1063 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1158 scrollbar_controller_->DidMouseMove(
1064 kMouseMoveDistanceToTriggerFadeIn); 1159 NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn, 0));
1160
1065 EXPECT_TRUE(client_.start_fade().is_null() || 1161 EXPECT_TRUE(client_.start_fade().is_null() ||
1066 client_.start_fade().IsCancelled()); 1162 client_.start_fade().IsCancelled());
1067 } 1163 }
1068 1164
1069 // Scrollbars should cancel delay fade in when mouse hover hidden scrollbar then 1165 // Scrollbars should cancel delay fade in when mouse hover hidden scrollbar then
1070 // move out of window. 1166 // move out of window.
1071 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, 1167 TEST_F(ScrollbarAnimationControllerAuraOverlayTest,
1072 MouseHoverThenLeaveShouldCancelShowThenEnterShouldFadeIn) { 1168 MouseHoverThenLeaveShouldCancelShowThenEnterShouldFadeIn) {
1073 base::TimeTicks time; 1169 base::TimeTicks time;
1074 time += base::TimeDelta::FromSeconds(1); 1170 time += base::TimeDelta::FromSeconds(1);
1075 1171
1076 // Move mouse hover the fade in scrollbar region of scrollbar. 1172 // Move mouse hover the fade in scrollbar region of scrollbar.
1077 scrollbar_controller_->DidMouseMoveNear( 1173 scrollbar_controller_->DidMouseMove(
1078 VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1); 1174 NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
1079 1175
1080 // An fade in animation should have been enqueued. 1176 // An fade in animation should have been enqueued.
1081 EXPECT_FALSE(client_.start_fade().is_null()); 1177 EXPECT_FALSE(client_.start_fade().is_null());
1082 EXPECT_FALSE(client_.start_fade().IsCancelled()); 1178 EXPECT_FALSE(client_.start_fade().IsCancelled());
1083 EXPECT_EQ(kFadeDelay, client_.delay()); 1179 EXPECT_EQ(kFadeDelay, client_.delay());
1084 1180
1085 // Move mouse out of window,delay fade in should be canceled. 1181 // Move mouse out of window,delay fade in should be canceled.
1086 scrollbar_controller_->DidMouseLeave(); 1182 scrollbar_controller_->DidMouseLeave();
1087 EXPECT_TRUE(client_.start_fade().is_null() || 1183 EXPECT_TRUE(client_.start_fade().is_null() ||
1088 client_.start_fade().IsCancelled()); 1184 client_.start_fade().IsCancelled());
1089 1185
1090 // Move mouse hover the fade in scrollbar region of scrollbar. 1186 // Move mouse hover the fade in scrollbar region of scrollbar.
1091 scrollbar_controller_->DidMouseMoveNear( 1187 scrollbar_controller_->DidMouseMove(
1092 VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1); 1188 NearVerticalScrollbarBegin(-kMouseMoveDistanceToTriggerFadeIn + 1, 0));
1093 1189
1094 // An fade in animation should have been enqueued. 1190 // An fade in animation should have been enqueued.
1095 EXPECT_FALSE(client_.start_fade().is_null()); 1191 EXPECT_FALSE(client_.start_fade().is_null());
1096 EXPECT_FALSE(client_.start_fade().IsCancelled()); 1192 EXPECT_FALSE(client_.start_fade().IsCancelled());
1097 EXPECT_EQ(kFadeDelay, client_.delay()); 1193 EXPECT_EQ(kFadeDelay, client_.delay());
1098 1194
1099 // Play the delay animation. 1195 // Play the delay animation.
1100 client_.start_fade().Run(); 1196 client_.start_fade().Run();
1101 EXPECT_TRUE(client_.start_fade().IsCancelled()); 1197 EXPECT_TRUE(client_.start_fade().IsCancelled());
1102 1198
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); 1671 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
1576 1672
1577 time += base::TimeDelta::FromSeconds(1); 1673 time += base::TimeDelta::FromSeconds(1);
1578 scrollbar_controller_->DidScrollEnd(); 1674 scrollbar_controller_->DidScrollEnd();
1579 EXPECT_FALSE(did_request_animate_); 1675 EXPECT_FALSE(did_request_animate_);
1580 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); 1676 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
1581 } 1677 }
1582 1678
1583 } // namespace 1679 } // namespace
1584 } // namespace cc 1680 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/scrollbar_animation_controller.cc ('k') | cc/input/single_scrollbar_animation_controller_thinning.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698