Chromium Code Reviews| Index: ui/events/gestures/fling_curve_unittest.cc |
| diff --git a/ui/events/gestures/fling_curve_unittest.cc b/ui/events/gestures/fling_curve_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a50488bde76e2a766d33f65eefed710fc0df9355 |
| --- /dev/null |
| +++ b/ui/events/gestures/fling_curve_unittest.cc |
| @@ -0,0 +1,28 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ui/events/gestures/fling_curve.h" |
| + |
| +#include "testing/gtest/include/gtest/gtest.h" |
| +#include "ui/gfx/frame_time.h" |
| + |
| +namespace ui { |
| + |
| +TEST(FlingCurveTest, Basic) { |
|
Jun Mukai
2014/08/06 05:31:39
Related to my comment on WindowOverviewMode, it mi
sadrul
2014/08/06 11:53:50
Done.
|
| + const gfx::Vector2dF velocity(0, 5000); |
| + base::TimeTicks now = gfx::FrameTime::Now(); |
| + FlingCurve curve(velocity, now); |
| + |
| + gfx::Vector2dF scroll = |
| + curve.GetScrollAmountAtTime(now + base::TimeDelta::FromMilliseconds(20)); |
| + EXPECT_EQ(0, scroll.x()); |
| + EXPECT_NEAR(scroll.y(), 96, 1); |
| + |
| + scroll = |
| + curve.GetScrollAmountAtTime(now + base::TimeDelta::FromMilliseconds(250)); |
| + EXPECT_EQ(0, scroll.x()); |
| + EXPECT_NEAR(scroll.y(), 705, 1); |
| +} |
| + |
| +} // namespace ui |