| 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" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 sConfig.gesture_detector_config.longpress_timeout = kOneMicrosecond; | 38 sConfig.gesture_detector_config.longpress_timeout = kOneMicrosecond; |
| 39 | 39 |
| 40 // A valid doubletap timeout should always be non-zero. The value is used not | 40 // A valid doubletap timeout should always be non-zero. The value is used not |
| 41 // only to trigger the timeout that confirms the tap event, but also to gate | 41 // only to trigger the timeout that confirms the tap event, but also to gate |
| 42 // whether the second tap is in fact a double-tap (using a strict inequality | 42 // whether the second tap is in fact a double-tap (using a strict inequality |
| 43 // between times for the first up and the second down events). We use 4 | 43 // between times for the first up and the second down events). We use 4 |
| 44 // microseconds simply to allow several intermediate events to occur before | 44 // microseconds simply to allow several intermediate events to occur before |
| 45 // the second tap at microsecond intervals. | 45 // the second tap at microsecond intervals. |
| 46 sConfig.gesture_detector_config.double_tap_timeout = kOneMicrosecond * 4; | 46 sConfig.gesture_detector_config.double_tap_timeout = kOneMicrosecond * 4; |
| 47 sConfig.gesture_detector_config.double_tap_min_time = kOneMicrosecond * 2; | 47 sConfig.gesture_detector_config.double_tap_min_time = kOneMicrosecond * 2; |
| 48 | |
| 49 sConfig.scale_gesture_detector_config.gesture_detector_config = | |
| 50 sConfig.gesture_detector_config; | |
| 51 return sConfig; | 48 return sConfig; |
| 52 } | 49 } |
| 53 | 50 |
| 54 gfx::RectF BoundsForSingleMockTouchAtLocation(float x, float y) { | 51 gfx::RectF BoundsForSingleMockTouchAtLocation(float x, float y) { |
| 55 float diameter = MockMotionEvent::TOUCH_MAJOR; | 52 float diameter = MockMotionEvent::TOUCH_MAJOR; |
| 56 return gfx::RectF(x - diameter / 2, y - diameter / 2, diameter, diameter); | 53 return gfx::RectF(x - diameter / 2, y - diameter / 2, diameter, diameter); |
| 57 } | 54 } |
| 58 | 55 |
| 59 } // namespace | 56 } // namespace |
| 60 | 57 |
| (...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2424 EXPECT_EQ(ET_GESTURE_TAP, GetMostRecentGestureEventType()); | 2421 EXPECT_EQ(ET_GESTURE_TAP, GetMostRecentGestureEventType()); |
| 2425 EXPECT_EQ(MotionEvent::TOOL_TYPE_ERASER, | 2422 EXPECT_EQ(MotionEvent::TOOL_TYPE_ERASER, |
| 2426 GetMostRecentGestureEvent().primary_tool_type); | 2423 GetMostRecentGestureEvent().primary_tool_type); |
| 2427 EXPECT_EQ(2.f * kMaxGestureBoundsLength, | 2424 EXPECT_EQ(2.f * kMaxGestureBoundsLength, |
| 2428 GetMostRecentGestureEvent().details.bounding_box_f().width()); | 2425 GetMostRecentGestureEvent().details.bounding_box_f().width()); |
| 2429 EXPECT_EQ(2.f * kMaxGestureBoundsLength, | 2426 EXPECT_EQ(2.f * kMaxGestureBoundsLength, |
| 2430 GetMostRecentGestureEvent().details.bounding_box_f().height()); | 2427 GetMostRecentGestureEvent().details.bounding_box_f().height()); |
| 2431 } | 2428 } |
| 2432 | 2429 |
| 2433 } // namespace ui | 2430 } // namespace ui |
| OLD | NEW |