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

Side by Side Diff: content/child/touch_fling_gesture_curve_unittest.cc

Issue 586933003: fling: Remove a bunch of code for configuring fling curves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « content/child/touch_fling_gesture_curve.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Tests for the TouchFlingGestureCurve. 5 // Tests for the TouchFlingGestureCurve.
6 6
7 #include "content/child/touch_fling_gesture_curve.h" 7 #include "content/child/touch_fling_gesture_curve.h"
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 }; 43 };
44 44
45 } // namespace anonymous 45 } // namespace anonymous
46 46
47 TEST(TouchFlingGestureCurve, flingCurveTouch) 47 TEST(TouchFlingGestureCurve, flingCurveTouch)
48 { 48 {
49 double initialVelocity = 5000; 49 double initialVelocity = 5000;
50 MockGestureCurveTarget target; 50 MockGestureCurveTarget target;
51 51
52 scoped_ptr<WebGestureCurve> curve(content::TouchFlingGestureCurve::Create( 52 scoped_ptr<WebGestureCurve> curve(content::TouchFlingGestureCurve::Create(
53 WebFloatPoint(initialVelocity, 0), 53 WebFloatPoint(initialVelocity, 0), WebSize()));
54 -5.70762e+03f, 1.72e+02f, 3.7e+00f, WebSize()));
55 54
56 // Note: the expectations below are dependent on the curve parameters hard 55 // Note: the expectations below are dependent on the curve parameters hard
57 // coded into the create call above. 56 // coded into the create call above.
58 EXPECT_TRUE(curve->apply(0, &target)); 57 EXPECT_TRUE(curve->apply(0, &target));
59 EXPECT_TRUE(curve->apply(0.25, &target)); 58 EXPECT_TRUE(curve->apply(0.25, &target));
60 EXPECT_NEAR(target.current_velocity().width, 1878, 1); 59 EXPECT_NEAR(target.current_velocity().width, 1878, 1);
61 EXPECT_EQ(target.current_velocity().height, 0); 60 EXPECT_EQ(target.current_velocity().height, 0);
62 EXPECT_TRUE(curve->apply(0.45f, &target)); // Use non-uniform tick spacing. 61 EXPECT_TRUE(curve->apply(0.45f, &target)); // Use non-uniform tick spacing.
63 EXPECT_TRUE(curve->apply(1, &target)); 62 EXPECT_TRUE(curve->apply(1, &target));
64 EXPECT_FALSE(curve->apply(1.5, &target)); 63 EXPECT_FALSE(curve->apply(1.5, &target));
65 EXPECT_NEAR(target.cumulative_delta().width, 1193, 1); 64 EXPECT_NEAR(target.cumulative_delta().width, 1193, 1);
66 EXPECT_EQ(target.cumulative_delta().height, 0); 65 EXPECT_EQ(target.cumulative_delta().height, 0);
67 EXPECT_EQ(target.current_velocity().width, 0); 66 EXPECT_EQ(target.current_velocity().width, 0);
68 EXPECT_EQ(target.current_velocity().height, 0); 67 EXPECT_EQ(target.current_velocity().height, 0);
69 } 68 }
70 69
OLDNEW
« no previous file with comments | « content/child/touch_fling_gesture_curve.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698