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

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

Issue 243403002: Add multi-finger swipe detection to GestureDetector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix M_PI Created 6 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 "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/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 static MockMotionEvent ObtainMotionEvent(base::TimeTicks event_time, 67 static MockMotionEvent ObtainMotionEvent(base::TimeTicks event_time,
68 MotionEvent::Action action, 68 MotionEvent::Action action,
69 float x0, 69 float x0,
70 float y0, 70 float y0,
71 float x1, 71 float x1,
72 float y1) { 72 float y1) {
73 return MockMotionEvent(action, event_time, x0, y0, x1, y1); 73 return MockMotionEvent(action, event_time, x0, y0, x1, y1);
74 } 74 }
75 75
76 static MockMotionEvent ObtainMotionEvent(
77 base::TimeTicks event_time,
78 MotionEvent::Action action,
79 const std::vector<gfx::PointF>& positions) {
80 switch (positions.size()) {
81 case 1:
82 return MockMotionEvent(
83 action, event_time, positions[0].x(), positions[0].y());
84 case 2:
85 return MockMotionEvent(action,
86 event_time,
87 positions[0].x(),
88 positions[0].y(),
89 positions[1].x(),
90 positions[1].y());
91 case 3:
92 return MockMotionEvent(action,
93 event_time,
94 positions[0].x(),
95 positions[0].y(),
96 positions[1].x(),
97 positions[1].y(),
98 positions[2].x(),
99 positions[2].y());
100 default:
101 CHECK(false) << "MockMotionEvent only supports 1-3 pointers";
102 return MockMotionEvent();
103 }
104 }
105
76 static MockMotionEvent ObtainMotionEvent(base::TimeTicks event_time, 106 static MockMotionEvent ObtainMotionEvent(base::TimeTicks event_time,
77 MotionEvent::Action action) { 107 MotionEvent::Action action) {
78 return ObtainMotionEvent(event_time, action, kFakeCoordX, kFakeCoordY); 108 return ObtainMotionEvent(event_time, action, kFakeCoordX, kFakeCoordY);
79 } 109 }
80 110
81 // Test 111 // Test
82 virtual void SetUp() OVERRIDE { 112 virtual void SetUp() OVERRIDE { SetUpWithConfig(GetDefaultConfig()); }
83 gesture_provider_.reset(new GestureProvider(GetDefaultConfig(), this));
84 gesture_provider_->SetMultiTouchZoomSupportEnabled(false);
85 }
86 113
87 virtual void TearDown() OVERRIDE { 114 virtual void TearDown() OVERRIDE {
88 gestures_.clear(); 115 gestures_.clear();
89 gesture_provider_.reset(); 116 gesture_provider_.reset();
90 } 117 }
91 118
92 // GestureProviderClient 119 // GestureProviderClient
93 virtual void OnGestureEvent(const GestureEventData& gesture) OVERRIDE { 120 virtual void OnGestureEvent(const GestureEventData& gesture) OVERRIDE {
94 if (gesture.type == ET_GESTURE_SCROLL_BEGIN) 121 if (gesture.type == ET_GESTURE_SCROLL_BEGIN)
95 active_scroll_begin_event_.reset(new GestureEventData(gesture)); 122 active_scroll_begin_event_.reset(new GestureEventData(gesture));
96 gestures_.push_back(gesture); 123 gestures_.push_back(gesture);
97 } 124 }
98 125
126 void SetUpWithConfig(const GestureProvider::Config& config) {
127 gesture_provider_.reset(new GestureProvider(config, this));
128 gesture_provider_->SetMultiTouchZoomSupportEnabled(false);
129 }
130
131 void ResetGestureDetection() {
132 CancelActiveTouchSequence();
133 gestures_.clear();
134 }
99 bool CancelActiveTouchSequence() { 135 bool CancelActiveTouchSequence() {
100 if (!gesture_provider_->current_down_event()) 136 if (!gesture_provider_->current_down_event())
101 return false; 137 return false;
102 return gesture_provider_->OnTouchEvent( 138 return gesture_provider_->OnTouchEvent(
103 *gesture_provider_->current_down_event()->Cancel()); 139 *gesture_provider_->current_down_event()->Cancel());
104 } 140 }
105 141
106 bool HasReceivedGesture(EventType type) const { 142 bool HasReceivedGesture(EventType type) const {
107 for (size_t i = 0; i < gestures_.size(); ++i) { 143 for (size_t i = 0; i < gestures_.size(); ++i) {
108 if (gestures_[i].type == type) 144 if (gestures_[i].type == type)
(...skipping 25 matching lines...) Expand all
134 170
135 const GestureProvider::Config& GetDefaultConfig() const { 171 const GestureProvider::Config& GetDefaultConfig() const {
136 static GestureProvider::Config sConfig = CreateDefaultConfig(); 172 static GestureProvider::Config sConfig = CreateDefaultConfig();
137 return sConfig; 173 return sConfig;
138 } 174 }
139 175
140 float GetTouchSlop() const { 176 float GetTouchSlop() const {
141 return GetDefaultConfig().gesture_detector_config.touch_slop; 177 return GetDefaultConfig().gesture_detector_config.touch_slop;
142 } 178 }
143 179
180 float GetMinSwipeVelocity() const {
181 return GetDefaultConfig().gesture_detector_config.minimum_swipe_velocity;
182 }
183
144 base::TimeDelta GetLongPressTimeout() const { 184 base::TimeDelta GetLongPressTimeout() const {
145 return GetDefaultConfig().gesture_detector_config.longpress_timeout; 185 return GetDefaultConfig().gesture_detector_config.longpress_timeout;
146 } 186 }
147 187
148 base::TimeDelta GetShowPressTimeout() const { 188 base::TimeDelta GetShowPressTimeout() const {
149 return GetDefaultConfig().gesture_detector_config.showpress_timeout; 189 return GetDefaultConfig().gesture_detector_config.showpress_timeout;
150 } 190 }
151 191
152 void SetBeginEndTypesEnabled(bool enabled) { 192 void EnableBeginEndTypes() {
153 GestureProvider::Config config = GetDefaultConfig(); 193 GestureProvider::Config config = GetDefaultConfig();
154 config.gesture_begin_end_types_enabled = true; 194 config.gesture_begin_end_types_enabled = true;
155 gesture_provider_.reset(new GestureProvider(config, this)); 195 SetUpWithConfig(config);
156 gesture_provider_->SetMultiTouchZoomSupportEnabled(false); 196 }
197
198 void EnableMultiFingerSwipe() {
199 GestureProvider::Config config = GetDefaultConfig();
200 config.gesture_detector_config.swipe_enabled = true;
201 SetUpWithConfig(config);
157 } 202 }
158 203
159 bool HasDownEvent() const { return gesture_provider_->current_down_event(); } 204 bool HasDownEvent() const { return gesture_provider_->current_down_event(); }
160 205
161 protected: 206 protected:
162 void CheckScrollEventSequenceForEndActionType( 207 void CheckScrollEventSequenceForEndActionType(
163 MotionEvent::Action end_action_type) { 208 MotionEvent::Action end_action_type) {
164 base::TimeTicks event_time = base::TimeTicks::Now(); 209 base::TimeTicks event_time = base::TimeTicks::Now();
165 const float scroll_to_x = kFakeCoordX + 100; 210 const float scroll_to_x = kFakeCoordX + 100;
166 const float scroll_to_y = kFakeCoordY + 100; 211 const float scroll_to_y = kFakeCoordY + 100;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 gesture_provider_->OnTouchEvent(event); 246 gesture_provider_->OnTouchEvent(event);
202 EXPECT_FALSE(gesture_provider_->IsScrollInProgress()); 247 EXPECT_FALSE(gesture_provider_->IsScrollInProgress());
203 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_SCROLL_END)); 248 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_SCROLL_END));
204 EXPECT_EQ(ET_GESTURE_SCROLL_END, GetMostRecentGestureEventType()); 249 EXPECT_EQ(ET_GESTURE_SCROLL_END, GetMostRecentGestureEventType());
205 EXPECT_EQ(motion_event_id, GetMostRecentGestureEvent().motion_event_id); 250 EXPECT_EQ(motion_event_id, GetMostRecentGestureEvent().motion_event_id);
206 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points()); 251 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points());
207 EXPECT_EQ(BoundsForSingleMockTouchAtLocation(scroll_to_x, scroll_to_y), 252 EXPECT_EQ(BoundsForSingleMockTouchAtLocation(scroll_to_x, scroll_to_y),
208 GetMostRecentGestureEvent().details.bounding_box()); 253 GetMostRecentGestureEvent().details.bounding_box());
209 } 254 }
210 255
256 void TwoFingerSwipe(float vx0, float vy0, float vx1, float vy1) {
257 std::vector<gfx::Vector2dF> velocities;
258 velocities.push_back(gfx::Vector2dF(vx0, vy0));
259 velocities.push_back(gfx::Vector2dF(vx1, vy1));
260 MultiFingerSwipe(velocities);
261 }
262
263 void ThreeFingerSwipe(float vx0,
264 float vy0,
265 float vx1,
266 float vy1,
267 float vx2,
268 float vy2) {
269 std::vector<gfx::Vector2dF> velocities;
270 velocities.push_back(gfx::Vector2dF(vx0, vy0));
271 velocities.push_back(gfx::Vector2dF(vx1, vy1));
272 velocities.push_back(gfx::Vector2dF(vx2, vy2));
273 MultiFingerSwipe(velocities);
274 }
275
276 void MultiFingerSwipe(std::vector<gfx::Vector2dF> velocities) {
277 ASSERT_GT(velocities.size(), 0U);
278
279 base::TimeTicks event_time = base::TimeTicks::Now();
280
281 std::vector<gfx::PointF> positions(velocities.size());
282 for (size_t i = 0; i < positions.size(); ++i)
283 positions[i] = gfx::PointF(kFakeCoordX * (i + 1), kFakeCoordY * (i + 1));
284
285 float dt = kDeltaTimeForFlingSequences.InSecondsF();
286
287 // Each pointer down should be a separate event.
288 for (size_t i = 0; i < positions.size(); ++i) {
289 const size_t pointer_count = i + 1;
290 std::vector<gfx::PointF> event_positions(pointer_count);
291 event_positions.assign(positions.begin(),
292 positions.begin() + pointer_count);
293 MockMotionEvent event =
294 ObtainMotionEvent(event_time,
295 pointer_count > 1 ? MotionEvent::ACTION_POINTER_DOWN
296 : MotionEvent::ACTION_DOWN,
297 event_positions);
298 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
299 }
300
301 for (size_t i = 0; i < positions.size(); ++i)
302 positions[i] += gfx::ScaleVector2d(velocities[i], dt);
303 MockMotionEvent event =
304 ObtainMotionEvent(event_time + kDeltaTimeForFlingSequences,
305 MotionEvent::ACTION_MOVE,
306 positions);
307 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
308
309 for (size_t i = 0; i < positions.size(); ++i)
310 positions[i] += gfx::ScaleVector2d(velocities[i], dt);
311 event = ObtainMotionEvent(event_time + 2 * kDeltaTimeForFlingSequences,
312 MotionEvent::ACTION_MOVE,
313 positions);
314 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
315
316 event = ObtainMotionEvent(event_time + 2 * kDeltaTimeForFlingSequences,
317 MotionEvent::ACTION_POINTER_UP,
318 positions);
319 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
320 }
321
211 static void RunTasksAndWait(base::TimeDelta delay) { 322 static void RunTasksAndWait(base::TimeDelta delay) {
212 base::MessageLoop::current()->PostDelayedTask( 323 base::MessageLoop::current()->PostDelayedTask(
213 FROM_HERE, base::MessageLoop::QuitClosure(), delay); 324 FROM_HERE, base::MessageLoop::QuitClosure(), delay);
214 base::MessageLoop::current()->Run(); 325 base::MessageLoop::current()->Run();
215 } 326 }
216 327
217 std::vector<GestureEventData> gestures_; 328 std::vector<GestureEventData> gestures_;
218 scoped_ptr<GestureProvider> gesture_provider_; 329 scoped_ptr<GestureProvider> gesture_provider_;
219 scoped_ptr<GestureEventData> active_scroll_begin_event_; 330 scoped_ptr<GestureEventData> active_scroll_begin_event_;
220 base::MessageLoopForUI message_loop_; 331 base::MessageLoopForUI message_loop_;
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 gesture_provider_->OnTouchEvent(event); 1421 gesture_provider_->OnTouchEvent(event);
1311 EXPECT_EQ(ET_GESTURE_SCROLL_END, GetMostRecentGestureEventType()); 1422 EXPECT_EQ(ET_GESTURE_SCROLL_END, GetMostRecentGestureEventType());
1312 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points()); 1423 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points());
1313 EXPECT_EQ(gfx::RectF(kFakeCoordX - kMockTouchRadius, 1424 EXPECT_EQ(gfx::RectF(kFakeCoordX - kMockTouchRadius,
1314 kFakeCoordY - kMockTouchRadius, 1425 kFakeCoordY - kMockTouchRadius,
1315 kMockTouchRadius * 2, 1426 kMockTouchRadius * 2,
1316 kMockTouchRadius * 2), 1427 kMockTouchRadius * 2),
1317 GetMostRecentGestureEvent().details.bounding_box()); 1428 GetMostRecentGestureEvent().details.bounding_box());
1318 } 1429 }
1319 1430
1431 // Verify that multi-finger swipe sends the proper event sequence.
1432 TEST_F(GestureProviderTest, MultiFingerSwipe) {
1433 EnableMultiFingerSwipe();
1434 gesture_provider_->SetMultiTouchZoomSupportEnabled(false);
1435 const float min_swipe_velocity = GetMinSwipeVelocity();
1436
1437 // Swipe right.
1438 TwoFingerSwipe(min_swipe_velocity * 2, 0, min_swipe_velocity * 2, 0);
1439 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1440 EXPECT_TRUE(GetMostRecentGestureEvent().details.swipe_right());
1441 EXPECT_EQ(2, GetMostRecentGestureEvent().details.touch_points());
1442 ResetGestureDetection();
1443
1444 // Swipe left.
1445 TwoFingerSwipe(-min_swipe_velocity * 2, 0, -min_swipe_velocity * 2, 0);
1446 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1447 EXPECT_TRUE(GetMostRecentGestureEvent().details.swipe_left());
1448 EXPECT_EQ(2, GetMostRecentGestureEvent().details.touch_points());
1449 ResetGestureDetection();
1450
1451 // No swipe with different touch directions.
1452 TwoFingerSwipe(min_swipe_velocity * 2, 0, -min_swipe_velocity * 2, 0);
1453 EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1454 ResetGestureDetection();
1455
1456 // No swipe without a dominant direction.
1457 TwoFingerSwipe(min_swipe_velocity * 2,
1458 min_swipe_velocity * 2,
1459 min_swipe_velocity * 2,
1460 min_swipe_velocity * 2);
1461 EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1462 ResetGestureDetection();
1463
1464 // Swipe up with non-zero velocities on both axes and dominant direction.
1465 TwoFingerSwipe(-min_swipe_velocity,
1466 min_swipe_velocity * 4,
1467 -min_swipe_velocity,
1468 min_swipe_velocity * 4);
1469 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1470 EXPECT_TRUE(GetMostRecentGestureEvent().details.swipe_down());
1471 EXPECT_FALSE(GetMostRecentGestureEvent().details.swipe_left());
1472 EXPECT_EQ(2, GetMostRecentGestureEvent().details.touch_points());
1473 ResetGestureDetection();
1474
1475 // Swipe down with non-zero velocities on both axes.
1476 TwoFingerSwipe(min_swipe_velocity,
1477 -min_swipe_velocity * 4,
1478 min_swipe_velocity,
1479 -min_swipe_velocity * 4);
1480 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1481 EXPECT_TRUE(GetMostRecentGestureEvent().details.swipe_up());
1482 EXPECT_FALSE(GetMostRecentGestureEvent().details.swipe_right());
1483 EXPECT_EQ(2, GetMostRecentGestureEvent().details.touch_points());
1484 ResetGestureDetection();
1485
1486 // No swipe without sufficient velocity.
1487 TwoFingerSwipe(min_swipe_velocity / 2, 0, 0, 0);
1488 EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1489 ResetGestureDetection();
1490
1491 // Swipe up with one small and one medium velocity in slightly different but
1492 // not opposing directions.
1493 TwoFingerSwipe(min_swipe_velocity / 2,
1494 min_swipe_velocity / 2,
1495 0,
1496 min_swipe_velocity * 2);
1497 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1498 EXPECT_TRUE(GetMostRecentGestureEvent().details.swipe_down());
1499 EXPECT_FALSE(GetMostRecentGestureEvent().details.swipe_right());
1500 EXPECT_EQ(2, GetMostRecentGestureEvent().details.touch_points());
1501 ResetGestureDetection();
1502
1503 // No swipe in orthogonal directions.
1504 TwoFingerSwipe(min_swipe_velocity * 2, 0, 0, min_swipe_velocity * 7);
1505 EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1506 ResetGestureDetection();
1507
1508 // Three finger swipe in same directions.
1509 ThreeFingerSwipe(min_swipe_velocity * 2,
1510 0,
1511 min_swipe_velocity * 3,
1512 0,
1513 min_swipe_velocity * 4,
1514 0);
1515 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1516 EXPECT_TRUE(GetMostRecentGestureEvent().details.swipe_right());
1517 EXPECT_EQ(3, GetMostRecentGestureEvent().details.touch_points());
1518 ResetGestureDetection();
1519
1520 // No three finger swipe in different directions.
1521 ThreeFingerSwipe(min_swipe_velocity * 2,
1522 0,
1523 0,
1524 min_swipe_velocity * 3,
1525 min_swipe_velocity * 4,
1526 0);
1527 EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1528 }
1529
1320 // Verify that the timer of LONG_PRESS will be cancelled when scrolling begins 1530 // Verify that the timer of LONG_PRESS will be cancelled when scrolling begins
1321 // so LONG_PRESS and LONG_TAP won't be triggered. 1531 // so LONG_PRESS and LONG_TAP won't be triggered.
1322 TEST_F(GestureProviderTest, GesturesCancelledAfterLongPressCausesLostFocus) { 1532 TEST_F(GestureProviderTest, GesturesCancelledAfterLongPressCausesLostFocus) {
1323 base::TimeTicks event_time = base::TimeTicks::Now(); 1533 base::TimeTicks event_time = base::TimeTicks::Now();
1324 1534
1325 MockMotionEvent event = 1535 MockMotionEvent event =
1326 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); 1536 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN);
1327 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 1537 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
1328 1538
1329 const base::TimeDelta long_press_timeout = 1539 const base::TimeDelta long_press_timeout =
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 event = ObtainMotionEvent(down_time_2 + kOneSecond, 1642 event = ObtainMotionEvent(down_time_2 + kOneSecond,
1433 MotionEvent::ACTION_UP); 1643 MotionEvent::ACTION_UP);
1434 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 1644 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
1435 EXPECT_EQ(gesture_count + 1, GetReceivedGestureCount()); 1645 EXPECT_EQ(gesture_count + 1, GetReceivedGestureCount());
1436 EXPECT_EQ(ET_GESTURE_SCROLL_END, GetMostRecentGestureEventType()); 1646 EXPECT_EQ(ET_GESTURE_SCROLL_END, GetMostRecentGestureEventType());
1437 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points()); 1647 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points());
1438 } 1648 }
1439 1649
1440 // Verify that gesture begin and gesture end events are dispatched correctly. 1650 // Verify that gesture begin and gesture end events are dispatched correctly.
1441 TEST_F(GestureProviderTest, GestureBeginAndEnd) { 1651 TEST_F(GestureProviderTest, GestureBeginAndEnd) {
1442 SetBeginEndTypesEnabled(true); 1652 EnableBeginEndTypes();
1443 base::TimeTicks event_time = base::TimeTicks::Now(); 1653 base::TimeTicks event_time = base::TimeTicks::Now();
1444 1654
1445 EXPECT_EQ(0U, GetReceivedGestureCount()); 1655 EXPECT_EQ(0U, GetReceivedGestureCount());
1446 MockMotionEvent event = 1656 MockMotionEvent event =
1447 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); 1657 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN);
1448 event.pointer_count = 1; 1658 event.pointer_count = 1;
1449 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 1659 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
1450 EXPECT_EQ(ET_GESTURE_BEGIN, GetReceivedGesture(0).type); 1660 EXPECT_EQ(ET_GESTURE_BEGIN, GetReceivedGesture(0).type);
1451 EXPECT_EQ(ET_GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); 1661 EXPECT_EQ(ET_GESTURE_TAP_DOWN, GetMostRecentGestureEventType());
1452 EXPECT_EQ(2U, GetReceivedGestureCount()); 1662 EXPECT_EQ(2U, GetReceivedGestureCount());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 1726
1517 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_CANCEL); 1727 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_CANCEL);
1518 event.pointer_count = 1; 1728 event.pointer_count = 1;
1519 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 1729 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
1520 EXPECT_EQ(ET_GESTURE_END, GetMostRecentGestureEventType()); 1730 EXPECT_EQ(ET_GESTURE_END, GetMostRecentGestureEventType());
1521 EXPECT_EQ(12U, GetReceivedGestureCount()); 1731 EXPECT_EQ(12U, GetReceivedGestureCount());
1522 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points()); 1732 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points());
1523 } 1733 }
1524 1734
1525 } // namespace ui 1735 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/gesture_provider.cc ('k') | ui/events/gesture_detection/mock_motion_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698