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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2770733002: Reland of Show Overlay Scrollbar when GestureScrollUpdate (Closed)
Patch Set: fix for gpu memory issue Created 3 years, 9 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c74072b7cccf191cede6a8e926836a8cdc89cac6..f6e8f731acf4888c55f8d3ce0eca91fa2592a801 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -2814,6 +2814,8 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
settings.scrollbar_animator = animator;
settings.scrollbar_show_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);
@@ -2847,6 +2849,25 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
EXPECT_TRUE(animation_task_.Equals(base::Closure()));
+ // For Aura Overlay Scrollbar, if no scroll happened during a scroll
+ // gesture, shows scrollbars and schedules a delay fade out.
+ 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_);
+ if (animator == LayerTreeSettings::AURA_OVERLAY) {
+ 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 =
CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 2, fake_now);
@@ -2954,7 +2975,9 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
host_impl_->DidFinishImplFrame();
}
- // Scrollbar animation is not triggered unnecessarily.
+ // For Andrdoid, scrollbar animation is not triggered unnecessarily.
+ // For Aura Overlay Scrollbar, scrollbar appears even if scroll offset did
+ // not change.
host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::WHEEL);
host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(5, 0)).get());
@@ -2967,8 +2990,16 @@ 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 (animator == LayerTreeSettings::AURA_OVERLAY) {
+ 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()));
+ }
// Changing page scale triggers scrollbar animation.
host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f);
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698