| OLD | NEW |
| 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 = | 26 const float kDefaultMouseMoveDistanceToTriggerAnimation = |
| 27 SingleScrollbarAnimationControllerThinning:: | 27 SingleScrollbarAnimationControllerThinning:: |
| 28 kDefaultMouseMoveDistanceToTriggerAnimation; | 28 kDefaultMouseMoveDistanceToTriggerAnimation; |
| 29 const float kMouseMoveDistanceToTriggerShow = | 29 const float kMouseMoveDistanceToTriggerFadeIn = |
| 30 ScrollbarAnimationController::kMouseMoveDistanceToTriggerShow; | 30 ScrollbarAnimationController::kMouseMoveDistanceToTriggerFadeIn; |
| 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 22 matching lines...) Expand all Loading... |
| 63 ScrollbarAnimationControllerAuraOverlayTest() | 63 ScrollbarAnimationControllerAuraOverlayTest() |
| 64 : host_impl_(&task_runner_provider_, &task_graph_runner_), | 64 : host_impl_(&task_runner_provider_, &task_graph_runner_), |
| 65 client_(&host_impl_) {} | 65 client_(&host_impl_) {} |
| 66 | 66 |
| 67 void ExpectScrollbarsOpacity(float opacity) { | 67 void ExpectScrollbarsOpacity(float opacity) { |
| 68 EXPECT_FLOAT_EQ(opacity, v_scrollbar_layer_->Opacity()); | 68 EXPECT_FLOAT_EQ(opacity, v_scrollbar_layer_->Opacity()); |
| 69 EXPECT_FLOAT_EQ(opacity, h_scrollbar_layer_->Opacity()); | 69 EXPECT_FLOAT_EQ(opacity, h_scrollbar_layer_->Opacity()); |
| 70 } | 70 } |
| 71 | 71 |
| 72 protected: | 72 protected: |
| 73 const base::TimeDelta kShowDelay = base::TimeDelta::FromSeconds(4); | 73 const base::TimeDelta kFadeDelay = base::TimeDelta::FromSeconds(4); |
| 74 const base::TimeDelta kFadeOutDelay = base::TimeDelta::FromSeconds(2); | |
| 75 const base::TimeDelta kResizeFadeOutDelay = base::TimeDelta::FromSeconds(5); | 74 const base::TimeDelta kResizeFadeOutDelay = base::TimeDelta::FromSeconds(5); |
| 76 const base::TimeDelta kFadeOutDuration = base::TimeDelta::FromSeconds(3); | 75 const base::TimeDelta kFadeDuration = base::TimeDelta::FromSeconds(3); |
| 77 const base::TimeDelta kThinningDuration = base::TimeDelta::FromSeconds(2); | 76 const base::TimeDelta kThinningDuration = base::TimeDelta::FromSeconds(2); |
| 78 | 77 |
| 79 void SetUp() override { | 78 void SetUp() override { |
| 80 std::unique_ptr<LayerImpl> scroll_layer = | 79 std::unique_ptr<LayerImpl> scroll_layer = |
| 81 LayerImpl::Create(host_impl_.active_tree(), 1); | 80 LayerImpl::Create(host_impl_.active_tree(), 1); |
| 82 std::unique_ptr<LayerImpl> clip = | 81 std::unique_ptr<LayerImpl> clip = |
| 83 LayerImpl::Create(host_impl_.active_tree(), 2); | 82 LayerImpl::Create(host_impl_.active_tree(), 2); |
| 84 clip_layer_ = clip.get(); | 83 clip_layer_ = clip.get(); |
| 85 scroll_layer->SetScrollClipLayer(clip_layer_->id()); | 84 scroll_layer->SetScrollClipLayer(clip_layer_->id()); |
| 86 LayerImpl* scroll_layer_ptr = scroll_layer.get(); | 85 LayerImpl* scroll_layer_ptr = scroll_layer.get(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 108 v_scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); | 107 v_scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); |
| 109 h_scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); | 108 h_scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); |
| 110 v_scrollbar_layer_->test_properties()->opacity_can_animate = true; | 109 v_scrollbar_layer_->test_properties()->opacity_can_animate = true; |
| 111 h_scrollbar_layer_->test_properties()->opacity_can_animate = true; | 110 h_scrollbar_layer_->test_properties()->opacity_can_animate = true; |
| 112 clip_layer_->SetBounds(gfx::Size(100, 100)); | 111 clip_layer_->SetBounds(gfx::Size(100, 100)); |
| 113 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); | 112 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); |
| 114 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 113 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 115 | 114 |
| 116 scrollbar_controller_ = ScrollbarAnimationController:: | 115 scrollbar_controller_ = ScrollbarAnimationController:: |
| 117 CreateScrollbarAnimationControllerAuraOverlay( | 116 CreateScrollbarAnimationControllerAuraOverlay( |
| 118 scroll_layer_ptr->id(), &client_, kShowDelay, kFadeOutDelay, | 117 scroll_layer_ptr->id(), &client_, kFadeDelay, |
| 119 kResizeFadeOutDelay, kFadeOutDuration, kThinningDuration); | 118 kResizeFadeOutDelay, kFadeDuration, kThinningDuration); |
| 120 } | 119 } |
| 121 | 120 |
| 122 FakeImplTaskRunnerProvider task_runner_provider_; | 121 FakeImplTaskRunnerProvider task_runner_provider_; |
| 123 TestTaskGraphRunner task_graph_runner_; | 122 TestTaskGraphRunner task_graph_runner_; |
| 124 FakeLayerTreeHostImpl host_impl_; | 123 FakeLayerTreeHostImpl host_impl_; |
| 125 std::unique_ptr<ScrollbarAnimationController> scrollbar_controller_; | 124 std::unique_ptr<ScrollbarAnimationController> scrollbar_controller_; |
| 126 LayerImpl* clip_layer_; | 125 LayerImpl* clip_layer_; |
| 127 SolidColorScrollbarLayerImpl* v_scrollbar_layer_; | 126 SolidColorScrollbarLayerImpl* v_scrollbar_layer_; |
| 128 SolidColorScrollbarLayerImpl* h_scrollbar_layer_; | 127 SolidColorScrollbarLayerImpl* h_scrollbar_layer_; |
| 129 NiceMock<MockScrollbarAnimationControllerClient> client_; | 128 NiceMock<MockScrollbarAnimationControllerClient> client_; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 208 |
| 210 scrollbar_controller_->DidScrollUpdate(); | 209 scrollbar_controller_->DidScrollUpdate(); |
| 211 ExpectScrollbarsOpacity(1); | 210 ExpectScrollbarsOpacity(1); |
| 212 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); | 211 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); |
| 213 | 212 |
| 214 scrollbar_controller_->DidScrollEnd(); | 213 scrollbar_controller_->DidScrollEnd(); |
| 215 ExpectScrollbarsOpacity(1); | 214 ExpectScrollbarsOpacity(1); |
| 216 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); | 215 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); |
| 217 | 216 |
| 218 // An fade out animation should have been enqueued. | 217 // An fade out animation should have been enqueued. |
| 219 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 218 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 220 EXPECT_FALSE(client_.start_fade().is_null()); | 219 EXPECT_FALSE(client_.start_fade().is_null()); |
| 221 client_.start_fade().Run(); | 220 client_.start_fade().Run(); |
| 222 | 221 |
| 223 // Scrollbar should fade out over kFadeOutDuration. | 222 // Scrollbar should fade out over kFadeDuration. |
| 224 scrollbar_controller_->Animate(time); | 223 scrollbar_controller_->Animate(time); |
| 225 time += kFadeOutDuration; | 224 time += kFadeDuration; |
| 226 scrollbar_controller_->Animate(time); | 225 scrollbar_controller_->Animate(time); |
| 227 | 226 |
| 228 ExpectScrollbarsOpacity(0); | 227 ExpectScrollbarsOpacity(0); |
| 229 EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden()); | 228 EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden()); |
| 230 } | 229 } |
| 231 | 230 |
| 232 // Confirm the scrollbar appears by WillUpdateScroll and fade out. | 231 // Confirm the scrollbar appears by WillUpdateScroll and fade out. |
| 233 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, | 232 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, |
| 234 BasicAppearByWillUpdateScrollThenFadeOut) { | 233 BasicAppearByWillUpdateScrollThenFadeOut) { |
| 235 base::TimeTicks time; | 234 base::TimeTicks time; |
| 236 time += base::TimeDelta::FromSeconds(1); | 235 time += base::TimeDelta::FromSeconds(1); |
| 237 | 236 |
| 238 // Scrollbar should be invisible. | 237 // Scrollbar should be invisible. |
| 239 ExpectScrollbarsOpacity(0); | 238 ExpectScrollbarsOpacity(0); |
| 240 EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden()); | 239 EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden()); |
| 241 | 240 |
| 242 // Scrollbar should appear when scroll will update. | 241 // Scrollbar should appear when scroll will update. |
| 243 scrollbar_controller_->WillUpdateScroll(); | 242 scrollbar_controller_->WillUpdateScroll(); |
| 244 ExpectScrollbarsOpacity(1); | 243 ExpectScrollbarsOpacity(1); |
| 245 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); | 244 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); |
| 246 | 245 |
| 247 // An fade out animation should have been enqueued. | 246 // An fade out animation should have been enqueued. |
| 248 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 247 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 249 EXPECT_FALSE(client_.start_fade().is_null()); | 248 EXPECT_FALSE(client_.start_fade().is_null()); |
| 250 client_.start_fade().Run(); | 249 client_.start_fade().Run(); |
| 251 | 250 |
| 252 // Scrollbar should fade out over kFadeOutDuration. | 251 // Scrollbar should fade out over kFadeDuration. |
| 253 scrollbar_controller_->Animate(time); | 252 scrollbar_controller_->Animate(time); |
| 254 time += kFadeOutDuration; | 253 time += kFadeDuration; |
| 255 scrollbar_controller_->Animate(time); | 254 scrollbar_controller_->Animate(time); |
| 256 | 255 |
| 257 ExpectScrollbarsOpacity(0); | 256 ExpectScrollbarsOpacity(0); |
| 258 EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden()); | 257 EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden()); |
| 259 } | 258 } |
| 260 | 259 |
| 261 // Scroll content. Move the mouse near the scrollbar and confirm it becomes | 260 // Scroll content. Move the mouse near the scrollbar and confirm it becomes |
| 262 // thick. Ensure it remains visible as long as the mouse is near the scrollbar. | 261 // thick. Ensure it remains visible as long as the mouse is near the scrollbar. |
| 263 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveNearAndDontFadeOut) { | 262 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveNearAndDontFadeOut) { |
| 264 base::TimeTicks time; | 263 base::TimeTicks time; |
| 265 time += base::TimeDelta::FromSeconds(1); | 264 time += base::TimeDelta::FromSeconds(1); |
| 266 | 265 |
| 267 scrollbar_controller_->DidScrollBegin(); | 266 scrollbar_controller_->DidScrollBegin(); |
| 268 scrollbar_controller_->DidScrollUpdate(); | 267 scrollbar_controller_->DidScrollUpdate(); |
| 269 scrollbar_controller_->DidScrollEnd(); | 268 scrollbar_controller_->DidScrollEnd(); |
| 270 | 269 |
| 271 // An fade out animation should have been enqueued. | 270 // An fade out animation should have been enqueued. |
| 272 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 271 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 273 EXPECT_FALSE(client_.start_fade().is_null()); | 272 EXPECT_FALSE(client_.start_fade().is_null()); |
| 274 EXPECT_FALSE(client_.start_fade().IsCancelled()); | 273 EXPECT_FALSE(client_.start_fade().IsCancelled()); |
| 275 | 274 |
| 276 // Now move the mouse near the scrollbar. This should cancel the currently | 275 // Now move the mouse near the scrollbar. This should cancel the currently |
| 277 // queued fading animation and start animating thickness. | 276 // queued fading animation and start animating thickness. |
| 278 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); | 277 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); |
| 279 ExpectScrollbarsOpacity(1); | 278 ExpectScrollbarsOpacity(1); |
| 280 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 279 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 281 v_scrollbar_layer_->thumb_thickness_scale_factor()); | 280 v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 282 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 281 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 303 // thick. Ensure it remains visible as long as the mouse is over the scrollbar. | 302 // thick. Ensure it remains visible as long as the mouse is over the scrollbar. |
| 304 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveOverAndDontFadeOut) { | 303 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MoveOverAndDontFadeOut) { |
| 305 base::TimeTicks time; | 304 base::TimeTicks time; |
| 306 time += base::TimeDelta::FromSeconds(1); | 305 time += base::TimeDelta::FromSeconds(1); |
| 307 | 306 |
| 308 scrollbar_controller_->DidScrollBegin(); | 307 scrollbar_controller_->DidScrollBegin(); |
| 309 scrollbar_controller_->DidScrollUpdate(); | 308 scrollbar_controller_->DidScrollUpdate(); |
| 310 scrollbar_controller_->DidScrollEnd(); | 309 scrollbar_controller_->DidScrollEnd(); |
| 311 | 310 |
| 312 // An fade out animation should have been enqueued. | 311 // An fade out animation should have been enqueued. |
| 313 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 312 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 314 EXPECT_FALSE(client_.start_fade().is_null()); | 313 EXPECT_FALSE(client_.start_fade().is_null()); |
| 315 EXPECT_FALSE(client_.start_fade().IsCancelled()); | 314 EXPECT_FALSE(client_.start_fade().IsCancelled()); |
| 316 | 315 |
| 317 // Now move the mouse over the scrollbar. This should cancel the currently | 316 // Now move the mouse over the scrollbar. This should cancel the currently |
| 318 // queued fading animation and start animating thickness. | 317 // queued fading animation and start animating thickness. |
| 319 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); | 318 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); |
| 320 ExpectScrollbarsOpacity(1); | 319 ExpectScrollbarsOpacity(1); |
| 321 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 320 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 322 v_scrollbar_layer_->thumb_thickness_scale_factor()); | 321 v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 323 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 322 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 345 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, | 344 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, |
| 346 DontFadeWhileCapturedBeforeThick) { | 345 DontFadeWhileCapturedBeforeThick) { |
| 347 base::TimeTicks time; | 346 base::TimeTicks time; |
| 348 time += base::TimeDelta::FromSeconds(1); | 347 time += base::TimeDelta::FromSeconds(1); |
| 349 | 348 |
| 350 scrollbar_controller_->DidScrollBegin(); | 349 scrollbar_controller_->DidScrollBegin(); |
| 351 scrollbar_controller_->DidScrollUpdate(); | 350 scrollbar_controller_->DidScrollUpdate(); |
| 352 scrollbar_controller_->DidScrollEnd(); | 351 scrollbar_controller_->DidScrollEnd(); |
| 353 | 352 |
| 354 // An fade out animation should have been enqueued. | 353 // An fade out animation should have been enqueued. |
| 355 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 354 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 356 EXPECT_FALSE(client_.start_fade().is_null()); | 355 EXPECT_FALSE(client_.start_fade().is_null()); |
| 357 | 356 |
| 358 // Now move the mouse over the scrollbar and capture it. It should become | 357 // Now move the mouse over the scrollbar and capture it. It should become |
| 359 // thick without need for an animation. | 358 // thick without need for an animation. |
| 360 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); | 359 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); |
| 361 scrollbar_controller_->DidMouseDown(); | 360 scrollbar_controller_->DidMouseDown(); |
| 362 ExpectScrollbarsOpacity(1); | 361 ExpectScrollbarsOpacity(1); |
| 363 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); | 362 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 364 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 363 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 365 h_scrollbar_layer_->thumb_thickness_scale_factor()); | 364 h_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 366 | 365 |
| 367 // The fade out animation should have been cleared or cancelled. | 366 // The fade out animation should have been cleared or cancelled. |
| 368 EXPECT_TRUE(client_.start_fade().is_null() || | 367 EXPECT_TRUE(client_.start_fade().is_null() || |
| 369 client_.start_fade().IsCancelled()); | 368 client_.start_fade().IsCancelled()); |
| 370 } | 369 } |
| 371 | 370 |
| 372 // Make sure a scrollbar captured then move mouse away doesn't try to fade out. | 371 // Make sure a scrollbar captured then move mouse away doesn't try to fade out. |
| 373 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, | 372 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, |
| 374 DontFadeWhileCapturedThenAway) { | 373 DontFadeWhileCapturedThenAway) { |
| 375 base::TimeTicks time; | 374 base::TimeTicks time; |
| 376 time += base::TimeDelta::FromSeconds(1); | 375 time += base::TimeDelta::FromSeconds(1); |
| 377 | 376 |
| 378 scrollbar_controller_->DidScrollBegin(); | 377 scrollbar_controller_->DidScrollBegin(); |
| 379 scrollbar_controller_->DidScrollUpdate(); | 378 scrollbar_controller_->DidScrollUpdate(); |
| 380 scrollbar_controller_->DidScrollEnd(); | 379 scrollbar_controller_->DidScrollEnd(); |
| 381 | 380 |
| 382 // An fade out animation should have been enqueued. | 381 // An fade out animation should have been enqueued. |
| 383 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 382 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 384 EXPECT_FALSE(client_.start_fade().is_null()); | 383 EXPECT_FALSE(client_.start_fade().is_null()); |
| 385 | 384 |
| 386 // Now move the mouse over the scrollbar and capture it. It should become | 385 // Now move the mouse over the scrollbar and capture it. It should become |
| 387 // thick without need for an animation. | 386 // thick without need for an animation. |
| 388 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); | 387 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); |
| 389 scrollbar_controller_->DidMouseDown(); | 388 scrollbar_controller_->DidMouseDown(); |
| 390 ExpectScrollbarsOpacity(1); | 389 ExpectScrollbarsOpacity(1); |
| 391 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); | 390 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 392 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 391 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 393 h_scrollbar_layer_->thumb_thickness_scale_factor()); | 392 h_scrollbar_layer_->thumb_thickness_scale_factor()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 409 // fade out. | 408 // fade out. |
| 410 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeWhileCaptured) { | 409 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeWhileCaptured) { |
| 411 base::TimeTicks time; | 410 base::TimeTicks time; |
| 412 time += base::TimeDelta::FromSeconds(1); | 411 time += base::TimeDelta::FromSeconds(1); |
| 413 | 412 |
| 414 scrollbar_controller_->DidScrollBegin(); | 413 scrollbar_controller_->DidScrollBegin(); |
| 415 scrollbar_controller_->DidScrollUpdate(); | 414 scrollbar_controller_->DidScrollUpdate(); |
| 416 scrollbar_controller_->DidScrollEnd(); | 415 scrollbar_controller_->DidScrollEnd(); |
| 417 | 416 |
| 418 // An fade out animation should have been enqueued. | 417 // An fade out animation should have been enqueued. |
| 419 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 418 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 420 EXPECT_FALSE(client_.start_fade().is_null()); | 419 EXPECT_FALSE(client_.start_fade().is_null()); |
| 421 EXPECT_FALSE(client_.start_fade().IsCancelled()); | 420 EXPECT_FALSE(client_.start_fade().IsCancelled()); |
| 422 | 421 |
| 423 // Now move the mouse over the scrollbar and animate it until it's thick. | 422 // Now move the mouse over the scrollbar and animate it until it's thick. |
| 424 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); | 423 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); |
| 425 scrollbar_controller_->Animate(time); | 424 scrollbar_controller_->Animate(time); |
| 426 time += kThinningDuration; | 425 time += kThinningDuration; |
| 427 scrollbar_controller_->Animate(time); | 426 scrollbar_controller_->Animate(time); |
| 428 ExpectScrollbarsOpacity(1); | 427 ExpectScrollbarsOpacity(1); |
| 429 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); | 428 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 446 // the scrollbar to fade out. | 445 // the scrollbar to fade out. |
| 447 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, FadeAfterReleasedFar) { | 446 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, FadeAfterReleasedFar) { |
| 448 base::TimeTicks time; | 447 base::TimeTicks time; |
| 449 time += base::TimeDelta::FromSeconds(1); | 448 time += base::TimeDelta::FromSeconds(1); |
| 450 | 449 |
| 451 scrollbar_controller_->DidScrollBegin(); | 450 scrollbar_controller_->DidScrollBegin(); |
| 452 scrollbar_controller_->DidScrollUpdate(); | 451 scrollbar_controller_->DidScrollUpdate(); |
| 453 scrollbar_controller_->DidScrollEnd(); | 452 scrollbar_controller_->DidScrollEnd(); |
| 454 | 453 |
| 455 // An fade out animation should have been enqueued. | 454 // An fade out animation should have been enqueued. |
| 456 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 455 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 457 EXPECT_FALSE(client_.start_fade().is_null()); | 456 EXPECT_FALSE(client_.start_fade().is_null()); |
| 458 EXPECT_FALSE(client_.start_fade().IsCancelled()); | 457 EXPECT_FALSE(client_.start_fade().IsCancelled()); |
| 459 | 458 |
| 460 // Now move the mouse over the scrollbar and capture it. | 459 // Now move the mouse over the scrollbar and capture it. |
| 461 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); | 460 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); |
| 462 scrollbar_controller_->DidMouseDown(); | 461 scrollbar_controller_->DidMouseDown(); |
| 463 ExpectScrollbarsOpacity(1); | 462 ExpectScrollbarsOpacity(1); |
| 464 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); | 463 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 465 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 464 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 466 h_scrollbar_layer_->thumb_thickness_scale_factor()); | 465 h_scrollbar_layer_->thumb_thickness_scale_factor()); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 497 // doesn't cause the scrollbar to fade out. | 496 // doesn't cause the scrollbar to fade out. |
| 498 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeAfterReleasedNear) { | 497 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, DontFadeAfterReleasedNear) { |
| 499 base::TimeTicks time; | 498 base::TimeTicks time; |
| 500 time += base::TimeDelta::FromSeconds(1); | 499 time += base::TimeDelta::FromSeconds(1); |
| 501 | 500 |
| 502 scrollbar_controller_->DidScrollBegin(); | 501 scrollbar_controller_->DidScrollBegin(); |
| 503 scrollbar_controller_->DidScrollUpdate(); | 502 scrollbar_controller_->DidScrollUpdate(); |
| 504 scrollbar_controller_->DidScrollEnd(); | 503 scrollbar_controller_->DidScrollEnd(); |
| 505 | 504 |
| 506 // An fade out animation should have been enqueued. | 505 // An fade out animation should have been enqueued. |
| 507 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 506 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 508 EXPECT_FALSE(client_.start_fade().is_null()); | 507 EXPECT_FALSE(client_.start_fade().is_null()); |
| 509 EXPECT_FALSE(client_.start_fade().IsCancelled()); | 508 EXPECT_FALSE(client_.start_fade().IsCancelled()); |
| 510 | 509 |
| 511 // Now move the mouse over the scrollbar and capture it. | 510 // Now move the mouse over the scrollbar and capture it. |
| 512 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); | 511 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); |
| 513 scrollbar_controller_->DidMouseDown(); | 512 scrollbar_controller_->DidMouseDown(); |
| 514 ExpectScrollbarsOpacity(1); | 513 ExpectScrollbarsOpacity(1); |
| 515 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); | 514 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 516 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 515 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 517 h_scrollbar_layer_->thumb_thickness_scale_factor()); | 516 h_scrollbar_layer_->thumb_thickness_scale_factor()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 536 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, | 535 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, |
| 537 MoveNearScrollbarWhileFading) { | 536 MoveNearScrollbarWhileFading) { |
| 538 base::TimeTicks time; | 537 base::TimeTicks time; |
| 539 time += base::TimeDelta::FromSeconds(1); | 538 time += base::TimeDelta::FromSeconds(1); |
| 540 | 539 |
| 541 scrollbar_controller_->DidScrollBegin(); | 540 scrollbar_controller_->DidScrollBegin(); |
| 542 scrollbar_controller_->DidScrollUpdate(); | 541 scrollbar_controller_->DidScrollUpdate(); |
| 543 scrollbar_controller_->DidScrollEnd(); | 542 scrollbar_controller_->DidScrollEnd(); |
| 544 | 543 |
| 545 // A fade out animation should have been enqueued. Start it. | 544 // A fade out animation should have been enqueued. Start it. |
| 546 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 545 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 547 EXPECT_FALSE(client_.start_fade().is_null()); | 546 EXPECT_FALSE(client_.start_fade().is_null()); |
| 548 client_.start_fade().Run(); | 547 client_.start_fade().Run(); |
| 549 | 548 |
| 550 scrollbar_controller_->Animate(time); | 549 scrollbar_controller_->Animate(time); |
| 551 ExpectScrollbarsOpacity(1); | 550 ExpectScrollbarsOpacity(1); |
| 552 | 551 |
| 553 // Proceed half way through the fade out animation. | 552 // Proceed half way through the fade out animation. |
| 554 time += kFadeOutDuration / 2; | 553 time += kFadeDuration / 2; |
| 555 scrollbar_controller_->Animate(time); | 554 scrollbar_controller_->Animate(time); |
| 556 ExpectScrollbarsOpacity(.5f); | 555 ExpectScrollbarsOpacity(.5f); |
| 557 | 556 |
| 558 // Now move the mouse near the scrollbar. It should reset opacity to 1 | 557 // Now move the mouse near the scrollbar. It should reset opacity to 1 |
| 559 // instantly and start animating to thick. | 558 // instantly and start animating to thick. |
| 560 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); | 559 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); |
| 561 ExpectScrollbarsOpacity(1); | 560 ExpectScrollbarsOpacity(1); |
| 562 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 561 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 563 v_scrollbar_layer_->thumb_thickness_scale_factor()); | 562 v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 564 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 563 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 575 | 574 |
| 576 // Make sure we can't capture scrollbar that's completely faded out. | 575 // Make sure we can't capture scrollbar that's completely faded out. |
| 577 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, TestCantCaptureWhenFaded) { | 576 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, TestCantCaptureWhenFaded) { |
| 578 base::TimeTicks time; | 577 base::TimeTicks time; |
| 579 time += base::TimeDelta::FromSeconds(1); | 578 time += base::TimeDelta::FromSeconds(1); |
| 580 | 579 |
| 581 scrollbar_controller_->DidScrollBegin(); | 580 scrollbar_controller_->DidScrollBegin(); |
| 582 scrollbar_controller_->DidScrollUpdate(); | 581 scrollbar_controller_->DidScrollUpdate(); |
| 583 scrollbar_controller_->DidScrollEnd(); | 582 scrollbar_controller_->DidScrollEnd(); |
| 584 | 583 |
| 585 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 584 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 586 EXPECT_FALSE(client_.start_fade().is_null()); | 585 EXPECT_FALSE(client_.start_fade().is_null()); |
| 587 EXPECT_FALSE(client_.start_fade().IsCancelled()); | 586 EXPECT_FALSE(client_.start_fade().IsCancelled()); |
| 588 client_.start_fade().Run(); | 587 client_.start_fade().Run(); |
| 589 scrollbar_controller_->Animate(time); | 588 scrollbar_controller_->Animate(time); |
| 590 ExpectScrollbarsOpacity(1); | 589 ExpectScrollbarsOpacity(1); |
| 591 | 590 |
| 592 // Fade the scrollbar out completely. | 591 // Fade the scrollbar out completely. |
| 593 time += kFadeOutDuration; | 592 time += kFadeDuration; |
| 594 scrollbar_controller_->Animate(time); | 593 scrollbar_controller_->Animate(time); |
| 595 ExpectScrollbarsOpacity(0); | 594 ExpectScrollbarsOpacity(0); |
| 596 | 595 |
| 597 // Move mouse over the scrollbar. It shouldn't thicken the scrollbar since | 596 // Move mouse over the scrollbar. It shouldn't thicken the scrollbar since |
| 598 // it's completely faded out. | 597 // it's completely faded out. |
| 599 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); | 598 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 0); |
| 600 scrollbar_controller_->Animate(time); | 599 scrollbar_controller_->Animate(time); |
| 601 time += kThinningDuration; | 600 time += kThinningDuration; |
| 602 scrollbar_controller_->Animate(time); | 601 scrollbar_controller_->Animate(time); |
| 603 ExpectScrollbarsOpacity(0); | 602 ExpectScrollbarsOpacity(0); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 EXPECT_TRUE(client_.start_fade().is_null() || | 653 EXPECT_TRUE(client_.start_fade().is_null() || |
| 655 client_.start_fade().IsCancelled()); | 654 client_.start_fade().IsCancelled()); |
| 656 | 655 |
| 657 scrollbar_controller_->Animate(time); | 656 scrollbar_controller_->Animate(time); |
| 658 ExpectScrollbarsOpacity(1); | 657 ExpectScrollbarsOpacity(1); |
| 659 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); | 658 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 660 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 659 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 661 h_scrollbar_layer_->thumb_thickness_scale_factor()); | 660 h_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 662 | 661 |
| 663 // Scrollbar should still be thick and visible. | 662 // Scrollbar should still be thick and visible. |
| 664 time += kFadeOutDuration; | 663 time += kFadeDuration; |
| 665 scrollbar_controller_->Animate(time); | 664 scrollbar_controller_->Animate(time); |
| 666 ExpectScrollbarsOpacity(1); | 665 ExpectScrollbarsOpacity(1); |
| 667 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); | 666 EXPECT_FLOAT_EQ(1, v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 668 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 667 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 669 h_scrollbar_layer_->thumb_thickness_scale_factor()); | 668 h_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 670 } | 669 } |
| 671 | 670 |
| 672 // Tests that main thread scroll updates immediatley queue a fade out animation | 671 // Tests that main thread scroll updates immediatley queue a fade out animation |
| 673 // without requiring a ScrollEnd. | 672 // without requiring a ScrollEnd. |
| 674 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, | 673 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, |
| 675 MainThreadScrollQueuesFade) { | 674 MainThreadScrollQueuesFade) { |
| 676 ASSERT_TRUE(client_.start_fade().is_null()); | 675 ASSERT_TRUE(client_.start_fade().is_null()); |
| 677 | 676 |
| 678 // A ScrollUpdate without a ScrollBegin indicates a main thread scroll update | 677 // A ScrollUpdate without a ScrollBegin indicates a main thread scroll update |
| 679 // so we should schedule a fade out animation without waiting for a ScrollEnd | 678 // so we should schedule a fade out animation without waiting for a ScrollEnd |
| 680 // (which will never come). | 679 // (which will never come). |
| 681 scrollbar_controller_->DidScrollUpdate(); | 680 scrollbar_controller_->DidScrollUpdate(); |
| 682 EXPECT_FALSE(client_.start_fade().is_null()); | 681 EXPECT_FALSE(client_.start_fade().is_null()); |
| 683 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 682 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 684 | 683 |
| 685 client_.start_fade().Reset(); | 684 client_.start_fade().Reset(); |
| 686 | 685 |
| 687 // If we got a ScrollBegin, we shouldn't schedule the fade out animation until | 686 // If we got a ScrollBegin, we shouldn't schedule the fade out animation until |
| 688 // we get a corresponding ScrollEnd. | 687 // we get a corresponding ScrollEnd. |
| 689 scrollbar_controller_->DidScrollBegin(); | 688 scrollbar_controller_->DidScrollBegin(); |
| 690 scrollbar_controller_->DidScrollUpdate(); | 689 scrollbar_controller_->DidScrollUpdate(); |
| 691 EXPECT_TRUE(client_.start_fade().is_null()); | 690 EXPECT_TRUE(client_.start_fade().is_null()); |
| 692 scrollbar_controller_->DidScrollEnd(); | 691 scrollbar_controller_->DidScrollEnd(); |
| 693 EXPECT_FALSE(client_.start_fade().is_null()); | 692 EXPECT_FALSE(client_.start_fade().is_null()); |
| 694 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 693 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 695 } | 694 } |
| 696 | 695 |
| 697 // Make sure that if the scroll update is as a result of a resize, we use the | 696 // Make sure that if the scroll update is as a result of a resize, we use the |
| 698 // resize delay time instead of the default one. | 697 // resize delay time instead of the default one. |
| 699 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, ResizeFadeDuration) { | 698 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, ResizeFadeDuration) { |
| 700 ASSERT_TRUE(client_.delay().is_zero()); | 699 ASSERT_TRUE(client_.delay().is_zero()); |
| 701 | 700 |
| 702 scrollbar_controller_->DidResize(); | 701 scrollbar_controller_->DidResize(); |
| 703 EXPECT_FALSE(client_.start_fade().is_null()); | 702 EXPECT_FALSE(client_.start_fade().is_null()); |
| 704 EXPECT_EQ(kResizeFadeOutDelay, client_.delay()); | 703 EXPECT_EQ(kResizeFadeOutDelay, client_.delay()); |
| 705 | 704 |
| 706 client_.delay() = base::TimeDelta(); | 705 client_.delay() = base::TimeDelta(); |
| 707 | 706 |
| 708 // We should use the gesture delay rather than the resize delay if we're in a | 707 // We should use the gesture delay rather than the resize delay if we're in a |
| 709 // gesture scroll, even if it is resizing. | 708 // gesture scroll, even if it is resizing. |
| 710 scrollbar_controller_->DidScrollBegin(); | 709 scrollbar_controller_->DidScrollBegin(); |
| 711 scrollbar_controller_->DidResize(); | 710 scrollbar_controller_->DidResize(); |
| 712 scrollbar_controller_->DidScrollEnd(); | 711 scrollbar_controller_->DidScrollEnd(); |
| 713 | 712 |
| 714 EXPECT_FALSE(client_.start_fade().is_null()); | 713 EXPECT_FALSE(client_.start_fade().is_null()); |
| 715 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 714 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 716 } | 715 } |
| 717 | 716 |
| 718 // Tests that the fade effect is animated. | 717 // Tests that the fade effect is animated. |
| 719 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, FadeAnimated) { | 718 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, FadeAnimated) { |
| 720 base::TimeTicks time; | 719 base::TimeTicks time; |
| 721 time += base::TimeDelta::FromSeconds(1); | 720 time += base::TimeDelta::FromSeconds(1); |
| 722 | 721 |
| 723 // Scroll to make the scrollbars visible. | 722 // Scroll to make the scrollbars visible. |
| 724 scrollbar_controller_->DidScrollBegin(); | 723 scrollbar_controller_->DidScrollBegin(); |
| 725 scrollbar_controller_->DidScrollUpdate(); | 724 scrollbar_controller_->DidScrollUpdate(); |
| 726 scrollbar_controller_->DidScrollEnd(); | 725 scrollbar_controller_->DidScrollEnd(); |
| 727 | 726 |
| 728 // Appearance is instant. | 727 // Appearance is instant. |
| 729 ExpectScrollbarsOpacity(1); | 728 ExpectScrollbarsOpacity(1); |
| 730 | 729 |
| 731 // An fade out animation should have been enqueued. | 730 // An fade out animation should have been enqueued. |
| 732 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 731 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 733 EXPECT_FALSE(client_.start_fade().is_null()); | 732 EXPECT_FALSE(client_.start_fade().is_null()); |
| 734 client_.start_fade().Run(); | 733 client_.start_fade().Run(); |
| 735 | 734 |
| 736 // Test that at half the fade duration time, the opacity is at half. | 735 // Test that at half the fade duration time, the opacity is at half. |
| 737 scrollbar_controller_->Animate(time); | 736 scrollbar_controller_->Animate(time); |
| 738 ExpectScrollbarsOpacity(1); | 737 ExpectScrollbarsOpacity(1); |
| 739 | 738 |
| 740 time += kFadeOutDuration / 2; | 739 time += kFadeDuration / 2; |
| 741 scrollbar_controller_->Animate(time); | 740 scrollbar_controller_->Animate(time); |
| 742 ExpectScrollbarsOpacity(.5f); | 741 ExpectScrollbarsOpacity(.5f); |
| 743 | 742 |
| 744 time += kFadeOutDuration / 2; | 743 time += kFadeDuration / 2; |
| 745 scrollbar_controller_->Animate(time); | 744 scrollbar_controller_->Animate(time); |
| 746 ExpectScrollbarsOpacity(0); | 745 ExpectScrollbarsOpacity(0); |
| 747 } | 746 } |
| 748 | 747 |
| 749 // Tests that the controller tells the client when the scrollbars hide/show. | 748 // Tests that the controller tells the client when the scrollbars hide/show. |
| 750 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, NotifyChangedVisibility) { | 749 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, NotifyChangedVisibility) { |
| 751 base::TimeTicks time; | 750 base::TimeTicks time; |
| 752 time += base::TimeDelta::FromSeconds(1); | 751 time += base::TimeDelta::FromSeconds(1); |
| 753 | 752 |
| 754 EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(1); | 753 EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(1); |
| 755 // Scroll to make the scrollbars visible. | 754 // Scroll to make the scrollbars visible. |
| 756 scrollbar_controller_->DidScrollBegin(); | 755 scrollbar_controller_->DidScrollBegin(); |
| 757 scrollbar_controller_->DidScrollUpdate(); | 756 scrollbar_controller_->DidScrollUpdate(); |
| 758 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); | 757 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); |
| 759 Mock::VerifyAndClearExpectations(&client_); | 758 Mock::VerifyAndClearExpectations(&client_); |
| 760 | 759 |
| 761 scrollbar_controller_->DidScrollEnd(); | 760 scrollbar_controller_->DidScrollEnd(); |
| 762 | 761 |
| 763 // Play out the fade out animation. We shouldn't notify that the scrollbars | 762 // Play out the fade out animation. We shouldn't notify that the scrollbars |
| 764 // are hidden until the animation is completly over. We can (but don't have | 763 // are hidden until the animation is completly over. We can (but don't have |
| 765 // to) notify during the animation that the scrollbars are still visible. | 764 // to) notify during the animation that the scrollbars are still visible. |
| 766 EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(0); | 765 EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(0); |
| 767 ASSERT_FALSE(client_.start_fade().is_null()); | 766 ASSERT_FALSE(client_.start_fade().is_null()); |
| 768 client_.start_fade().Run(); | 767 client_.start_fade().Run(); |
| 769 scrollbar_controller_->Animate(time); | 768 scrollbar_controller_->Animate(time); |
| 770 time += kFadeOutDuration / 4; | 769 time += kFadeDuration / 4; |
| 771 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); | 770 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); |
| 772 scrollbar_controller_->Animate(time); | 771 scrollbar_controller_->Animate(time); |
| 773 time += kFadeOutDuration / 4; | 772 time += kFadeDuration / 4; |
| 774 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); | 773 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); |
| 775 scrollbar_controller_->Animate(time); | 774 scrollbar_controller_->Animate(time); |
| 776 time += kFadeOutDuration / 4; | 775 time += kFadeDuration / 4; |
| 777 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); | 776 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); |
| 778 scrollbar_controller_->Animate(time); | 777 scrollbar_controller_->Animate(time); |
| 779 ExpectScrollbarsOpacity(.25f); | 778 ExpectScrollbarsOpacity(.25f); |
| 780 Mock::VerifyAndClearExpectations(&client_); | 779 Mock::VerifyAndClearExpectations(&client_); |
| 781 | 780 |
| 782 EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(1); | 781 EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(1); |
| 783 time += kFadeOutDuration / 4; | 782 time += kFadeDuration / 4; |
| 784 scrollbar_controller_->Animate(time); | 783 scrollbar_controller_->Animate(time); |
| 785 EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden()); | 784 EXPECT_TRUE(scrollbar_controller_->ScrollbarsHidden()); |
| 786 ExpectScrollbarsOpacity(0); | 785 ExpectScrollbarsOpacity(0); |
| 787 Mock::VerifyAndClearExpectations(&client_); | 786 Mock::VerifyAndClearExpectations(&client_); |
| 788 | 787 |
| 789 // Calling DidScrollUpdate without a begin (i.e. update from commit) should | 788 // Calling DidScrollUpdate without a begin (i.e. update from commit) should |
| 790 // also notify. | 789 // also notify. |
| 791 EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(1); | 790 EXPECT_CALL(client_, DidChangeScrollbarVisibility()).Times(1); |
| 792 scrollbar_controller_->DidScrollUpdate(); | 791 scrollbar_controller_->DidScrollUpdate(); |
| 793 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); | 792 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 time += kThinningDuration; | 877 time += kThinningDuration; |
| 879 scrollbar_controller_->Animate(time); | 878 scrollbar_controller_->Animate(time); |
| 880 ExpectScrollbarsOpacity(1); | 879 ExpectScrollbarsOpacity(1); |
| 881 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 880 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 882 v_scrollbar_layer_->thumb_thickness_scale_factor()); | 881 v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 883 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 882 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 884 h_scrollbar_layer_->thumb_thickness_scale_factor()); | 883 h_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 885 | 884 |
| 886 // An fade out animation should have been enqueued. | 885 // An fade out animation should have been enqueued. |
| 887 EXPECT_FALSE(client_.start_fade().is_null()); | 886 EXPECT_FALSE(client_.start_fade().is_null()); |
| 888 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 887 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 889 } | 888 } |
| 890 | 889 |
| 891 // Move mouse near both scrollbars at the same time. | 890 // Move mouse near both scrollbars at the same time. |
| 892 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearBoth) { | 891 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseNearBoth) { |
| 893 base::TimeTicks time; | 892 base::TimeTicks time; |
| 894 time += base::TimeDelta::FromSeconds(1); | 893 time += base::TimeDelta::FromSeconds(1); |
| 895 | 894 |
| 896 // Scroll to make the scrollbars visible. | 895 // Scroll to make the scrollbars visible. |
| 897 scrollbar_controller_->DidScrollBegin(); | 896 scrollbar_controller_->DidScrollBegin(); |
| 898 scrollbar_controller_->DidScrollUpdate(); | 897 scrollbar_controller_->DidScrollUpdate(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 time += kThinningDuration; | 969 time += kThinningDuration; |
| 971 scrollbar_controller_->Animate(time); | 970 scrollbar_controller_->Animate(time); |
| 972 ExpectScrollbarsOpacity(1); | 971 ExpectScrollbarsOpacity(1); |
| 973 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 972 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 974 v_scrollbar_layer_->thumb_thickness_scale_factor()); | 973 v_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 975 EXPECT_FLOAT_EQ(kIdleThicknessScale, | 974 EXPECT_FLOAT_EQ(kIdleThicknessScale, |
| 976 h_scrollbar_layer_->thumb_thickness_scale_factor()); | 975 h_scrollbar_layer_->thumb_thickness_scale_factor()); |
| 977 | 976 |
| 978 // An fade out animation should have been enqueued. | 977 // An fade out animation should have been enqueued. |
| 979 EXPECT_FALSE(client_.start_fade().is_null()); | 978 EXPECT_FALSE(client_.start_fade().is_null()); |
| 980 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 979 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 981 } | 980 } |
| 982 | 981 |
| 983 // Ensure we have a delay fadeout animation after mouse leave without a mouse | 982 // Ensure we have a delay fadeout animation after mouse leave without a mouse |
| 984 // move. | 983 // move. |
| 985 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseLeaveFadeOut) { | 984 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, MouseLeaveFadeOut) { |
| 986 base::TimeTicks time; | 985 base::TimeTicks time; |
| 987 time += base::TimeDelta::FromSeconds(1); | 986 time += base::TimeDelta::FromSeconds(1); |
| 988 | 987 |
| 989 // Move mouse near scrollbar. | 988 // Move mouse near scrollbar. |
| 990 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); | 989 scrollbar_controller_->DidMouseMoveNear(VERTICAL, 1); |
| 991 | 990 |
| 992 // Scroll to make the scrollbars visible. | 991 // Scroll to make the scrollbars visible. |
| 993 scrollbar_controller_->DidScrollBegin(); | 992 scrollbar_controller_->DidScrollBegin(); |
| 994 scrollbar_controller_->DidScrollUpdate(); | 993 scrollbar_controller_->DidScrollUpdate(); |
| 995 scrollbar_controller_->DidScrollEnd(); | 994 scrollbar_controller_->DidScrollEnd(); |
| 996 | 995 |
| 997 // Should not have delay fadeout animation. | 996 // Should not have delay fadeout animation. |
| 998 EXPECT_TRUE(client_.start_fade().is_null() || | 997 EXPECT_TRUE(client_.start_fade().is_null() || |
| 999 client_.start_fade().IsCancelled()); | 998 client_.start_fade().IsCancelled()); |
| 1000 | 999 |
| 1001 // Mouse leave. | 1000 // Mouse leave. |
| 1002 scrollbar_controller_->DidMouseLeave(); | 1001 scrollbar_controller_->DidMouseLeave(); |
| 1003 | 1002 |
| 1004 // An fade out animation should have been enqueued. | 1003 // An fade out animation should have been enqueued. |
| 1005 EXPECT_FALSE(client_.start_fade().is_null()); | 1004 EXPECT_FALSE(client_.start_fade().is_null()); |
| 1006 EXPECT_EQ(kFadeOutDelay, client_.delay()); | 1005 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 1007 } | 1006 } |
| 1008 | 1007 |
| 1009 // Scrollbars should schedule a delay show when mouse hover the show scrollbar | 1008 // Scrollbars should schedule a delay fade in when mouse hover the show |
| 1010 // region of a hidden scrollbar. | 1009 // scrollbar region of a hidden scrollbar. |
| 1011 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, BasicMouseHoverShow) { | 1010 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, BasicMouseHoverFadeIn) { |
| 1012 base::TimeTicks time; | 1011 base::TimeTicks time; |
| 1013 time += base::TimeDelta::FromSeconds(1); | 1012 time += base::TimeDelta::FromSeconds(1); |
| 1014 | 1013 |
| 1015 // Move mouse hover the show scrollbar region of scrollbar. | 1014 // Move mouse hover the fade in scrollbar region of scrollbar. |
| 1016 scrollbar_controller_->DidMouseMoveNear(VERTICAL, | 1015 scrollbar_controller_->DidMouseMoveNear( |
| 1017 kMouseMoveDistanceToTriggerShow - 1); | 1016 VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1); |
| 1018 | 1017 |
| 1019 // An show animation should have been enqueued. | 1018 // An fade in animation should have been enqueued. |
| 1020 EXPECT_FALSE(client_.start_fade().is_null()); | 1019 EXPECT_FALSE(client_.start_fade().is_null()); |
| 1021 EXPECT_FALSE(client_.start_fade().IsCancelled()); | 1020 EXPECT_FALSE(client_.start_fade().IsCancelled()); |
| 1022 EXPECT_EQ(kShowDelay, client_.delay()); | 1021 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 1023 | 1022 |
| 1024 // Play the delay animation. | 1023 // Play the delay animation. |
| 1025 client_.start_fade().Run(); | 1024 client_.start_fade().Run(); |
| 1026 EXPECT_TRUE(client_.start_fade().IsCancelled()); | 1025 EXPECT_TRUE(client_.start_fade().IsCancelled()); |
| 1026 |
| 1027 scrollbar_controller_->Animate(time); |
| 1028 time += kFadeDuration / 2; |
| 1029 scrollbar_controller_->Animate(time); |
| 1030 |
| 1031 ExpectScrollbarsOpacity(0.5); |
| 1032 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); |
| 1033 |
| 1034 time += kFadeDuration / 2; |
| 1035 scrollbar_controller_->Animate(time); |
| 1036 |
| 1037 ExpectScrollbarsOpacity(1); |
| 1027 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); | 1038 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); |
| 1028 } | 1039 } |
| 1029 | 1040 |
| 1030 // Scrollbars should not schedule a new delay show when the mouse hovers inside | 1041 // Scrollbars should not schedule a new delay fade in when the mouse hovers |
| 1031 // a scrollbar already scheduled a delay show. | 1042 // inside a scrollbar already scheduled a delay fade in. |
| 1032 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, | 1043 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, |
| 1033 MouseHoverScrollbarAndMoveInside) { | 1044 MouseHoverScrollbarAndMoveInside) { |
| 1034 base::TimeTicks time; | 1045 base::TimeTicks time; |
| 1035 time += base::TimeDelta::FromSeconds(1); | 1046 time += base::TimeDelta::FromSeconds(1); |
| 1036 | 1047 |
| 1037 // Move mouse hover the show scrollbar region of scrollbar. | 1048 // Move mouse hover the fade in scrollbar region of scrollbar. |
| 1038 scrollbar_controller_->DidMouseMoveNear(VERTICAL, | 1049 scrollbar_controller_->DidMouseMoveNear( |
| 1039 kMouseMoveDistanceToTriggerShow - 1); | 1050 VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1); |
| 1040 | 1051 |
| 1041 // An show animation should have been enqueued. | 1052 // An fade in animation should have been enqueued. |
| 1042 EXPECT_FALSE(client_.start_fade().is_null()); | 1053 EXPECT_FALSE(client_.start_fade().is_null()); |
| 1043 EXPECT_FALSE(client_.start_fade().IsCancelled()); | 1054 EXPECT_FALSE(client_.start_fade().IsCancelled()); |
| 1044 EXPECT_EQ(kShowDelay, client_.delay()); | 1055 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 1045 | 1056 |
| 1046 base::Closure& fade = client_.start_fade(); | 1057 base::Closure& fade = client_.start_fade(); |
| 1047 // Move mouse still hover the show scrollbar region of scrollbar should not | 1058 // Move mouse still hover the fade in scrollbar region of scrollbar should not |
| 1048 // post a new show. | 1059 // post a new fade in. |
| 1049 scrollbar_controller_->DidMouseMoveNear(VERTICAL, | 1060 scrollbar_controller_->DidMouseMoveNear( |
| 1050 kMouseMoveDistanceToTriggerShow - 2); | 1061 VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 2); |
| 1051 | 1062 |
| 1052 EXPECT_TRUE(fade.Equals(client_.start_fade())); | 1063 EXPECT_TRUE(fade.Equals(client_.start_fade())); |
| 1053 } | 1064 } |
| 1054 | 1065 |
| 1055 // Scrollbars should cancel delay show when mouse hover hidden scrollbar then | 1066 // Scrollbars should cancel delay fade in when mouse hover hidden scrollbar then |
| 1056 // move far away. | 1067 // move far away. |
| 1057 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, | 1068 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, |
| 1058 MouseHoverThenOutShouldCancelShow) { | 1069 MouseHoverThenOutShouldCancelFadeIn) { |
| 1059 base::TimeTicks time; | 1070 base::TimeTicks time; |
| 1060 time += base::TimeDelta::FromSeconds(1); | 1071 time += base::TimeDelta::FromSeconds(1); |
| 1061 | 1072 |
| 1062 // Move mouse hover the show scrollbar region of scrollbar. | 1073 // Move mouse hover the fade in scrollbar region of scrollbar. |
| 1063 scrollbar_controller_->DidMouseMoveNear(VERTICAL, | 1074 scrollbar_controller_->DidMouseMoveNear( |
| 1064 kMouseMoveDistanceToTriggerShow - 1); | 1075 VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1); |
| 1065 | 1076 |
| 1066 // An show animation should have been enqueued. | 1077 // An fade in animation should have been enqueued. |
| 1067 EXPECT_FALSE(client_.start_fade().is_null()); | 1078 EXPECT_FALSE(client_.start_fade().is_null()); |
| 1068 EXPECT_FALSE(client_.start_fade().IsCancelled()); | 1079 EXPECT_FALSE(client_.start_fade().IsCancelled()); |
| 1069 EXPECT_EQ(kShowDelay, client_.delay()); | 1080 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 1070 | 1081 |
| 1071 // Move mouse far away,delay show should be canceled. | 1082 // Move mouse far away,delay fade in should be canceled. |
| 1072 scrollbar_controller_->DidMouseMoveNear(VERTICAL, | 1083 scrollbar_controller_->DidMouseMoveNear(VERTICAL, |
| 1073 kMouseMoveDistanceToTriggerShow); | 1084 kMouseMoveDistanceToTriggerFadeIn); |
| 1074 EXPECT_TRUE(client_.start_fade().is_null() || | 1085 EXPECT_TRUE(client_.start_fade().is_null() || |
| 1075 client_.start_fade().IsCancelled()); | 1086 client_.start_fade().IsCancelled()); |
| 1076 } | 1087 } |
| 1077 | 1088 |
| 1078 // Scrollbars should cancel delay show when mouse hover hidden scrollbar then | 1089 // Scrollbars should cancel delay fade in when mouse hover hidden scrollbar then |
| 1079 // move out of window. | 1090 // move out of window. |
| 1080 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, | 1091 TEST_F(ScrollbarAnimationControllerAuraOverlayTest, |
| 1081 MouseHoverThenLeaveShouldCancelShowThenEnterShouldShow) { | 1092 MouseHoverThenLeaveShouldCancelShowThenEnterShouldFadeIn) { |
| 1082 base::TimeTicks time; | 1093 base::TimeTicks time; |
| 1083 time += base::TimeDelta::FromSeconds(1); | 1094 time += base::TimeDelta::FromSeconds(1); |
| 1084 | 1095 |
| 1085 // Move mouse hover the show scrollbar region of scrollbar. | 1096 // Move mouse hover the fade in scrollbar region of scrollbar. |
| 1086 scrollbar_controller_->DidMouseMoveNear(VERTICAL, | 1097 scrollbar_controller_->DidMouseMoveNear( |
| 1087 kMouseMoveDistanceToTriggerShow - 1); | 1098 VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1); |
| 1088 | 1099 |
| 1089 // An show animation should have been enqueued. | 1100 // An fade in animation should have been enqueued. |
| 1090 EXPECT_FALSE(client_.start_fade().is_null()); | 1101 EXPECT_FALSE(client_.start_fade().is_null()); |
| 1091 EXPECT_FALSE(client_.start_fade().IsCancelled()); | 1102 EXPECT_FALSE(client_.start_fade().IsCancelled()); |
| 1092 EXPECT_EQ(kShowDelay, client_.delay()); | 1103 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 1093 | 1104 |
| 1094 // Move mouse out of window,delay show should be canceled. | 1105 // Move mouse out of window,delay fade in should be canceled. |
| 1095 scrollbar_controller_->DidMouseLeave(); | 1106 scrollbar_controller_->DidMouseLeave(); |
| 1096 EXPECT_TRUE(client_.start_fade().is_null() || | 1107 EXPECT_TRUE(client_.start_fade().is_null() || |
| 1097 client_.start_fade().IsCancelled()); | 1108 client_.start_fade().IsCancelled()); |
| 1098 | 1109 |
| 1099 // Move mouse hover the show scrollbar region of scrollbar. | 1110 // Move mouse hover the fade in scrollbar region of scrollbar. |
| 1100 scrollbar_controller_->DidMouseMoveNear(VERTICAL, | 1111 scrollbar_controller_->DidMouseMoveNear( |
| 1101 kMouseMoveDistanceToTriggerShow - 1); | 1112 VERTICAL, kMouseMoveDistanceToTriggerFadeIn - 1); |
| 1102 | 1113 |
| 1103 // An show animation should have been enqueued. | 1114 // An fade in animation should have been enqueued. |
| 1104 EXPECT_FALSE(client_.start_fade().is_null()); | 1115 EXPECT_FALSE(client_.start_fade().is_null()); |
| 1105 EXPECT_FALSE(client_.start_fade().IsCancelled()); | 1116 EXPECT_FALSE(client_.start_fade().IsCancelled()); |
| 1106 EXPECT_EQ(kShowDelay, client_.delay()); | 1117 EXPECT_EQ(kFadeDelay, client_.delay()); |
| 1107 | 1118 |
| 1108 // Play the delay animation. | 1119 // Play the delay animation. |
| 1109 client_.start_fade().Run(); | 1120 client_.start_fade().Run(); |
| 1110 EXPECT_TRUE(client_.start_fade().IsCancelled()); | 1121 EXPECT_TRUE(client_.start_fade().IsCancelled()); |
| 1122 |
| 1123 scrollbar_controller_->Animate(time); |
| 1124 time += kFadeDuration; |
| 1125 scrollbar_controller_->Animate(time); |
| 1126 |
| 1111 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); | 1127 EXPECT_FALSE(scrollbar_controller_->ScrollbarsHidden()); |
| 1112 } | 1128 } |
| 1113 | 1129 |
| 1114 class ScrollbarAnimationControllerAndroidTest | 1130 class ScrollbarAnimationControllerAndroidTest |
| 1115 : public testing::Test, | 1131 : public testing::Test, |
| 1116 public ScrollbarAnimationControllerClient { | 1132 public ScrollbarAnimationControllerClient { |
| 1117 public: | 1133 public: |
| 1118 ScrollbarAnimationControllerAndroidTest() | 1134 ScrollbarAnimationControllerAndroidTest() |
| 1119 : host_impl_(&task_runner_provider_, &task_graph_runner_), | 1135 : host_impl_(&task_runner_provider_, &task_graph_runner_), |
| 1120 did_request_redraw_(false), | 1136 did_request_redraw_(false), |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); | 1610 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); |
| 1595 | 1611 |
| 1596 time += base::TimeDelta::FromSeconds(1); | 1612 time += base::TimeDelta::FromSeconds(1); |
| 1597 scrollbar_controller_->DidScrollEnd(); | 1613 scrollbar_controller_->DidScrollEnd(); |
| 1598 EXPECT_FALSE(did_request_animate_); | 1614 EXPECT_FALSE(did_request_animate_); |
| 1599 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); | 1615 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); |
| 1600 } | 1616 } |
| 1601 | 1617 |
| 1602 } // namespace | 1618 } // namespace |
| 1603 } // namespace cc | 1619 } // namespace cc |
| OLD | NEW |