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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2611013002: Show Overlay Scrollbar when GestureScrollUpdate (Closed)
Patch Set: rebase & merge 2716453005 & fix tests Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698