Index: ui/gfx/android/scroller_unittest.cc |
diff --git a/ui/gfx/android/scroller_unittest.cc b/ui/gfx/android/scroller_unittest.cc |
index af3c67a1b027ab9d22e5cb179ecfdc13608a015d..9b1018d6ab9c38bd6d7d93000b464c749a7226b7 100644 |
--- a/ui/gfx/android/scroller_unittest.cc |
+++ b/ui/gfx/android/scroller_unittest.cc |
@@ -63,6 +63,18 @@ |
EXPECT_GT(0.f, scroller.GetCurrVelocityY() * kDefaultDeltaY); |
EXPECT_TRUE(scroller.IsScrollingInDirection(kDefaultDeltaX, kDefaultDeltaY)); |
+ // Repeated offset computations at the same timestamp should yield identical |
+ // results. |
+ float curr_x = scroller.GetCurrX(); |
+ float curr_y = scroller.GetCurrY(); |
+ float curr_velocity_x = scroller.GetCurrVelocityX(); |
+ float curr_velocity_y = scroller.GetCurrVelocityY(); |
+ scroller.ComputeScrollOffset(start_time + scroll_duration / 2); |
+ EXPECT_EQ(curr_x, scroller.GetCurrX()); |
+ EXPECT_EQ(curr_y, scroller.GetCurrY()); |
+ EXPECT_EQ(curr_velocity_x, scroller.GetCurrVelocityX()); |
+ EXPECT_EQ(curr_velocity_y, scroller.GetCurrVelocityY()); |
+ |
// Advance to the end. |
scroller.ComputeScrollOffset(start_time + scroll_duration); |
EXPECT_EQ(scroller.GetFinalX(), scroller.GetCurrX()); |
@@ -123,6 +135,18 @@ |
EXPECT_TRUE( |
scroller.IsScrollingInDirection(kDefaultVelocityX, kDefaultVelocityY)); |
+ // Repeated offset computations at the same timestamp should yield identical |
+ // results. |
+ float curr_x = scroller.GetCurrX(); |
+ float curr_y = scroller.GetCurrY(); |
+ float curr_velocity_x = scroller.GetCurrVelocityX(); |
+ float curr_velocity_y = scroller.GetCurrVelocityY(); |
+ scroller.ComputeScrollOffset(start_time + scroll_duration / 2); |
+ EXPECT_EQ(curr_x, scroller.GetCurrX()); |
+ EXPECT_EQ(curr_y, scroller.GetCurrY()); |
+ EXPECT_EQ(curr_velocity_x, scroller.GetCurrVelocityX()); |
+ EXPECT_EQ(curr_velocity_y, scroller.GetCurrVelocityY()); |
+ |
// Advance to the end. |
scroller.ComputeScrollOffset(start_time + scroll_duration); |
EXPECT_EQ(scroller.GetFinalX(), scroller.GetCurrX()); |