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/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" |
11 #include "ui/events/gesture_detection/gesture_event_params.h" | 11 #include "ui/events/gesture_detection/gesture_event_data.h" |
12 #include "ui/events/gesture_detection/gesture_provider.h" | 12 #include "ui/events/gesture_detection/gesture_provider.h" |
13 #include "ui/events/gesture_detection/mock_motion_event.h" | 13 #include "ui/events/gesture_detection/mock_motion_event.h" |
14 #include "ui/events/gesture_detection/motion_event.h" | 14 #include "ui/events/gesture_detection/motion_event.h" |
15 #include "ui/gfx/geometry/point_f.h" | 15 #include "ui/gfx/geometry/point_f.h" |
16 | 16 |
17 using base::TimeDelta; | 17 using base::TimeDelta; |
18 using base::TimeTicks; | 18 using base::TimeTicks; |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 namespace { | 21 namespace { |
(...skipping 27 matching lines...) Expand all Loading... |
49 } | 49 } |
50 | 50 |
51 static MockMotionEvent ObtainMotionEvent(base::TimeTicks event_time, | 51 static MockMotionEvent ObtainMotionEvent(base::TimeTicks event_time, |
52 MotionEvent::Action action) { | 52 MotionEvent::Action action) { |
53 return ObtainMotionEvent(event_time, action, kFakeCoordX, kFakeCoordY); | 53 return ObtainMotionEvent(event_time, action, kFakeCoordX, kFakeCoordY); |
54 } | 54 } |
55 | 55 |
56 // Test | 56 // Test |
57 virtual void SetUp() OVERRIDE { | 57 virtual void SetUp() OVERRIDE { |
58 gesture_provider_.reset(new GestureProvider(GetDefaultConfig(), this)); | 58 gesture_provider_.reset(new GestureProvider(GetDefaultConfig(), this)); |
59 gesture_provider_->UpdateMultiTouchSupport(false); | 59 gesture_provider_->SetMultiTouchSupportEnabled(false); |
60 } | 60 } |
61 | 61 |
62 virtual void TearDown() OVERRIDE { | 62 virtual void TearDown() OVERRIDE { |
63 gestures_.clear(); | 63 gestures_.clear(); |
64 gesture_provider_.reset(); | 64 gesture_provider_.reset(); |
65 } | 65 } |
66 | 66 |
67 // GestureProviderClient | 67 // GestureProviderClient |
68 virtual void OnGestureEvent(const GestureEventParams& gesture) OVERRIDE { | 68 virtual void OnGestureEvent(const GestureEventData& gesture) OVERRIDE { |
69 if (gesture.type == GESTURE_SCROLL_BEGIN) | 69 if (gesture.type == GESTURE_SCROLL_BEGIN) |
70 active_scroll_begin_event_.reset(new GestureEventParams(gesture)); | 70 active_scroll_begin_event_.reset(new GestureEventData(gesture)); |
71 gestures_.push_back(gesture); | 71 gestures_.push_back(gesture); |
72 } | 72 } |
73 | 73 |
74 bool HasReceivedGesture(GestureEventType type) const { | 74 bool HasReceivedGesture(GestureEventType type) const { |
75 for (size_t i = 0; i < gestures_.size(); ++i) { | 75 for (size_t i = 0; i < gestures_.size(); ++i) { |
76 if (gestures_[i].type == type) | 76 if (gestures_[i].type == type) |
77 return true; | 77 return true; |
78 } | 78 } |
79 return false; | 79 return false; |
80 } | 80 } |
81 | 81 |
82 const GestureEventParams& GetMostRecentGestureEvent() const { | 82 const GestureEventData& GetMostRecentGestureEvent() const { |
83 EXPECT_FALSE(gestures_.empty()); | 83 EXPECT_FALSE(gestures_.empty()); |
84 return gestures_.back(); | 84 return gestures_.back(); |
85 } | 85 } |
86 | 86 |
87 const GestureEventType GetMostRecentGestureEventType() const { | 87 const GestureEventType GetMostRecentGestureEventType() const { |
88 EXPECT_FALSE(gestures_.empty()); | 88 EXPECT_FALSE(gestures_.empty()); |
89 return gestures_.back().type; | 89 return gestures_.back().type; |
90 } | 90 } |
91 | 91 |
92 size_t GetReceivedGestureCount() const { return gestures_.size(); } | 92 size_t GetReceivedGestureCount() const { return gestures_.size(); } |
93 | 93 |
94 const GestureEventParams& GetReceivedGesture(size_t index) const { | 94 const GestureEventData& GetReceivedGesture(size_t index) const { |
95 EXPECT_LT(index, GetReceivedGestureCount()); | 95 EXPECT_LT(index, GetReceivedGestureCount()); |
96 return gestures_[index]; | 96 return gestures_[index]; |
97 } | 97 } |
98 | 98 |
99 const GestureEventParams* GetActiveScrollBeginEvent() const { | 99 const GestureEventData* GetActiveScrollBeginEvent() const { |
100 return active_scroll_begin_event_ ? active_scroll_begin_event_.get() : NULL; | 100 return active_scroll_begin_event_ ? active_scroll_begin_event_.get() : NULL; |
101 } | 101 } |
102 | 102 |
103 const GestureProvider::Config& GetDefaultConfig() const { | 103 const GestureProvider::Config& GetDefaultConfig() const { |
104 static GestureProvider::Config sConfig; | 104 static GestureProvider::Config sConfig; |
105 return sConfig; | 105 return sConfig; |
106 } | 106 } |
107 | 107 |
108 int GetTouchSlop() const { | 108 int GetTouchSlop() const { |
109 return GetDefaultConfig().gesture_detector_config.scaled_touch_slop; | 109 return GetDefaultConfig().gesture_detector_config.scaled_touch_slop; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 EXPECT_TRUE(HasReceivedGesture(GESTURE_SCROLL_END)); | 153 EXPECT_TRUE(HasReceivedGesture(GESTURE_SCROLL_END)); |
154 EXPECT_EQ(GESTURE_SCROLL_END, GetMostRecentGestureEventType()); | 154 EXPECT_EQ(GESTURE_SCROLL_END, GetMostRecentGestureEventType()); |
155 } | 155 } |
156 | 156 |
157 static void Wait(base::TimeDelta delay) { | 157 static void Wait(base::TimeDelta delay) { |
158 base::MessageLoop::current()->PostDelayedTask( | 158 base::MessageLoop::current()->PostDelayedTask( |
159 FROM_HERE, base::MessageLoop::QuitClosure(), delay); | 159 FROM_HERE, base::MessageLoop::QuitClosure(), delay); |
160 base::MessageLoop::current()->Run(); | 160 base::MessageLoop::current()->Run(); |
161 } | 161 } |
162 | 162 |
163 std::vector<GestureEventParams> gestures_; | 163 std::vector<GestureEventData> gestures_; |
164 scoped_ptr<GestureProvider> gesture_provider_; | 164 scoped_ptr<GestureProvider> gesture_provider_; |
165 scoped_ptr<GestureEventParams> active_scroll_begin_event_; | 165 scoped_ptr<GestureEventData> active_scroll_begin_event_; |
166 base::MessageLoopForUI message_loop_; | 166 base::MessageLoopForUI message_loop_; |
167 }; | 167 }; |
168 | 168 |
169 // Verify that a DOWN followed shortly by an UP will trigger a single tap. | 169 // Verify that a DOWN followed shortly by an UP will trigger a single tap. |
170 TEST_F(GestureProviderTest, GestureSingleTap) { | 170 TEST_F(GestureProviderTest, GestureTapTap) { |
171 base::TimeTicks event_time = base::TimeTicks::Now(); | 171 base::TimeTicks event_time = base::TimeTicks::Now(); |
172 | 172 |
173 gesture_provider_->UpdateDoubleTapSupportForPlatform(false); | 173 gesture_provider_->SetDoubleTapSupportForPlatformEnabled(false); |
174 | 174 |
175 MockMotionEvent event = | 175 MockMotionEvent event = |
176 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); | 176 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); |
177 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 177 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
178 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 178 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
179 | 179 |
180 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, | 180 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, |
181 MotionEvent::ACTION_UP); | 181 MotionEvent::ACTION_UP); |
182 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 182 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
183 EXPECT_EQ(GESTURE_SINGLE_TAP_CONFIRMED, GetMostRecentGestureEventType()); | 183 EXPECT_EQ(GESTURE_TAP, GetMostRecentGestureEventType()); |
184 } | 184 } |
185 | 185 |
186 // Verify that a DOWN followed shortly by an UP will trigger | 186 // Verify that a DOWN followed shortly by an UP will trigger |
187 // a GESTURE_SINGLE_TAP_UNCONFIRMED event if double-tap is enabled. | 187 // a GESTURE_TAP_UNCONFIRMED event if double-tap is enabled. |
188 TEST_F(GestureProviderTest, GestureSingleTapWithDelay) { | 188 TEST_F(GestureProviderTest, GestureTapTapWithDelay) { |
189 base::TimeTicks event_time = base::TimeTicks::Now(); | 189 base::TimeTicks event_time = base::TimeTicks::Now(); |
190 | 190 |
191 gesture_provider_->UpdateDoubleTapSupportForPlatform(true); | 191 gesture_provider_->SetDoubleTapSupportForPlatformEnabled(true); |
192 | 192 |
193 MockMotionEvent event = | 193 MockMotionEvent event = |
194 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); | 194 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); |
195 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 195 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
196 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 196 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
197 | 197 |
198 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, | 198 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, |
199 MotionEvent::ACTION_UP); | 199 MotionEvent::ACTION_UP); |
200 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 200 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
201 EXPECT_EQ(GESTURE_SINGLE_TAP_UNCONFIRMED, GetMostRecentGestureEventType()); | 201 EXPECT_EQ(GESTURE_TAP_UNCONFIRMED, GetMostRecentGestureEventType()); |
202 EXPECT_FALSE(HasReceivedGesture(GESTURE_SINGLE_TAP_CONFIRMED)); | 202 EXPECT_FALSE(HasReceivedGesture(GESTURE_TAP)); |
203 } | 203 } |
204 | 204 |
205 // Verify that a DOWN followed by a MOVE will trigger fling (but not LONG). | 205 // Verify that a DOWN followed by a MOVE will trigger fling (but not LONG). |
206 TEST_F(GestureProviderTest, GestureFlingAndCancelLongPress) { | 206 TEST_F(GestureProviderTest, GestureFlingAndCancelLongPress) { |
207 base::TimeTicks event_time = TimeTicks::Now(); | 207 base::TimeTicks event_time = TimeTicks::Now(); |
208 | 208 |
209 MockMotionEvent event = | 209 MockMotionEvent event = |
210 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); | 210 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); |
211 | 211 |
212 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 212 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 kFakeCoordY * 5); | 261 kFakeCoordY * 5); |
262 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 262 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
263 EXPECT_TRUE(gesture_provider_->IsScrollInProgress()); | 263 EXPECT_TRUE(gesture_provider_->IsScrollInProgress()); |
264 EXPECT_TRUE(HasReceivedGesture(GESTURE_SCROLL_BEGIN)); | 264 EXPECT_TRUE(HasReceivedGesture(GESTURE_SCROLL_BEGIN)); |
265 EXPECT_EQ(GESTURE_SCROLL_UPDATE, GetMostRecentGestureEventType()); | 265 EXPECT_EQ(GESTURE_SCROLL_UPDATE, GetMostRecentGestureEventType()); |
266 ASSERT_EQ(4U, GetReceivedGestureCount()); | 266 ASSERT_EQ(4U, GetReceivedGestureCount()); |
267 ASSERT_EQ(GESTURE_SCROLL_BEGIN, GetReceivedGesture(2).type); | 267 ASSERT_EQ(GESTURE_SCROLL_BEGIN, GetReceivedGesture(2).type); |
268 | 268 |
269 // We don't want to take a dependency here on exactly how hints are calculated | 269 // We don't want to take a dependency here on exactly how hints are calculated |
270 // for a fling (eg. may depend on velocity), so just validate the direction. | 270 // for a fling (eg. may depend on velocity), so just validate the direction. |
271 int hint_x = GetReceivedGesture(2).data.scroll_begin.delta_x_hint; | 271 int hint_x = GetReceivedGesture(2).details.scroll_begin.delta_x_hint; |
272 int hint_y = GetReceivedGesture(2).data.scroll_begin.delta_y_hint; | 272 int hint_y = GetReceivedGesture(2).details.scroll_begin.delta_y_hint; |
273 EXPECT_TRUE(hint_x > 0 && hint_y > 0 && hint_x > hint_y) | 273 EXPECT_TRUE(hint_x > 0 && hint_y > 0 && hint_x > hint_y) |
274 << "ScrollBegin hint should be in positive X axis"; | 274 << "ScrollBegin hint should be in positive X axis"; |
275 | 275 |
276 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 3, | 276 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 3, |
277 MotionEvent::ACTION_UP, | 277 MotionEvent::ACTION_UP, |
278 kFakeCoordX * 10, | 278 kFakeCoordX * 10, |
279 kFakeCoordY * 10); | 279 kFakeCoordY * 10); |
280 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 280 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
281 EXPECT_FALSE(gesture_provider_->IsScrollInProgress()); | 281 EXPECT_FALSE(gesture_provider_->IsScrollInProgress()); |
282 EXPECT_EQ(GESTURE_FLING_START, GetMostRecentGestureEventType()); | 282 EXPECT_EQ(GESTURE_FLING_START, GetMostRecentGestureEventType()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); | 339 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); |
340 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 340 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
341 | 341 |
342 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 342 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
343 | 343 |
344 event = ObtainMotionEvent(event_time + kFiveMilliseconds, | 344 event = ObtainMotionEvent(event_time + kFiveMilliseconds, |
345 MotionEvent::ACTION_UP, | 345 MotionEvent::ACTION_UP, |
346 kFakeCoordX, | 346 kFakeCoordX, |
347 kFakeCoordY); | 347 kFakeCoordY); |
348 gesture_provider_->OnTouchEvent(event); | 348 gesture_provider_->OnTouchEvent(event); |
349 EXPECT_EQ(GESTURE_SINGLE_TAP_UNCONFIRMED, GetMostRecentGestureEventType()); | 349 EXPECT_EQ(GESTURE_TAP_UNCONFIRMED, GetMostRecentGestureEventType()); |
350 | 350 |
351 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, | 351 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, |
352 MotionEvent::ACTION_DOWN, | 352 MotionEvent::ACTION_DOWN, |
353 kFakeCoordX, | 353 kFakeCoordX, |
354 kFakeCoordY); | 354 kFakeCoordY); |
355 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 355 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
356 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 356 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
357 | 357 |
358 // Moving a very small amount of distance should not trigger the double tap | 358 // Moving a very small amount of distance should not trigger the double tap |
359 // drag zoom mode. | 359 // drag zoom mode. |
(...skipping 18 matching lines...) Expand all Loading... |
378 | 378 |
379 MockMotionEvent event = | 379 MockMotionEvent event = |
380 ObtainMotionEvent(down_time_1, MotionEvent::ACTION_DOWN); | 380 ObtainMotionEvent(down_time_1, MotionEvent::ACTION_DOWN); |
381 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 381 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
382 | 382 |
383 event = ObtainMotionEvent(down_time_1 + kFiveMilliseconds, | 383 event = ObtainMotionEvent(down_time_1 + kFiveMilliseconds, |
384 MotionEvent::ACTION_UP, | 384 MotionEvent::ACTION_UP, |
385 kFakeCoordX, | 385 kFakeCoordX, |
386 kFakeCoordY); | 386 kFakeCoordY); |
387 gesture_provider_->OnTouchEvent(event); | 387 gesture_provider_->OnTouchEvent(event); |
388 EXPECT_EQ(GESTURE_SINGLE_TAP_UNCONFIRMED, GetMostRecentGestureEventType()); | 388 EXPECT_EQ(GESTURE_TAP_UNCONFIRMED, GetMostRecentGestureEventType()); |
389 | 389 |
390 event = ObtainMotionEvent( | 390 event = ObtainMotionEvent( |
391 down_time_2, MotionEvent::ACTION_DOWN, kFakeCoordX, kFakeCoordY); | 391 down_time_2, MotionEvent::ACTION_DOWN, kFakeCoordX, kFakeCoordY); |
392 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 392 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
393 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 393 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
394 | 394 |
395 event = ObtainMotionEvent(down_time_2 + kFiveMilliseconds, | 395 event = ObtainMotionEvent(down_time_2 + kFiveMilliseconds, |
396 MotionEvent::ACTION_MOVE, | 396 MotionEvent::ACTION_MOVE, |
397 kFakeCoordX, | 397 kFakeCoordX, |
398 kFakeCoordY + 100); | 398 kFakeCoordY + 100); |
399 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 399 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
400 EXPECT_TRUE(HasReceivedGesture(GESTURE_SCROLL_BEGIN)); | 400 EXPECT_TRUE(HasReceivedGesture(GESTURE_SCROLL_BEGIN)); |
401 const GestureEventParams* scroll_begin_gesture = GetActiveScrollBeginEvent(); | 401 const GestureEventData* scroll_begin_gesture = GetActiveScrollBeginEvent(); |
402 ASSERT_TRUE(!!scroll_begin_gesture); | 402 ASSERT_TRUE(!!scroll_begin_gesture); |
403 EXPECT_EQ(0, scroll_begin_gesture->data.scroll_begin.delta_x_hint); | 403 EXPECT_EQ(0, scroll_begin_gesture->details.scroll_begin.delta_x_hint); |
404 EXPECT_EQ(100, scroll_begin_gesture->data.scroll_begin.delta_y_hint); | 404 EXPECT_EQ(100, scroll_begin_gesture->details.scroll_begin.delta_y_hint); |
405 EXPECT_EQ(GESTURE_PINCH_BEGIN, GetMostRecentGestureEventType()); | 405 EXPECT_EQ(GESTURE_PINCH_BEGIN, GetMostRecentGestureEventType()); |
406 | 406 |
407 event = ObtainMotionEvent(down_time_2 + kFiveMilliseconds * 2, | 407 event = ObtainMotionEvent(down_time_2 + kFiveMilliseconds * 2, |
408 MotionEvent::ACTION_MOVE, | 408 MotionEvent::ACTION_MOVE, |
409 kFakeCoordX, | 409 kFakeCoordX, |
410 kFakeCoordY + 200); | 410 kFakeCoordY + 200); |
411 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 411 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
412 EXPECT_TRUE(HasReceivedGesture(GESTURE_SCROLL_UPDATE)); | 412 EXPECT_TRUE(HasReceivedGesture(GESTURE_SCROLL_UPDATE)); |
413 EXPECT_EQ(GESTURE_PINCH_UPDATE, GetMostRecentGestureEventType()); | 413 EXPECT_EQ(GESTURE_PINCH_UPDATE, GetMostRecentGestureEventType()); |
414 | 414 |
(...skipping 11 matching lines...) Expand all Loading... |
426 const base::TimeTicks down_time_2 = down_time_1 + kFiveMilliseconds * 20; | 426 const base::TimeTicks down_time_2 = down_time_1 + kFiveMilliseconds * 20; |
427 | 427 |
428 MockMotionEvent event = | 428 MockMotionEvent event = |
429 ObtainMotionEvent(down_time_1, MotionEvent::ACTION_DOWN); | 429 ObtainMotionEvent(down_time_1, MotionEvent::ACTION_DOWN); |
430 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 430 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
431 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 431 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
432 | 432 |
433 event = ObtainMotionEvent(down_time_1 + kFiveMilliseconds, | 433 event = ObtainMotionEvent(down_time_1 + kFiveMilliseconds, |
434 MotionEvent::ACTION_UP); | 434 MotionEvent::ACTION_UP); |
435 gesture_provider_->OnTouchEvent(event); | 435 gesture_provider_->OnTouchEvent(event); |
436 EXPECT_EQ(GESTURE_SINGLE_TAP_UNCONFIRMED, GetMostRecentGestureEventType()); | 436 EXPECT_EQ(GESTURE_TAP_UNCONFIRMED, GetMostRecentGestureEventType()); |
437 | 437 |
438 event = ObtainMotionEvent(down_time_2, MotionEvent::ACTION_DOWN); | 438 event = ObtainMotionEvent(down_time_2, MotionEvent::ACTION_DOWN); |
439 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 439 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
440 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 440 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
441 EXPECT_TRUE(HasReceivedGesture(GESTURE_TAP_CANCEL)); | 441 EXPECT_TRUE(HasReceivedGesture(GESTURE_TAP_CANCEL)); |
442 | 442 |
443 event = ObtainMotionEvent(down_time_2 + kFiveMilliseconds * 10, | 443 event = ObtainMotionEvent(down_time_2 + kFiveMilliseconds * 10, |
444 MotionEvent::ACTION_MOVE, | 444 MotionEvent::ACTION_MOVE, |
445 kFakeCoordX, | 445 kFakeCoordX, |
446 kFakeCoordY - 30); | 446 kFakeCoordY - 30); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 kFakeCoordX - delta_x / 2, | 488 kFakeCoordX - delta_x / 2, |
489 kFakeCoordY - delta_y / 2); | 489 kFakeCoordY - delta_y / 2); |
490 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 490 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
491 | 491 |
492 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, | 492 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, |
493 MotionEvent::ACTION_MOVE, | 493 MotionEvent::ACTION_MOVE, |
494 kFakeCoordX - delta_x, | 494 kFakeCoordX - delta_x, |
495 kFakeCoordY - delta_y); | 495 kFakeCoordY - delta_y); |
496 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 496 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
497 | 497 |
498 // Make sure the reported gesture event has all the expected data. | 498 // Make sure the reported gesture event has all the expected details. |
499 ASSERT_LT(0U, GetReceivedGestureCount()); | 499 ASSERT_LT(0U, GetReceivedGestureCount()); |
500 GestureEventParams gesture = GetMostRecentGestureEvent(); | 500 GestureEventData gesture = GetMostRecentGestureEvent(); |
501 EXPECT_EQ(GESTURE_SCROLL_UPDATE, gesture.type); | 501 EXPECT_EQ(GESTURE_SCROLL_UPDATE, gesture.type); |
502 EXPECT_EQ(event_time + kFiveMilliseconds * 2, gesture.time); | 502 EXPECT_EQ(event_time + kFiveMilliseconds * 2, gesture.time); |
503 EXPECT_EQ(kFakeCoordX - delta_x, gesture.x); | 503 EXPECT_EQ(kFakeCoordX - delta_x, gesture.x); |
504 EXPECT_EQ(kFakeCoordY - delta_y, gesture.y); | 504 EXPECT_EQ(kFakeCoordY - delta_y, gesture.y); |
505 | 505 |
506 // No horizontal delta because of snapping. | 506 // No horizontal delta because of snapping. |
507 EXPECT_EQ(0, gesture.data.scroll_update.delta_x); | 507 EXPECT_EQ(0, gesture.details.scroll_update.delta_x); |
508 EXPECT_EQ(-delta_y / 2, gesture.data.scroll_update.delta_y); | 508 EXPECT_EQ(-delta_y / 2, gesture.details.scroll_update.delta_y); |
509 } | 509 } |
510 | 510 |
511 // Generate a scroll gesture and verify that the resulting scroll begin event | 511 // Generate a scroll gesture and verify that the resulting scroll begin event |
512 // has the expected hint values. | 512 // has the expected hint values. |
513 TEST_F(GestureProviderTest, ScrollBeginValues) { | 513 TEST_F(GestureProviderTest, ScrollBeginValues) { |
514 const int delta_x = 13; | 514 const int delta_x = 13; |
515 const int delta_y = 89; | 515 const int delta_y = 89; |
516 | 516 |
517 const base::TimeTicks event_time = TimeTicks::Now(); | 517 const base::TimeTicks event_time = TimeTicks::Now(); |
518 | 518 |
(...skipping 10 matching lines...) Expand all Loading... |
529 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 529 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
530 EXPECT_FALSE(gesture_provider_->IsScrollInProgress()); | 530 EXPECT_FALSE(gesture_provider_->IsScrollInProgress()); |
531 | 531 |
532 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, | 532 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, |
533 MotionEvent::ACTION_MOVE, | 533 MotionEvent::ACTION_MOVE, |
534 kFakeCoordX + delta_x, | 534 kFakeCoordX + delta_x, |
535 kFakeCoordY + delta_y); | 535 kFakeCoordY + delta_y); |
536 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 536 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
537 EXPECT_TRUE(gesture_provider_->IsScrollInProgress()); | 537 EXPECT_TRUE(gesture_provider_->IsScrollInProgress()); |
538 | 538 |
539 const GestureEventParams* scroll_begin_gesture = GetActiveScrollBeginEvent(); | 539 const GestureEventData* scroll_begin_gesture = GetActiveScrollBeginEvent(); |
540 ASSERT_TRUE(!!scroll_begin_gesture); | 540 ASSERT_TRUE(!!scroll_begin_gesture); |
541 EXPECT_EQ(delta_x, scroll_begin_gesture->data.scroll_begin.delta_x_hint); | 541 EXPECT_EQ(delta_x, scroll_begin_gesture->details.scroll_begin.delta_x_hint); |
542 EXPECT_EQ(delta_y, scroll_begin_gesture->data.scroll_begin.delta_y_hint); | 542 EXPECT_EQ(delta_y, scroll_begin_gesture->details.scroll_begin.delta_y_hint); |
543 } | 543 } |
544 | 544 |
545 TEST_F(GestureProviderTest, LongPressAndTapCancelledWhenScrollBegins) { | 545 TEST_F(GestureProviderTest, LongPressAndTapCancelledWhenScrollBegins) { |
546 base::TimeTicks event_time = base::TimeTicks::Now(); | 546 base::TimeTicks event_time = base::TimeTicks::Now(); |
547 | 547 |
548 MockMotionEvent event = | 548 MockMotionEvent event = |
549 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); | 549 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); |
550 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 550 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
551 event = ObtainMotionEvent(event_time + kFiveMilliseconds, | 551 event = ObtainMotionEvent(event_time + kFiveMilliseconds, |
552 MotionEvent::ACTION_MOVE, | 552 MotionEvent::ACTION_MOVE, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 | 620 |
621 MockMotionEvent event = ObtainMotionEvent( | 621 MockMotionEvent event = ObtainMotionEvent( |
622 event_time, MotionEvent::ACTION_DOWN, kFakeCoordX, kFakeCoordY); | 622 event_time, MotionEvent::ACTION_DOWN, kFakeCoordX, kFakeCoordY); |
623 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 623 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
624 | 624 |
625 event = ObtainMotionEvent(event_time + kFiveMilliseconds, | 625 event = ObtainMotionEvent(event_time + kFiveMilliseconds, |
626 MotionEvent::ACTION_UP, | 626 MotionEvent::ACTION_UP, |
627 kFakeCoordX, | 627 kFakeCoordX, |
628 kFakeCoordY); | 628 kFakeCoordY); |
629 gesture_provider_->OnTouchEvent(event); | 629 gesture_provider_->OnTouchEvent(event); |
630 EXPECT_EQ(GESTURE_SINGLE_TAP_UNCONFIRMED, GetMostRecentGestureEventType()); | 630 EXPECT_EQ(GESTURE_TAP_UNCONFIRMED, GetMostRecentGestureEventType()); |
631 | 631 |
632 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, | 632 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, |
633 MotionEvent::ACTION_DOWN, | 633 MotionEvent::ACTION_DOWN, |
634 kFakeCoordX, | 634 kFakeCoordX, |
635 kFakeCoordY); | 635 kFakeCoordY); |
636 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 636 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
637 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 637 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
638 EXPECT_TRUE(gesture_provider_->IsDoubleTapInProgress()); | 638 EXPECT_TRUE(gesture_provider_->IsDoubleTapInProgress()); |
639 | 639 |
640 const base::TimeDelta long_press_timeout = | 640 const base::TimeDelta long_press_timeout = |
(...skipping 30 matching lines...) Expand all Loading... |
671 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); | 671 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); |
672 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 672 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
673 | 673 |
674 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, | 674 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, |
675 MotionEvent::ACTION_MOVE, | 675 MotionEvent::ACTION_MOVE, |
676 kFakeCoordX, | 676 kFakeCoordX, |
677 kFakeCoordY + scaled_touch_slop + scroll_delta); | 677 kFakeCoordY + scaled_touch_slop + scroll_delta); |
678 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 678 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
679 | 679 |
680 EXPECT_EQ(GESTURE_SCROLL_UPDATE, GetMostRecentGestureEventType()); | 680 EXPECT_EQ(GESTURE_SCROLL_UPDATE, GetMostRecentGestureEventType()); |
681 GestureEventParams gesture = GetMostRecentGestureEvent(); | 681 GestureEventData gesture = GetMostRecentGestureEvent(); |
682 EXPECT_EQ(0, gesture.data.scroll_update.delta_x); | 682 EXPECT_EQ(0, gesture.details.scroll_update.delta_x); |
683 EXPECT_EQ(scroll_delta, gesture.data.scroll_update.delta_y); | 683 EXPECT_EQ(scroll_delta, gesture.details.scroll_update.delta_y); |
684 } | 684 } |
685 | 685 |
686 TEST_F(GestureProviderTest, NoDoubleTapWhenExplicitlyDisabled) { | 686 TEST_F(GestureProviderTest, NoDoubleTapWhenExplicitlyDisabled) { |
687 gesture_provider_->UpdateDoubleTapSupportForPlatform(false); | 687 gesture_provider_->SetDoubleTapSupportForPlatformEnabled(false); |
688 | 688 |
689 base::TimeTicks event_time = base::TimeTicks::Now(); | 689 base::TimeTicks event_time = base::TimeTicks::Now(); |
690 MockMotionEvent event = ObtainMotionEvent( | 690 MockMotionEvent event = ObtainMotionEvent( |
691 event_time, MotionEvent::ACTION_DOWN, kFakeCoordX, kFakeCoordY); | 691 event_time, MotionEvent::ACTION_DOWN, kFakeCoordX, kFakeCoordY); |
692 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 692 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
693 EXPECT_EQ(1U, GetReceivedGestureCount()); | 693 EXPECT_EQ(1U, GetReceivedGestureCount()); |
694 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 694 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
695 | 695 |
696 event = ObtainMotionEvent(event_time + kFiveMilliseconds, | 696 event = ObtainMotionEvent(event_time + kFiveMilliseconds, |
697 MotionEvent::ACTION_UP, | 697 MotionEvent::ACTION_UP, |
698 kFakeCoordX, | 698 kFakeCoordX, |
699 kFakeCoordY); | 699 kFakeCoordY); |
700 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 700 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
701 EXPECT_EQ(GESTURE_SINGLE_TAP_CONFIRMED, GetMostRecentGestureEventType()); | 701 EXPECT_EQ(GESTURE_TAP, GetMostRecentGestureEventType()); |
702 | 702 |
703 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, | 703 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 2, |
704 MotionEvent::ACTION_DOWN, | 704 MotionEvent::ACTION_DOWN, |
705 kFakeCoordX, | 705 kFakeCoordX, |
706 kFakeCoordY); | 706 kFakeCoordY); |
707 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 707 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
708 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 708 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
709 | 709 |
710 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 3, | 710 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 3, |
711 MotionEvent::ACTION_UP, | 711 MotionEvent::ACTION_UP, |
712 kFakeCoordX, | 712 kFakeCoordX, |
713 kFakeCoordY); | 713 kFakeCoordY); |
714 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 714 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
715 EXPECT_EQ(GESTURE_SINGLE_TAP_CONFIRMED, GetMostRecentGestureEventType()); | 715 EXPECT_EQ(GESTURE_TAP, GetMostRecentGestureEventType()); |
716 } | 716 } |
717 | 717 |
718 TEST_F(GestureProviderTest, NoDoubleTapDragZoomWhenDisabledOnPlatform) { | 718 TEST_F(GestureProviderTest, NoDoubleTapDragZoomWhenDisabledOnPlatform) { |
719 const base::TimeTicks down_time_1 = TimeTicks::Now(); | 719 const base::TimeTicks down_time_1 = TimeTicks::Now(); |
720 const base::TimeTicks down_time_2 = down_time_1 + kFiveMilliseconds * 20; | 720 const base::TimeTicks down_time_2 = down_time_1 + kFiveMilliseconds * 20; |
721 | 721 |
722 gesture_provider_->UpdateDoubleTapSupportForPlatform(false); | 722 gesture_provider_->SetDoubleTapSupportForPlatformEnabled(false); |
723 | 723 |
724 MockMotionEvent event = | 724 MockMotionEvent event = |
725 ObtainMotionEvent(down_time_1, MotionEvent::ACTION_DOWN); | 725 ObtainMotionEvent(down_time_1, MotionEvent::ACTION_DOWN); |
726 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 726 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
727 | 727 |
728 event = ObtainMotionEvent(down_time_1 + kFiveMilliseconds, | 728 event = ObtainMotionEvent(down_time_1 + kFiveMilliseconds, |
729 MotionEvent::ACTION_UP, | 729 MotionEvent::ACTION_UP, |
730 kFakeCoordX, | 730 kFakeCoordX, |
731 kFakeCoordY); | 731 kFakeCoordY); |
732 gesture_provider_->OnTouchEvent(event); | 732 gesture_provider_->OnTouchEvent(event); |
(...skipping 30 matching lines...) Expand all Loading... |
763 EXPECT_FALSE(HasReceivedGesture(GESTURE_PINCH_END)); | 763 EXPECT_FALSE(HasReceivedGesture(GESTURE_PINCH_END)); |
764 } | 764 } |
765 | 765 |
766 // Verify that double tap drag zoom feature is not invoked when the gesture | 766 // Verify that double tap drag zoom feature is not invoked when the gesture |
767 // handler is told to disable double tap gesture detection. | 767 // handler is told to disable double tap gesture detection. |
768 // The second tap sequence should be treated just as the first would be. | 768 // The second tap sequence should be treated just as the first would be. |
769 TEST_F(GestureProviderTest, NoDoubleTapDragZoomWhenDisabledOnPage) { | 769 TEST_F(GestureProviderTest, NoDoubleTapDragZoomWhenDisabledOnPage) { |
770 const base::TimeTicks down_time_1 = TimeTicks::Now(); | 770 const base::TimeTicks down_time_1 = TimeTicks::Now(); |
771 const base::TimeTicks down_time_2 = down_time_1 + kFiveMilliseconds * 20; | 771 const base::TimeTicks down_time_2 = down_time_1 + kFiveMilliseconds * 20; |
772 | 772 |
773 gesture_provider_->UpdateDoubleTapSupportForPage(false); | 773 gesture_provider_->SetDoubleTapSupportForPageEnabled(false); |
774 | 774 |
775 MockMotionEvent event = | 775 MockMotionEvent event = |
776 ObtainMotionEvent(down_time_1, MotionEvent::ACTION_DOWN); | 776 ObtainMotionEvent(down_time_1, MotionEvent::ACTION_DOWN); |
777 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 777 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
778 | 778 |
779 event = ObtainMotionEvent(down_time_1 + kFiveMilliseconds, | 779 event = ObtainMotionEvent(down_time_1 + kFiveMilliseconds, |
780 MotionEvent::ACTION_UP, | 780 MotionEvent::ACTION_UP, |
781 kFakeCoordX, | 781 kFakeCoordX, |
782 kFakeCoordY); | 782 kFakeCoordY); |
783 gesture_provider_->OnTouchEvent(event); | 783 gesture_provider_->OnTouchEvent(event); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 event = ObtainMotionEvent(down_time_2 + kFiveMilliseconds, | 833 event = ObtainMotionEvent(down_time_2 + kFiveMilliseconds, |
834 MotionEvent::ACTION_MOVE, | 834 MotionEvent::ACTION_MOVE, |
835 kFakeCoordX, | 835 kFakeCoordX, |
836 kFakeCoordY + 100); | 836 kFakeCoordY + 100); |
837 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 837 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
838 EXPECT_TRUE(HasReceivedGesture(GESTURE_SCROLL_BEGIN)); | 838 EXPECT_TRUE(HasReceivedGesture(GESTURE_SCROLL_BEGIN)); |
839 EXPECT_EQ(GESTURE_PINCH_BEGIN, GetMostRecentGestureEventType()); | 839 EXPECT_EQ(GESTURE_PINCH_BEGIN, GetMostRecentGestureEventType()); |
840 | 840 |
841 // Simulate setting a fixed page scale (or a mobile viewport); | 841 // Simulate setting a fixed page scale (or a mobile viewport); |
842 // this should not disrupt the current double-tap gesture. | 842 // this should not disrupt the current double-tap gesture. |
843 gesture_provider_->UpdateDoubleTapSupportForPage(false); | 843 gesture_provider_->SetDoubleTapSupportForPageEnabled(false); |
844 | 844 |
845 // Double tap zoom updates should continue. | 845 // Double tap zoom updates should continue. |
846 event = ObtainMotionEvent(down_time_2 + kFiveMilliseconds * 2, | 846 event = ObtainMotionEvent(down_time_2 + kFiveMilliseconds * 2, |
847 MotionEvent::ACTION_MOVE, | 847 MotionEvent::ACTION_MOVE, |
848 kFakeCoordX, | 848 kFakeCoordX, |
849 kFakeCoordY + 200); | 849 kFakeCoordY + 200); |
850 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 850 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
851 EXPECT_TRUE(HasReceivedGesture(GESTURE_SCROLL_UPDATE)); | 851 EXPECT_TRUE(HasReceivedGesture(GESTURE_SCROLL_UPDATE)); |
852 EXPECT_EQ(GESTURE_PINCH_UPDATE, GetMostRecentGestureEventType()); | 852 EXPECT_EQ(GESTURE_PINCH_UPDATE, GetMostRecentGestureEventType()); |
853 event = ObtainMotionEvent(down_time_2 + kFiveMilliseconds * 3, | 853 event = ObtainMotionEvent(down_time_2 + kFiveMilliseconds * 3, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 kFakeCoordY + 200); | 898 kFakeCoordY + 200); |
899 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 899 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
900 EXPECT_FALSE(HasReceivedGesture(GESTURE_PINCH_END)); | 900 EXPECT_FALSE(HasReceivedGesture(GESTURE_PINCH_END)); |
901 } | 901 } |
902 | 902 |
903 // Verify that pinch zoom sends the proper event sequence. | 903 // Verify that pinch zoom sends the proper event sequence. |
904 TEST_F(GestureProviderTest, PinchZoom) { | 904 TEST_F(GestureProviderTest, PinchZoom) { |
905 base::TimeTicks event_time = base::TimeTicks::Now(); | 905 base::TimeTicks event_time = base::TimeTicks::Now(); |
906 const int scaled_touch_slop = GetTouchSlop(); | 906 const int scaled_touch_slop = GetTouchSlop(); |
907 | 907 |
908 gesture_provider_->UpdateMultiTouchSupport(true); | 908 gesture_provider_->SetMultiTouchSupportEnabled(true); |
909 | 909 |
910 int secondary_coord_x = kFakeCoordX + 20 * scaled_touch_slop; | 910 int secondary_coord_x = kFakeCoordX + 20 * scaled_touch_slop; |
911 int secondary_coord_y = kFakeCoordY + 20 * scaled_touch_slop; | 911 int secondary_coord_y = kFakeCoordY + 20 * scaled_touch_slop; |
912 | 912 |
913 MockMotionEvent event = | 913 MockMotionEvent event = |
914 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); | 914 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); |
915 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 915 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
916 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 916 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
917 | 917 |
918 event = ObtainMotionEvent(event_time, | 918 event = ObtainMotionEvent(event_time, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 MotionEvent::ACTION_UP); | 1004 MotionEvent::ACTION_UP); |
1005 EXPECT_FALSE(gesture_provider_->OnTouchEvent(event)); | 1005 EXPECT_FALSE(gesture_provider_->OnTouchEvent(event)); |
1006 | 1006 |
1007 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 3, | 1007 event = ObtainMotionEvent(event_time + kFiveMilliseconds * 3, |
1008 MotionEvent::ACTION_DOWN); | 1008 MotionEvent::ACTION_DOWN); |
1009 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 1009 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
1010 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 1010 EXPECT_EQ(GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
1011 } | 1011 } |
1012 | 1012 |
1013 } // namespace ui | 1013 } // namespace ui |
OLD | NEW |