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

Side by Side Diff: ui/events/gestures/blink/web_gesture_curve_impl_unittest.cc

Issue 1051593003: Refactors code for WebGestureCurve to ui/events/gestures/blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gn Created 5 years, 8 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 "content/child/web_gesture_curve_impl.h" 5 #include "ui/events/gestures/blink/web_gesture_curve_impl.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/WebKit/public/platform/WebFloatSize.h" 9 #include "third_party/WebKit/public/platform/WebFloatSize.h"
10 #include "third_party/WebKit/public/platform/WebGestureCurve.h" 10 #include "third_party/WebKit/public/platform/WebGestureCurve.h"
11 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" 11 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h"
12 #include "ui/events/gestures/fling_curve.h" 12 #include "ui/events/gestures/fling_curve.h"
13 13
14 using blink::WebFloatSize; 14 using blink::WebFloatSize;
15 using blink::WebGestureCurve; 15 using blink::WebGestureCurve;
16 using blink::WebGestureCurveTarget; 16 using blink::WebGestureCurveTarget;
17 17
18 namespace content { 18 namespace ui {
19 namespace { 19 namespace {
20 20
21 class MockGestureCurveTarget : public WebGestureCurveTarget { 21 class MockGestureCurveTarget : public WebGestureCurveTarget {
22 public: 22 public:
23 virtual bool scrollBy(const WebFloatSize& delta, 23 virtual bool scrollBy(const WebFloatSize& delta,
24 const WebFloatSize& velocity) override { 24 const WebFloatSize& velocity) override {
25 cumulative_delta_.width += delta.width; 25 cumulative_delta_.width += delta.width;
26 cumulative_delta_.height += delta.height; 26 cumulative_delta_.height += delta.height;
27 current_velocity_ = velocity; 27 current_velocity_ = velocity;
28 return true; 28 return true;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 EXPECT_EQ(current_velocity, gfx::Vector2dF(target.current_velocity())); 62 EXPECT_EQ(current_velocity, gfx::Vector2dF(target.current_velocity()));
63 63
64 EXPECT_TRUE(curve->apply(0.75, &target)); 64 EXPECT_TRUE(curve->apply(0.75, &target));
65 EXPECT_FALSE(curve->apply(1.5, &target)); 65 EXPECT_FALSE(curve->apply(1.5, &target));
66 EXPECT_NEAR(target.cumulative_delta().width, 1193, 1); 66 EXPECT_NEAR(target.cumulative_delta().width, 1193, 1);
67 EXPECT_EQ(target.cumulative_delta().height, 0); 67 EXPECT_EQ(target.cumulative_delta().height, 0);
68 EXPECT_EQ(target.current_velocity().width, 0); 68 EXPECT_EQ(target.current_velocity().width, 0);
69 EXPECT_EQ(target.current_velocity().height, 0); 69 EXPECT_EQ(target.current_velocity().height, 0);
70 } 70 }
71 71
72 } // namespace content 72 } // namespace ui
OLDNEW
« ui/events/events.gyp ('K') | « ui/events/gestures/blink/web_gesture_curve_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698