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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2423143002: Scrollbar fade animation broken on Android regression resolved. (Closed)
Patch Set: review comments addressed. Created 4 years, 2 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 d8c5856b8a4ed8e2e6167654f15d74438f94184d..5b9bb9808da4e2b0a1e996689df0d4de20da4731 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -686,7 +686,6 @@ TEST_F(LayerTreeHostImplTest, ScrollRootCallsCommitAndRedraw) {
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, 10),
InputHandler::WHEEL));
host_impl_->ScrollEnd(EndState().get());
- host_impl_->ClearCurrentlyScrollingLayerForTesting();
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
InputHandler::WHEEL));
EXPECT_TRUE(did_request_redraw_);
@@ -710,7 +709,6 @@ TEST_F(LayerTreeHostImplTest, ScrollActiveOnlyAfterScrollMovement) {
host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
EXPECT_TRUE(host_impl_->IsActivelyScrolling());
host_impl_->ScrollEnd(EndState().get());
- host_impl_->ClearCurrentlyScrollingLayerForTesting();
EXPECT_FALSE(host_impl_->IsActivelyScrolling());
}
@@ -1037,7 +1035,6 @@ TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionBasic) {
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
gfx::Point(25, 25), InputHandler::TOUCHSCREEN));
host_impl_->ScrollEnd(EndState().get());
- host_impl_->ClearCurrentlyScrollingLayerForTesting();
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
gfx::Point(75, 75), InputHandler::TOUCHSCREEN));
@@ -1050,7 +1047,6 @@ TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionBasic) {
gfx::Point(75, 75), InputHandler::TOUCHSCREEN));
host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
host_impl_->ScrollEnd(EndState().get());
- host_impl_->ClearCurrentlyScrollingLayerForTesting();
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
gfx::Point(75, 75), InputHandler::TOUCHSCREEN));
}
@@ -1113,7 +1109,6 @@ TEST_F(LayerTreeHostImplTest, ScrollHandlerPresent) {
InputHandler::TOUCHSCREEN);
EXPECT_TRUE(host_impl_->scroll_affects_scroll_handler());
host_impl_->ScrollEnd(EndState().get());
- host_impl_->ClearCurrentlyScrollingLayerForTesting();
EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
}
@@ -2787,7 +2782,6 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
EXPECT_TRUE(animation_task_.Equals(base::Closure()));
host_impl_->ScrollEnd(EndState().get());
- host_impl_->ClearCurrentlyScrollingLayerForTesting();
EXPECT_FALSE(did_request_next_frame_);
EXPECT_FALSE(did_request_redraw_);
if (expecting_animations) {
@@ -2881,7 +2875,6 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
EXPECT_TRUE(animation_task_.Equals(base::Closure()));
host_impl_->ScrollEnd(EndState().get());
- host_impl_->ClearCurrentlyScrollingLayerForTesting();
EXPECT_FALSE(did_request_next_frame_);
EXPECT_FALSE(did_request_redraw_);
EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
@@ -9586,7 +9579,6 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, FlingScrollBubblesToInner) {
EXPECT_EQ(outer_scroll, host_impl_->CurrentlyScrollingLayer());
host_impl_->ScrollEnd(EndState().get());
- host_impl_->ClearCurrentlyScrollingLayerForTesting();
EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingLayer());
EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset());
@@ -9612,7 +9604,6 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, FlingScrollBubblesToInner) {
EXPECT_EQ(outer_scroll, host_impl_->CurrentlyScrollingLayer());
host_impl_->ScrollEnd(EndState().get());
- host_impl_->ClearCurrentlyScrollingLayerForTesting();
EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingLayer());
EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset());
@@ -9670,7 +9661,6 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
outer_expected += scroll_delta;
inner_expected += scroll_delta;
host_impl_->ScrollEnd(EndState().get());
- host_impl_->ClearCurrentlyScrollingLayerForTesting();
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
gfx::Point(), InputHandler::TOUCHSCREEN));
@@ -9743,7 +9733,6 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
.did_scroll);
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child_scroll);
host_impl_->ScrollEnd(EndState().get());
- host_impl_->ClearCurrentlyScrollingLayerForTesting();
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
gfx::Point(), InputHandler::TOUCHSCREEN));
}
@@ -10393,7 +10382,6 @@ TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimatedAborted) {
InputHandler::WHEEL));
std::unique_ptr<ScrollState> scroll_state_end = EndState();
host_impl_->ScrollEnd(scroll_state_end.get());
- host_impl_->ClearCurrentlyScrollingLayerForTesting();
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
InputHandler::WHEEL));
@@ -10906,6 +10894,45 @@ TEST_F(LayerTreeHostImplTest, WheelScrollWithPageScaleFactorOnInnerLayer) {
}
}
+TEST_F(LayerTreeHostImplTest, ScrollbarAnimationEndsAfterScrollEnd) {
+ LayerTreeSettings settings = DefaultSettings();
+ settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(500);
+ settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300);
+ settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE;
+ CreateHostImpl(settings, CreateCompositorFrameSink());
+ SetupScrollAndContentsLayers(gfx::Size(100, 100));
+ host_impl_->SetViewportSize(gfx::Size(50, 50));
+
+ std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
+ SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400,
+ VERTICAL, 10, 0, false, true);
+ LayerImpl* scroll = host_impl_->active_tree()->OuterViewportScrollLayer();
+ LayerImpl* root = host_impl_->active_tree()->InnerViewportContainerLayer();
+ scrollbar->SetScrollLayerId(scroll->id());
+ root->test_properties()->AddChild(std::move(scrollbar));
+ host_impl_->active_tree()->BuildPropertyTreesForTesting();
+ host_impl_->active_tree()->DidBecomeActive();
+ ScrollbarAnimationController* scrollbar_animation_controller =
+ host_impl_->ScrollbarAnimationControllerForId(scroll->id());
+
+ EXPECT_TRUE(scrollbar_animation_controller);
+ EXPECT_FALSE(host_impl_->CurrentlyScrollingLayer());
+ EXPECT_FALSE(scrollbar_animation_controller->currently_scrolling());
+ gfx::Vector2dF scroll_delta(0, 5);
+
+ EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
+ host_impl_
+ ->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::TOUCHSCREEN)
+ .thread);
+ EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll->CurrentScrollOffset());
+
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ EXPECT_TRUE(scrollbar_animation_controller->currently_scrolling());
+ host_impl_->ScrollEnd(EndState().get());
+ EXPECT_FALSE(scrollbar_animation_controller->currently_scrolling());
+}
+
class LayerTreeHostImplCountingLostSurfaces : public LayerTreeHostImplTest {
public:
LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {}

Powered by Google App Engine
This is Rietveld 408576698