Chromium Code Reviews| Index: cc/trees/layer_tree_host_impl_unittest.cc |
| diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc |
| index 9363993b1b235d12e33e6e6a4e73e4fe502fc9df..3510d0cbe500fb7483349979ede7847539f20c18 100644 |
| --- a/cc/trees/layer_tree_host_impl_unittest.cc |
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc |
| @@ -2737,6 +2737,8 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { |
| settings.scrollbar_animator = animator; |
| settings.scrollbar_fade_in_delay = base::TimeDelta::FromMilliseconds(20); |
| settings.scrollbar_fade_out_delay = base::TimeDelta::FromMilliseconds(20); |
| + settings.scrollbar_fade_out_resize_delay = |
| + base::TimeDelta::FromMilliseconds(20); |
| settings.scrollbar_fade_out_duration = |
| base::TimeDelta::FromMilliseconds(20); |
| @@ -2761,14 +2763,24 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { |
| EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
| } |
| - // If no scroll happened during a scroll gesture, it should have no effect. |
| + // If no scroll happened during a scroll gesture, it appears scrollbars and |
|
bokan
2017/02/27 23:34:17
I would leave this case as is and make sure no GSU
|
| + // schedules a fade out delay. |
| host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| InputHandler::WHEEL); |
| + host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 0)).get()); |
| host_impl_->ScrollEnd(EndState().get()); |
| EXPECT_FALSE(did_request_next_frame_); |
| EXPECT_FALSE(did_request_redraw_); |
| - EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
| - EXPECT_TRUE(animation_task_.Equals(base::Closure())); |
| + if (expecting_animations) { |
| + EXPECT_EQ(base::TimeDelta::FromMilliseconds(20), |
| + requested_animation_delay_); |
| + EXPECT_FALSE(animation_task_.Equals(base::Closure())); |
| + requested_animation_delay_ = base::TimeDelta(); |
| + animation_task_ = base::Closure(); |
| + } else { |
| + EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
| + EXPECT_TRUE(animation_task_.Equals(base::Closure())); |
| + } |
| // Before the scrollbar animation exists, we should not get redraws. |
| BeginFrameArgs begin_frame_args = |
| @@ -2890,8 +2902,17 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { |
| host_impl_->ScrollEnd(EndState().get()); |
| EXPECT_FALSE(did_request_next_frame_); |
| EXPECT_FALSE(did_request_redraw_); |
| - EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
| - EXPECT_TRUE(animation_task_.Equals(base::Closure())); |
| + |
| + if (expecting_animations) { |
| + EXPECT_EQ(base::TimeDelta::FromMilliseconds(20), |
|
bokan
2017/02/27 23:34:16
Is this because the layer is already scrolled to t
chaopeng
2017/02/28 01:51:12
Yes, https://cs.chromium.org/chromium/src/cc/trees
|
| + requested_animation_delay_); |
| + EXPECT_FALSE(animation_task_.Equals(base::Closure())); |
| + requested_animation_delay_ = base::TimeDelta(); |
| + animation_task_ = base::Closure(); |
| + } else { |
| + EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
| + EXPECT_TRUE(animation_task_.Equals(base::Closure())); |
| + } |
| // Changing page scale triggers scrollbar animation. |
| host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); |