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 fb2fdb64001161970d4c9716820f2930444d9a88..f03ab6b2d72f9018afd40bb0a3412c3b60f792c0 100644 |
--- a/cc/trees/layer_tree_host_impl_unittest.cc |
+++ b/cc/trees/layer_tree_host_impl_unittest.cc |
@@ -92,6 +92,7 @@ class LayerTreeHostImplTest : public testing::Test, |
did_request_redraw_(false), |
did_request_animate_(false), |
did_request_prepare_tiles_(false), |
+ did_complete_page_scale_animation_(false), |
reduce_memory_result_(true), |
current_limit_bytes_(0), |
current_priority_cutoff_value_(0) { |
@@ -156,6 +157,9 @@ class LayerTreeHostImplTest : public testing::Test, |
} |
void DidActivateSyncTree() override {} |
void DidPrepareTiles() override {} |
+ void DidCompletePageScaleAnimationOnImplThread() override { |
+ did_complete_page_scale_animation_ = true; |
+ } |
void set_reduce_memory_result(bool reduce_memory_result) { |
reduce_memory_result_ = reduce_memory_result; |
@@ -399,6 +403,7 @@ class LayerTreeHostImplTest : public testing::Test, |
bool did_request_redraw_; |
bool did_request_animate_; |
bool did_request_prepare_tiles_; |
+ bool did_complete_page_scale_animation_; |
bool reduce_memory_result_; |
base::Closure scrollbar_fade_start_; |
base::TimeDelta requested_scrollbar_animation_delay_; |
@@ -1346,6 +1351,38 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationTransferedOnSyncTreeActivate) { |
ExpectContains(*scroll_info, scroll_layer->id(), gfx::Vector2d(-50, -50)); |
} |
+TEST_F(LayerTreeHostImplTest, PageScaleAnimationCompletedNotification) { |
+ SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
+ host_impl_->SetViewportSize(gfx::Size(50, 50)); |
+ DrawFrame(); |
+ |
+ LayerImpl* scroll_layer = host_impl_->InnerViewportScrollLayer(); |
+ DCHECK(scroll_layer); |
+ |
+ base::TimeTicks start_time = |
+ base::TimeTicks() + base::TimeDelta::FromSeconds(1); |
+ base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100); |
+ base::TimeTicks halfway_through_animation = start_time + duration / 2; |
+ base::TimeTicks end_time = start_time + duration; |
+ |
+ host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 4.f); |
+ scroll_layer->SetScrollOffset(gfx::ScrollOffset(50, 50)); |
+ |
+ did_complete_page_scale_animation_ = false; |
+ host_impl_->active_tree()->SetPendingPageScaleAnimation( |
+ scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation( |
+ gfx::Vector2d(), false, 2.f, duration))); |
+ host_impl_->ActivateSyncTree(); |
+ host_impl_->Animate(start_time); |
+ EXPECT_FALSE(did_complete_page_scale_animation_); |
+ |
+ host_impl_->Animate(halfway_through_animation); |
+ EXPECT_FALSE(did_complete_page_scale_animation_); |
+ |
+ host_impl_->Animate(end_time); |
+ EXPECT_TRUE(did_complete_page_scale_animation_); |
+} |
+ |
class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl { |
public: |
LayerTreeHostImplOverridePhysicalTime( |