| 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 fc7645d28b2921731081956b6d784c91ce420f46..6238adb2651d3e22f1a5f4ae42e49e6a639a2662 100644
|
| --- a/cc/trees/layer_tree_host_impl_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc
|
| @@ -85,6 +85,7 @@ class LayerTreeHostImplTest : public testing::Test,
|
| did_notify_ready_to_activate_(false),
|
| did_request_commit_(false),
|
| did_request_redraw_(false),
|
| + did_request_animate_(false),
|
| did_request_manage_tiles_(false),
|
| did_upload_visible_tile_(false),
|
| reduce_memory_result_(true),
|
| @@ -131,6 +132,9 @@ class LayerTreeHostImplTest : public testing::Test,
|
| const gfx::Rect& damage_rect) OVERRIDE {
|
| did_request_redraw_ = true;
|
| }
|
| + virtual void SetNeedsAnimateOnImplThread() OVERRIDE {
|
| + did_request_animate_ = true;
|
| + }
|
| virtual void SetNeedsManageTilesOnImplThread() OVERRIDE {
|
| did_request_manage_tiles_ = true;
|
| }
|
| @@ -396,6 +400,7 @@ class LayerTreeHostImplTest : public testing::Test,
|
| bool did_notify_ready_to_activate_;
|
| bool did_request_commit_;
|
| bool did_request_redraw_;
|
| + bool did_request_animate_;
|
| bool did_request_manage_tiles_;
|
| bool did_upload_visible_tile_;
|
| bool reduce_memory_result_;
|
| @@ -904,6 +909,7 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) {
|
| scroll_layer->FixedContainerSizeDelta());
|
| host_impl_->PinchGestureEnd();
|
| host_impl_->ScrollEnd();
|
| + EXPECT_FALSE(did_request_animate_);
|
| EXPECT_TRUE(did_request_redraw_);
|
| EXPECT_TRUE(did_request_commit_);
|
| EXPECT_EQ(gfx::Size(50, 50), container_layer->bounds());
|
| @@ -970,6 +976,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
|
| host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50));
|
| host_impl_->PinchGestureEnd();
|
| host_impl_->ScrollEnd();
|
| + EXPECT_FALSE(did_request_animate_);
|
| EXPECT_TRUE(did_request_redraw_);
|
| EXPECT_TRUE(did_request_commit_);
|
|
|
| @@ -1111,19 +1118,30 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimation) {
|
| max_page_scale);
|
| scroll_layer->SetScrollOffset(gfx::Vector2d(50, 50));
|
|
|
| + did_request_redraw_ = false;
|
| + did_request_animate_ = false;
|
| host_impl_->StartPageScaleAnimation(gfx::Vector2d(), false, 2.f, duration);
|
| + EXPECT_FALSE(did_request_redraw_);
|
| + EXPECT_TRUE(did_request_animate_);
|
| +
|
| did_request_redraw_ = false;
|
| + did_request_animate_ = false;
|
| host_impl_->Animate(start_time);
|
| EXPECT_TRUE(did_request_redraw_);
|
| + EXPECT_TRUE(did_request_animate_);
|
|
|
| did_request_redraw_ = false;
|
| + did_request_animate_ = false;
|
| host_impl_->Animate(halfway_through_animation);
|
| EXPECT_TRUE(did_request_redraw_);
|
| + EXPECT_TRUE(did_request_animate_);
|
|
|
| did_request_redraw_ = false;
|
| + did_request_animate_ = false;
|
| did_request_commit_ = false;
|
| host_impl_->Animate(end_time);
|
| EXPECT_TRUE(did_request_commit_);
|
| + EXPECT_FALSE(did_request_animate_);
|
|
|
| scoped_ptr<ScrollAndScaleSet> scroll_info =
|
| host_impl_->ProcessScrollDeltas();
|
| @@ -1138,16 +1156,25 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimation) {
|
| max_page_scale);
|
| scroll_layer->SetScrollOffset(gfx::Vector2d(50, 50));
|
|
|
| + did_request_redraw_ = false;
|
| + did_request_animate_ = false;
|
| host_impl_->StartPageScaleAnimation(
|
| gfx::Vector2d(25, 25), true, min_page_scale, duration);
|
| + EXPECT_FALSE(did_request_redraw_);
|
| + EXPECT_TRUE(did_request_animate_);
|
| +
|
| did_request_redraw_ = false;
|
| + did_request_animate_ = false;
|
| host_impl_->Animate(start_time);
|
| EXPECT_TRUE(did_request_redraw_);
|
| + EXPECT_TRUE(did_request_animate_);
|
|
|
| did_request_redraw_ = false;
|
| did_request_commit_ = false;
|
| + did_request_animate_ = false;
|
| host_impl_->Animate(end_time);
|
| EXPECT_TRUE(did_request_redraw_);
|
| + EXPECT_FALSE(did_request_animate_);
|
| EXPECT_TRUE(did_request_commit_);
|
|
|
| scoped_ptr<ScrollAndScaleSet> scroll_info =
|
| @@ -1301,10 +1328,12 @@ TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) {
|
| host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0));
|
| host_impl_->ScrollEnd();
|
| did_request_redraw_ = false;
|
| + did_request_animate_ = false;
|
| host_impl_->StartScrollbarAnimation();
|
| EXPECT_LT(base::TimeDelta::FromMilliseconds(19),
|
| requested_scrollbar_animation_delay_);
|
| EXPECT_FALSE(did_request_redraw_);
|
| + EXPECT_FALSE(did_request_animate_);
|
| requested_scrollbar_animation_delay_ = base::TimeDelta();
|
|
|
| // After the fade begins, we should start getting redraws instead of a
|
| @@ -1313,8 +1342,8 @@ TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) {
|
| host_impl_override_time->SetCurrentPhysicalTimeTicksForTest(fake_now);
|
| host_impl_->StartScrollbarAnimation();
|
| EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_);
|
| - EXPECT_TRUE(did_request_redraw_);
|
| - did_request_redraw_ = false;
|
| + EXPECT_TRUE(did_request_animate_);
|
| + did_request_animate_ = false;
|
|
|
| // If no scroll happened recently, StartScrollbarAnimation should have no
|
| // effect.
|
| @@ -1331,6 +1360,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) {
|
| EXPECT_LT(base::TimeDelta::FromMilliseconds(19),
|
| requested_scrollbar_animation_delay_);
|
| EXPECT_FALSE(did_request_redraw_);
|
| + EXPECT_FALSE(did_request_animate_);
|
| requested_scrollbar_animation_delay_ = base::TimeDelta();
|
|
|
| // None of the above should have called CurrentFrameTimeTicks, so if we call
|
| @@ -1358,7 +1388,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) {
|
| // effect.
|
| host_impl_->StartScrollbarAnimation();
|
| EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_);
|
| - EXPECT_FALSE(did_request_redraw_);
|
| + EXPECT_FALSE(did_request_animate_);
|
|
|
| // If no scroll happened during a scroll gesture, StartScrollbarAnimation
|
| // should have no effect.
|
| @@ -1366,7 +1396,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) {
|
| host_impl_->ScrollEnd();
|
| host_impl_->StartScrollbarAnimation();
|
| EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_);
|
| - EXPECT_FALSE(did_request_redraw_);
|
| + EXPECT_FALSE(did_request_animate_);
|
|
|
| // After a scroll, no fade animation should be scheduled.
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel);
|
| @@ -1375,7 +1405,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) {
|
| did_request_redraw_ = false;
|
| host_impl_->StartScrollbarAnimation();
|
| EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_);
|
| - EXPECT_FALSE(did_request_redraw_);
|
| + EXPECT_FALSE(did_request_animate_);
|
| requested_scrollbar_animation_delay_ = base::TimeDelta();
|
|
|
| // We should not see any draw requests.
|
| @@ -1383,7 +1413,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) {
|
| host_impl_override_time->SetCurrentPhysicalTimeTicksForTest(fake_now);
|
| host_impl_->StartScrollbarAnimation();
|
| EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_);
|
| - EXPECT_FALSE(did_request_redraw_);
|
| + EXPECT_FALSE(did_request_animate_);
|
|
|
| // Make page scale > min so that subsequent scrolls will trigger fades.
|
| host_impl_->active_tree()->SetPageScaleDelta(1.1f);
|
| @@ -1396,7 +1426,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) {
|
| host_impl_->StartScrollbarAnimation();
|
| EXPECT_LT(base::TimeDelta::FromMilliseconds(19),
|
| requested_scrollbar_animation_delay_);
|
| - EXPECT_FALSE(did_request_redraw_);
|
| + EXPECT_FALSE(did_request_animate_);
|
| requested_scrollbar_animation_delay_ = base::TimeDelta();
|
|
|
| // After the fade begins, we should start getting redraws instead of a
|
| @@ -1405,7 +1435,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) {
|
| host_impl_override_time->SetCurrentPhysicalTimeTicksForTest(fake_now);
|
| host_impl_->StartScrollbarAnimation();
|
| EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_);
|
| - EXPECT_TRUE(did_request_redraw_);
|
| + EXPECT_TRUE(did_request_animate_);
|
| }
|
|
|
| void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale(
|
| @@ -6211,6 +6241,14 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, NoIdleAnimations) {
|
| EXPECT_FALSE(did_request_redraw_);
|
| }
|
|
|
| +TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationScheduling) {
|
| + SetupScrollAndContentsLayers(gfx::Size(100, 100))
|
| + ->SetScrollOffset(gfx::Vector2d(0, 10));
|
| + host_impl_->DidChangeTopControlsPosition();
|
| + EXPECT_TRUE(did_request_animate_);
|
| + EXPECT_TRUE(did_request_redraw_);
|
| +}
|
| +
|
| TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
|
| LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200));
|
| host_impl_->SetViewportSize(gfx::Size(100, 100));
|
|
|