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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2863103002: Reduce composited smooth scroll latency by a frame (also fixes latency UMAs). (Closed)
Patch Set: Cleanup. Created 3 years, 7 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_host_unittest_animation.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 42c83bfdd267f8cdc77f8da36734c6a91c1b7be3..107a6405055f6ea5eb90e7bc1551286eb1117f6c 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -5641,7 +5641,8 @@ TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimatedLatchToChild) {
host_impl_->Animate();
host_impl_->UpdateAnimationState(true);
- EXPECT_EQ(gfx::ScrollOffset(0, 30), grand_child_layer->CurrentScrollOffset());
+ // Should have started scrolling.
+ EXPECT_NE(gfx::ScrollOffset(0, 30), grand_child_layer->CurrentScrollOffset());
host_impl_->DidFinishImplFrame();
begin_frame_args.frame_time =
@@ -10759,7 +10760,7 @@ TEST_F(LayerTreeHostImplTest, ScrollAnimated) {
host_impl_->Animate();
host_impl_->UpdateAnimationState(true);
- EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
+ EXPECT_NE(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
host_impl_->DidFinishImplFrame();
begin_frame_args.frame_time =
@@ -10900,13 +10901,15 @@ TEST_F(LayerTreeHostImplTest, ScrollAnimatedWithDelay) {
begin_frame_args.sequence_number++;
host_impl_->WillBeginImplFrame(begin_frame_args);
host_impl_->UpdateAnimationState(true);
- EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
+ EXPECT_NE(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
host_impl_->DidFinishImplFrame();
- // Second tick after 50ms, animation should be half way done since
- // the duration due to delay is 100ms.
- begin_frame_args.frame_time =
- start_time + base::TimeDelta::FromMilliseconds(50);
+ // Second tick after 50ms, animation should be half way done since the
+ // duration due to delay is 100ms. Subtract off the frame interval since we
+ // progress a full frame on the first tick.
+ base::TimeTicks half_way_time = start_time - begin_frame_args.interval +
+ base::TimeDelta::FromMilliseconds(50);
+ begin_frame_args.frame_time = half_way_time;
begin_frame_args.sequence_number++;
host_impl_->WillBeginImplFrame(begin_frame_args);
host_impl_->UpdateAnimationState(true);
@@ -10963,7 +10966,7 @@ TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimatedAborted) {
EXPECT_TRUE(GetImplAnimationHost()->HasAnyAnimationTargetingProperty(
scrolling_layer->element_id(), TargetProperty::SCROLL_OFFSET));
- EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
+ EXPECT_NE(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
host_impl_->DidFinishImplFrame();
begin_frame_args.frame_time =
@@ -11032,7 +11035,7 @@ TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimated) {
host_impl_->Animate();
host_impl_->UpdateAnimationState(true);
- EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
+ EXPECT_NE(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
host_impl_->DidFinishImplFrame();
begin_frame_args.frame_time =
@@ -11268,7 +11271,7 @@ TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimatedNotUserScrollable) {
host_impl_->Animate();
host_impl_->UpdateAnimationState(true);
- EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
+ EXPECT_NE(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
host_impl_->DidFinishImplFrame();
begin_frame_args.frame_time =
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698