OLD | NEW |
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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/events/event_utils.h" | 8 #include "ui/events/event_utils.h" |
9 #include "ui/events/gestures/gesture_provider_aura.h" | 9 #include "ui/events/gestures/gesture_provider_aura.h" |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 time += base::TimeDelta::FromMilliseconds(10); | 55 time += base::TimeDelta::FromMilliseconds(10); |
56 TouchEvent release2(ET_TOUCH_RELEASED, gfx::PointF(30, 45), 0, time); | 56 TouchEvent release2(ET_TOUCH_RELEASED, gfx::PointF(30, 45), 0, time); |
57 EXPECT_FALSE(provider()->OnTouchEvent(release1)); | 57 EXPECT_FALSE(provider()->OnTouchEvent(release1)); |
58 | 58 |
59 time += base::TimeDelta::FromMilliseconds(10); | 59 time += base::TimeDelta::FromMilliseconds(10); |
60 TouchEvent move1(ET_TOUCH_MOVED, gfx::PointF(70, 75), 0, time); | 60 TouchEvent move1(ET_TOUCH_MOVED, gfx::PointF(70, 75), 0, time); |
61 EXPECT_FALSE(provider()->OnTouchEvent(move1)); | 61 EXPECT_FALSE(provider()->OnTouchEvent(move1)); |
62 } | 62 } |
63 | 63 |
64 TEST_F(GestureProviderAuraTest, IgnoresIdenticalMoveEvents) { | 64 TEST_F(GestureProviderAuraTest, IgnoresIdenticalMoveEvents) { |
65 const float kRadiusX = 20.f; | 65 const float kRadiusX = 20; |
66 const float kRadiusY = 30.f; | 66 const float kRadiusY = 30; |
67 const float kAngle = 0.321f; | 67 const float kAngle = 120; |
68 const float kForce = 40.f; | 68 const float kForce = 40; |
69 const int kTouchId0 = 5; | 69 const int kTouchId0 = 5; |
70 const int kTouchId1 = 3; | 70 const int kTouchId1 = 3; |
71 | 71 |
72 base::TimeDelta time = ui::EventTimeForNow(); | 72 base::TimeDelta time = ui::EventTimeForNow(); |
73 TouchEvent press0_1(ET_TOUCH_PRESSED, gfx::PointF(9, 10), kTouchId0, time); | 73 TouchEvent press0_1(ET_TOUCH_PRESSED, gfx::PointF(9, 10), kTouchId0, time); |
74 EXPECT_TRUE(provider()->OnTouchEvent(press0_1)); | 74 EXPECT_TRUE(provider()->OnTouchEvent(press0_1)); |
75 | 75 |
76 TouchEvent press1_1(ET_TOUCH_PRESSED, gfx::PointF(40, 40), kTouchId1, time); | 76 TouchEvent press1_1(ET_TOUCH_PRESSED, gfx::PointF(40, 40), kTouchId1, time); |
77 EXPECT_TRUE(provider()->OnTouchEvent(press1_1)); | 77 EXPECT_TRUE(provider()->OnTouchEvent(press1_1)); |
78 | 78 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 0, | 143 0, |
144 kTouchId0, | 144 kTouchId0, |
145 time, | 145 time, |
146 kRadiusX, | 146 kRadiusX, |
147 kRadiusY + 1, | 147 kRadiusY + 1, |
148 kAngle, | 148 kAngle, |
149 kForce); | 149 kForce); |
150 } | 150 } |
151 | 151 |
152 } // namespace ui | 152 } // namespace ui |
OLD | NEW |