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

Unified Diff: content/child/touch_fling_gesture_curve_unittest.cc

Issue 634373003: Consolidate content fling implementations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win build Created 6 years, 2 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 | « content/child/touch_fling_gesture_curve.cc ('k') | content/child/web_gesture_curve_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/touch_fling_gesture_curve_unittest.cc
diff --git a/content/child/touch_fling_gesture_curve_unittest.cc b/content/child/touch_fling_gesture_curve_unittest.cc
deleted file mode 100644
index f8e5b5e59415d960cd3fa5d7350674bd685d751b..0000000000000000000000000000000000000000
--- a/content/child/touch_fling_gesture_curve_unittest.cc
+++ /dev/null
@@ -1,69 +0,0 @@
- // 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.
-
-// Tests for the TouchFlingGestureCurve.
-
-#include "content/child/touch_fling_gesture_curve.h"
-
-#include "base/memory/scoped_ptr.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/public/platform/WebFloatPoint.h"
-#include "third_party/WebKit/public/platform/WebFloatSize.h"
-#include "third_party/WebKit/public/platform/WebGestureCurve.h"
-#include "third_party/WebKit/public/platform/WebGestureCurveTarget.h"
-#include "third_party/WebKit/public/platform/WebSize.h"
-
-using blink::WebFloatPoint;
-using blink::WebFloatSize;
-using blink::WebGestureCurve;
-using blink::WebGestureCurveTarget;
-using blink::WebSize;
-
-namespace {
-
-class MockGestureCurveTarget : public WebGestureCurveTarget {
- public:
- virtual bool scrollBy(const WebFloatSize& delta,
- const WebFloatSize& velocity) override {
- cumulative_delta_.width += delta.width;
- cumulative_delta_.height += delta.height;
- current_velocity_ = velocity;
- return true;
- }
-
- WebFloatSize cumulative_delta() const { return cumulative_delta_; }
- void resetCumulativeDelta() { cumulative_delta_ = WebFloatSize(); }
-
- WebFloatSize current_velocity() const { return current_velocity_; }
-
- private:
- WebFloatSize cumulative_delta_;
- WebFloatSize current_velocity_;
-};
-
-} // namespace anonymous
-
-TEST(TouchFlingGestureCurve, flingCurveTouch)
-{
- double initialVelocity = 5000;
- MockGestureCurveTarget target;
-
- scoped_ptr<WebGestureCurve> curve(content::TouchFlingGestureCurve::Create(
- WebFloatPoint(initialVelocity, 0), WebSize()));
-
- // Note: the expectations below are dependent on the curve parameters hard
- // coded into the create call above.
- EXPECT_TRUE(curve->apply(0, &target));
- EXPECT_TRUE(curve->apply(0.25, &target));
- EXPECT_NEAR(target.current_velocity().width, 1878, 1);
- EXPECT_EQ(target.current_velocity().height, 0);
- EXPECT_TRUE(curve->apply(0.45f, &target)); // Use non-uniform tick spacing.
- EXPECT_TRUE(curve->apply(1, &target));
- EXPECT_FALSE(curve->apply(1.5, &target));
- EXPECT_NEAR(target.cumulative_delta().width, 1193, 1);
- EXPECT_EQ(target.cumulative_delta().height, 0);
- EXPECT_EQ(target.current_velocity().width, 0);
- EXPECT_EQ(target.current_velocity().height, 0);
-}
-
« no previous file with comments | « content/child/touch_fling_gesture_curve.cc ('k') | content/child/web_gesture_curve_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698