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

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: Test three finger swipe 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 static MockMotionEvent ObtainMotionEvent(base::TimeTicks event_time, 61 static MockMotionEvent ObtainMotionEvent(base::TimeTicks event_time,
62 MotionEvent::Action action, 62 MotionEvent::Action action,
63 float x0, 63 float x0,
64 float y0, 64 float y0,
65 float x1, 65 float x1,
66 float y1) { 66 float y1) {
67 return MockMotionEvent(action, event_time, x0, y0, x1, y1); 67 return MockMotionEvent(action, event_time, x0, y0, x1, y1);
68 } 68 }
69 69
70 static MockMotionEvent ObtainMotionEvent(
71 base::TimeTicks event_time,
72 MotionEvent::Action action,
73 const std::vector<gfx::PointF>& positions) {
74 switch (positions.size()) {
75 case 1:
76 return MockMotionEvent(
77 action, event_time, positions[0].x(), positions[0].y());
78 case 2:
79 return MockMotionEvent(action,
80 event_time,
81 positions[0].x(),
82 positions[0].y(),
83 positions[1].x(),
84 positions[1].y());
85 case 3:
86 return MockMotionEvent(action,
87 event_time,
88 positions[0].x(),
89 positions[0].y(),
90 positions[1].x(),
91 positions[1].y(),
92 positions[2].x(),
93 positions[2].y());
94 default:
95 CHECK(false) << "MockMotionEvent only supports 1-3 pointers";
96 return MockMotionEvent();
97 }
98 }
99
70 static MockMotionEvent ObtainMotionEvent(base::TimeTicks event_time, 100 static MockMotionEvent ObtainMotionEvent(base::TimeTicks event_time,
71 MotionEvent::Action action) { 101 MotionEvent::Action action) {
72 return ObtainMotionEvent(event_time, action, kFakeCoordX, kFakeCoordY); 102 return ObtainMotionEvent(event_time, action, kFakeCoordX, kFakeCoordY);
73 } 103 }
74 104
75 // Test 105 // Test
76 virtual void SetUp() OVERRIDE { 106 virtual void SetUp() OVERRIDE { SetUpWithConfig(GetDefaultConfig()); }
77 gesture_provider_.reset(new GestureProvider(GetDefaultConfig(), this));
78 gesture_provider_->SetMultiTouchZoomSupportEnabled(false);
79 }
80 107
81 virtual void TearDown() OVERRIDE { 108 virtual void TearDown() OVERRIDE {
82 gestures_.clear(); 109 gestures_.clear();
83 gesture_provider_.reset(); 110 gesture_provider_.reset();
84 } 111 }
85 112
86 // GestureProviderClient 113 // GestureProviderClient
87 virtual void OnGestureEvent(const GestureEventData& gesture) OVERRIDE { 114 virtual void OnGestureEvent(const GestureEventData& gesture) OVERRIDE {
88 if (gesture.type == ET_GESTURE_SCROLL_BEGIN) 115 if (gesture.type == ET_GESTURE_SCROLL_BEGIN)
89 active_scroll_begin_event_.reset(new GestureEventData(gesture)); 116 active_scroll_begin_event_.reset(new GestureEventData(gesture));
90 gestures_.push_back(gesture); 117 gestures_.push_back(gesture);
91 } 118 }
92 119
120 void SetUpWithConfig(const GestureProvider::Config& config) {
121 gesture_provider_.reset(new GestureProvider(config, this));
122 gesture_provider_->SetMultiTouchZoomSupportEnabled(false);
123 }
124
125 void ResetGestureDetection() {
126 CancelActiveTouchSequence();
127 gestures_.clear();
128 }
93 bool CancelActiveTouchSequence() { 129 bool CancelActiveTouchSequence() {
94 if (!gesture_provider_->current_down_event()) 130 if (!gesture_provider_->current_down_event())
95 return false; 131 return false;
96 return gesture_provider_->OnTouchEvent( 132 return gesture_provider_->OnTouchEvent(
97 *gesture_provider_->current_down_event()->Cancel()); 133 *gesture_provider_->current_down_event()->Cancel());
98 } 134 }
99 135
100 bool HasReceivedGesture(EventType type) const { 136 bool HasReceivedGesture(EventType type) const {
101 for (size_t i = 0; i < gestures_.size(); ++i) { 137 for (size_t i = 0; i < gestures_.size(); ++i) {
102 if (gestures_[i].type == type) 138 if (gestures_[i].type == type)
(...skipping 25 matching lines...) Expand all
128 164
129 const GestureProvider::Config& GetDefaultConfig() const { 165 const GestureProvider::Config& GetDefaultConfig() const {
130 static GestureProvider::Config sConfig = CreateDefaultConfig(); 166 static GestureProvider::Config sConfig = CreateDefaultConfig();
131 return sConfig; 167 return sConfig;
132 } 168 }
133 169
134 float GetTouchSlop() const { 170 float GetTouchSlop() const {
135 return GetDefaultConfig().gesture_detector_config.touch_slop; 171 return GetDefaultConfig().gesture_detector_config.touch_slop;
136 } 172 }
137 173
174 float GetMinSwipeVelocity() const {
175 return GetDefaultConfig().gesture_detector_config.minimum_swipe_velocity;
176 }
177
138 base::TimeDelta GetLongPressTimeout() const { 178 base::TimeDelta GetLongPressTimeout() const {
139 return GetDefaultConfig().gesture_detector_config.longpress_timeout; 179 return GetDefaultConfig().gesture_detector_config.longpress_timeout;
140 } 180 }
141 181
142 base::TimeDelta GetShowPressTimeout() const { 182 base::TimeDelta GetShowPressTimeout() const {
143 return GetDefaultConfig().gesture_detector_config.showpress_timeout; 183 return GetDefaultConfig().gesture_detector_config.showpress_timeout;
144 } 184 }
145 185
146 void SetBeginEndTypesEnabled(bool enabled) { 186 void EnableBeginEndTypes() {
147 GestureProvider::Config config = GetDefaultConfig(); 187 GestureProvider::Config config = GetDefaultConfig();
148 config.gesture_begin_end_types_enabled = true; 188 config.gesture_begin_end_types_enabled = true;
149 gesture_provider_.reset(new GestureProvider(config, this)); 189 SetUpWithConfig(config);
150 gesture_provider_->SetMultiTouchZoomSupportEnabled(false); 190 }
191
192 void EnableMultiFingerSwipe() {
193 GestureProvider::Config config = GetDefaultConfig();
194 config.gesture_detector_config.swipe_enabled = true;
195 SetUpWithConfig(config);
151 } 196 }
152 197
153 bool HasDownEvent() const { return gesture_provider_->current_down_event(); } 198 bool HasDownEvent() const { return gesture_provider_->current_down_event(); }
154 199
155 protected: 200 protected:
156 void CheckScrollEventSequenceForEndActionType( 201 void CheckScrollEventSequenceForEndActionType(
157 MotionEvent::Action end_action_type) { 202 MotionEvent::Action end_action_type) {
158 base::TimeTicks event_time = base::TimeTicks::Now(); 203 base::TimeTicks event_time = base::TimeTicks::Now();
159 const float scroll_to_x = kFakeCoordX + 100; 204 const float scroll_to_x = kFakeCoordX + 100;
160 const float scroll_to_y = kFakeCoordY + 100; 205 const float scroll_to_y = kFakeCoordY + 100;
(...skipping 30 matching lines...) Expand all
191 event.SetId(++motion_event_id); 236 event.SetId(++motion_event_id);
192 237
193 gesture_provider_->OnTouchEvent(event); 238 gesture_provider_->OnTouchEvent(event);
194 EXPECT_FALSE(gesture_provider_->IsScrollInProgress()); 239 EXPECT_FALSE(gesture_provider_->IsScrollInProgress());
195 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_SCROLL_END)); 240 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_SCROLL_END));
196 EXPECT_EQ(ET_GESTURE_SCROLL_END, GetMostRecentGestureEventType()); 241 EXPECT_EQ(ET_GESTURE_SCROLL_END, GetMostRecentGestureEventType());
197 EXPECT_EQ(motion_event_id, GetMostRecentGestureEvent().motion_event_id); 242 EXPECT_EQ(motion_event_id, GetMostRecentGestureEvent().motion_event_id);
198 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points()); 243 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points());
199 } 244 }
200 245
246 void TwoFingerSwipe(float vx0, float vy0, float vx1, float vy1) {
247 std::vector<gfx::Vector2dF> velocities;
248 velocities.push_back(gfx::Vector2dF(vx0, vy0));
249 velocities.push_back(gfx::Vector2dF(vx1, vy1));
250 MultiFingerSwipe(velocities);
251 }
252
253 void ThreeFingerSwipe(float vx0,
254 float vy0,
255 float vx1,
256 float vy1,
257 float vx2,
258 float vy2) {
259 std::vector<gfx::Vector2dF> velocities;
260 velocities.push_back(gfx::Vector2dF(vx0, vy0));
261 velocities.push_back(gfx::Vector2dF(vx1, vy1));
262 velocities.push_back(gfx::Vector2dF(vx2, vy2));
263 MultiFingerSwipe(velocities);
264 }
265
266 void MultiFingerSwipe(std::vector<gfx::Vector2dF> velocities) {
267 ASSERT_GT(velocities.size(), 0U);
268
269 base::TimeTicks event_time = base::TimeTicks::Now();
270
271 std::vector<gfx::PointF> positions(velocities.size());
272 for (size_t i = 0; i < positions.size(); ++i)
273 positions[i] = gfx::PointF(kFakeCoordX * (i + 1), kFakeCoordY * (i + 1));
274
275 float dt = kDeltaTimeForFlingSequences.InSecondsF();
276
277 // Each pointer down should be a separate event.
278 for (size_t i = 0; i < positions.size(); ++i) {
279 const size_t pointer_count = i + 1;
280 std::vector<gfx::PointF> event_positions(pointer_count);
281 event_positions.assign(positions.begin(),
282 positions.begin() + pointer_count);
283 MockMotionEvent event =
284 ObtainMotionEvent(event_time,
285 pointer_count > 1 ? MotionEvent::ACTION_POINTER_DOWN
286 : MotionEvent::ACTION_DOWN,
287 event_positions);
288 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
289 }
290
291 for (size_t i = 0; i < positions.size(); ++i)
292 positions[i] += gfx::ScaleVector2d(velocities[i], dt);
293 MockMotionEvent event =
294 ObtainMotionEvent(event_time + kDeltaTimeForFlingSequences,
295 MotionEvent::ACTION_MOVE,
296 positions);
297 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
298
299 for (size_t i = 0; i < positions.size(); ++i)
300 positions[i] += gfx::ScaleVector2d(velocities[i], dt);
301 event = ObtainMotionEvent(event_time + 2 * kDeltaTimeForFlingSequences,
302 MotionEvent::ACTION_MOVE,
303 positions);
304 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
305
306 event = ObtainMotionEvent(event_time + 2 * kDeltaTimeForFlingSequences,
307 MotionEvent::ACTION_POINTER_UP,
308 positions);
309 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
310 }
311
201 static void RunTasksAndWait(base::TimeDelta delay) { 312 static void RunTasksAndWait(base::TimeDelta delay) {
202 base::MessageLoop::current()->PostDelayedTask( 313 base::MessageLoop::current()->PostDelayedTask(
203 FROM_HERE, base::MessageLoop::QuitClosure(), delay); 314 FROM_HERE, base::MessageLoop::QuitClosure(), delay);
204 base::MessageLoop::current()->Run(); 315 base::MessageLoop::current()->Run();
205 } 316 }
206 317
207 std::vector<GestureEventData> gestures_; 318 std::vector<GestureEventData> gestures_;
208 scoped_ptr<GestureProvider> gesture_provider_; 319 scoped_ptr<GestureProvider> gesture_provider_;
209 scoped_ptr<GestureEventData> active_scroll_begin_event_; 320 scoped_ptr<GestureEventData> active_scroll_begin_event_;
210 base::MessageLoopForUI message_loop_; 321 base::MessageLoopForUI message_loop_;
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 EXPECT_EQ(ET_GESTURE_PINCH_END, GetMostRecentGestureEventType()); 1365 EXPECT_EQ(ET_GESTURE_PINCH_END, GetMostRecentGestureEventType());
1255 EXPECT_EQ(2, GetMostRecentGestureEvent().details.touch_points()); 1366 EXPECT_EQ(2, GetMostRecentGestureEvent().details.touch_points());
1256 EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_SCROLL_END)); 1367 EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_SCROLL_END));
1257 1368
1258 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_UP); 1369 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_UP);
1259 gesture_provider_->OnTouchEvent(event); 1370 gesture_provider_->OnTouchEvent(event);
1260 EXPECT_EQ(ET_GESTURE_SCROLL_END, GetMostRecentGestureEventType()); 1371 EXPECT_EQ(ET_GESTURE_SCROLL_END, GetMostRecentGestureEventType());
1261 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points()); 1372 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points());
1262 } 1373 }
1263 1374
1375 // Verify that multi-finger swipe sends the proper event sequence.
1376 TEST_F(GestureProviderTest, MultiFingerSwipe) {
1377 EnableMultiFingerSwipe();
1378 gesture_provider_->SetMultiTouchZoomSupportEnabled(false);
1379 const float min_swipe_velocity = GetMinSwipeVelocity();
1380
1381 // Swipe right.
1382 TwoFingerSwipe(min_swipe_velocity * 2, 0, min_swipe_velocity * 2, 0);
1383 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1384 EXPECT_TRUE(GetMostRecentGestureEvent().details.swipe_right());
1385 EXPECT_EQ(2, GetMostRecentGestureEvent().details.touch_points());
1386 ResetGestureDetection();
1387
1388 // Swipe left.
1389 TwoFingerSwipe(-min_swipe_velocity * 2, 0, -min_swipe_velocity * 2, 0);
1390 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1391 EXPECT_TRUE(GetMostRecentGestureEvent().details.swipe_left());
1392 EXPECT_EQ(2, GetMostRecentGestureEvent().details.touch_points());
1393 ResetGestureDetection();
1394
1395 // No swipe with different touch directions.
1396 TwoFingerSwipe(min_swipe_velocity * 2, 0, -min_swipe_velocity * 2, 0);
1397 EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1398 ResetGestureDetection();
1399
1400 // No swipe without a dominant direction.
1401 TwoFingerSwipe(min_swipe_velocity * 2,
1402 min_swipe_velocity * 2,
1403 min_swipe_velocity * 2,
1404 min_swipe_velocity * 2);
1405 EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1406 ResetGestureDetection();
1407
1408 // Swipe up with non-zero velocities on both axes and dominant direction.
1409 TwoFingerSwipe(-min_swipe_velocity,
1410 min_swipe_velocity * 4,
1411 -min_swipe_velocity,
1412 min_swipe_velocity * 4);
1413 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1414 EXPECT_TRUE(GetMostRecentGestureEvent().details.swipe_down());
1415 EXPECT_FALSE(GetMostRecentGestureEvent().details.swipe_left());
1416 EXPECT_EQ(2, GetMostRecentGestureEvent().details.touch_points());
1417 ResetGestureDetection();
1418
1419 // Swipe down with non-zero velocities on both axes.
1420 TwoFingerSwipe(min_swipe_velocity,
1421 -min_swipe_velocity * 4,
1422 min_swipe_velocity,
1423 -min_swipe_velocity * 4);
1424 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1425 EXPECT_TRUE(GetMostRecentGestureEvent().details.swipe_up());
1426 EXPECT_FALSE(GetMostRecentGestureEvent().details.swipe_right());
1427 EXPECT_EQ(2, GetMostRecentGestureEvent().details.touch_points());
1428 ResetGestureDetection();
1429
1430 // No swipe without sufficient velocity.
1431 TwoFingerSwipe(min_swipe_velocity / 2, 0, 0, 0);
1432 EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1433 ResetGestureDetection();
1434
1435 // Swipe up with one small and one medium velocity in slightly different but
1436 // not opposing directions.
1437 TwoFingerSwipe(min_swipe_velocity / 2,
1438 min_swipe_velocity / 2,
1439 0,
1440 min_swipe_velocity * 2);
1441 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1442 EXPECT_TRUE(GetMostRecentGestureEvent().details.swipe_down());
1443 EXPECT_FALSE(GetMostRecentGestureEvent().details.swipe_right());
1444 EXPECT_EQ(2, GetMostRecentGestureEvent().details.touch_points());
1445 ResetGestureDetection();
1446
1447 // No swipe in orthogonal directions.
1448 TwoFingerSwipe(min_swipe_velocity * 2, 0, 0, min_swipe_velocity * 7);
1449 EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1450 ResetGestureDetection();
1451
1452 // Three finger swipe in same directions.
1453 ThreeFingerSwipe(min_swipe_velocity * 2,
1454 0,
1455 min_swipe_velocity * 3,
1456 0,
1457 min_swipe_velocity * 4,
1458 0);
1459 EXPECT_TRUE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1460 EXPECT_TRUE(GetMostRecentGestureEvent().details.swipe_right());
1461 EXPECT_EQ(3, GetMostRecentGestureEvent().details.touch_points());
1462 ResetGestureDetection();
1463
1464 // No three finger swipe in different directions.
1465 ThreeFingerSwipe(min_swipe_velocity * 2,
1466 0,
1467 0,
1468 min_swipe_velocity * 3,
1469 min_swipe_velocity * 4,
1470 0);
1471 EXPECT_FALSE(HasReceivedGesture(ET_GESTURE_MULTIFINGER_SWIPE));
1472 }
1473
1264 // Verify that the timer of LONG_PRESS will be cancelled when scrolling begins 1474 // Verify that the timer of LONG_PRESS will be cancelled when scrolling begins
1265 // so LONG_PRESS and LONG_TAP won't be triggered. 1475 // so LONG_PRESS and LONG_TAP won't be triggered.
1266 TEST_F(GestureProviderTest, GesturesCancelledAfterLongPressCausesLostFocus) { 1476 TEST_F(GestureProviderTest, GesturesCancelledAfterLongPressCausesLostFocus) {
1267 base::TimeTicks event_time = base::TimeTicks::Now(); 1477 base::TimeTicks event_time = base::TimeTicks::Now();
1268 1478
1269 MockMotionEvent event = 1479 MockMotionEvent event =
1270 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); 1480 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN);
1271 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 1481 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
1272 1482
1273 const base::TimeDelta long_press_timeout = 1483 const base::TimeDelta long_press_timeout =
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 event = ObtainMotionEvent(down_time_2 + kOneSecond, 1586 event = ObtainMotionEvent(down_time_2 + kOneSecond,
1377 MotionEvent::ACTION_UP); 1587 MotionEvent::ACTION_UP);
1378 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 1588 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
1379 EXPECT_EQ(gesture_count + 1, GetReceivedGestureCount()); 1589 EXPECT_EQ(gesture_count + 1, GetReceivedGestureCount());
1380 EXPECT_EQ(ET_GESTURE_SCROLL_END, GetMostRecentGestureEventType()); 1590 EXPECT_EQ(ET_GESTURE_SCROLL_END, GetMostRecentGestureEventType());
1381 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points()); 1591 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points());
1382 } 1592 }
1383 1593
1384 // Verify that gesture begin and gesture end events are dispatched correctly. 1594 // Verify that gesture begin and gesture end events are dispatched correctly.
1385 TEST_F(GestureProviderTest, GestureBeginAndEnd) { 1595 TEST_F(GestureProviderTest, GestureBeginAndEnd) {
1386 SetBeginEndTypesEnabled(true); 1596 EnableBeginEndTypes();
1387 base::TimeTicks event_time = base::TimeTicks::Now(); 1597 base::TimeTicks event_time = base::TimeTicks::Now();
1388 1598
1389 EXPECT_EQ(0U, GetReceivedGestureCount()); 1599 EXPECT_EQ(0U, GetReceivedGestureCount());
1390 MockMotionEvent event = 1600 MockMotionEvent event =
1391 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); 1601 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN);
1392 event.pointer_count = 1; 1602 event.pointer_count = 1;
1393 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 1603 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
1394 EXPECT_EQ(ET_GESTURE_BEGIN, GetReceivedGesture(0).type); 1604 EXPECT_EQ(ET_GESTURE_BEGIN, GetReceivedGesture(0).type);
1395 EXPECT_EQ(ET_GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); 1605 EXPECT_EQ(ET_GESTURE_TAP_DOWN, GetMostRecentGestureEventType());
1396 EXPECT_EQ(2U, GetReceivedGestureCount()); 1606 EXPECT_EQ(2U, GetReceivedGestureCount());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 1665
1456 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_CANCEL); 1666 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_CANCEL);
1457 event.pointer_count = 1; 1667 event.pointer_count = 1;
1458 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 1668 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
1459 EXPECT_EQ(ET_GESTURE_END, GetMostRecentGestureEventType()); 1669 EXPECT_EQ(ET_GESTURE_END, GetMostRecentGestureEventType());
1460 EXPECT_EQ(12U, GetReceivedGestureCount()); 1670 EXPECT_EQ(12U, GetReceivedGestureCount());
1461 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points()); 1671 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points());
1462 } 1672 }
1463 1673
1464 } // namespace ui 1674 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698