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

Side by Side Diff: ui/events/gesture_detection/velocity_tracker_unittest.cc

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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
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 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/events/gesture_detection/velocity_tracker_state.h" 10 #include "ui/events/gesture_detection/velocity_tracker_state.h"
(...skipping 25 matching lines...) Expand all
36 }; 36 };
37 NOTREACHED() << "Invalid strategy"; 37 NOTREACHED() << "Invalid strategy";
38 return ""; 38 return "";
39 } 39 }
40 40
41 } // namespace 41 } // namespace
42 42
43 class VelocityTrackerTest : public testing::Test { 43 class VelocityTrackerTest : public testing::Test {
44 public: 44 public:
45 VelocityTrackerTest() {} 45 VelocityTrackerTest() {}
46 virtual ~VelocityTrackerTest() {} 46 ~VelocityTrackerTest() override {}
47 47
48 protected: 48 protected:
49 static MockMotionEvent Sample(MotionEvent::Action action, 49 static MockMotionEvent Sample(MotionEvent::Action action,
50 gfx::PointF p0, 50 gfx::PointF p0,
51 TimeTicks t0, 51 TimeTicks t0,
52 gfx::Vector2dF v, 52 gfx::Vector2dF v,
53 TimeDelta dt) { 53 TimeDelta dt) {
54 const gfx::PointF p = p0 + ScaleVector2d(v, dt.InSecondsF()); 54 const gfx::PointF p = p0 + ScaleVector2d(v, dt.InSecondsF());
55 return MockMotionEvent(action, t0 + dt, p.x(), p.y()); 55 return MockMotionEvent(action, t0 + dt, p.x(), p.y());
56 } 56 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 state.AddMovement(Sample( 213 state.AddMovement(Sample(
214 MotionEvent::ACTION_UP, p1, t1, v, base::TimeDelta())); 214 MotionEvent::ACTION_UP, p1, t1, v, base::TimeDelta()));
215 215
216 // The tracked velocity should have been reset. 216 // The tracked velocity should have been reset.
217 state.ComputeCurrentVelocity(1000, 1000); 217 state.ComputeCurrentVelocity(1000, 1000);
218 EXPECT_EQ(0.f, state.GetXVelocity(0)); 218 EXPECT_EQ(0.f, state.GetXVelocity(0));
219 EXPECT_EQ(0.f, state.GetYVelocity(0)); 219 EXPECT_EQ(0.f, state.GetYVelocity(0));
220 } 220 }
221 221
222 } // namespace ui 222 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc ('k') | ui/events/gestures/gesture_provider_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698