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

Unified Diff: ui/aura/gestures/gesture_recognizer_unittest.cc

Issue 252833005: Reland "GestureRecognizerTest tests both Aura and Unified Gesture Detectors." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix failing test. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/aura/test/aura_test_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/gestures/gesture_recognizer_unittest.cc
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc
index 4336d3baab5e0cab3c92018b7a290f660c0ca5be..5acc6ba516087fecb163d7e09a4f0a7eb1cc3b38 100644
--- a/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -96,8 +96,8 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
scroll_x_hint_(0),
scroll_y_hint_(0),
tap_count_(0),
- wait_until_event_(ui::ET_UNKNOWN) {
- }
+ flags_(0),
+ wait_until_event_(ui::ET_UNKNOWN) {}
virtual ~GestureEventConsumeDelegate() {}
@@ -137,6 +137,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
scroll_y_hint_ = 0;
tap_count_ = 0;
scale_ = 0;
+ flags_ = 0;
}
const std::vector<ui::EventType>& events() const { return events_; };
@@ -185,6 +186,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
float scale() const { return scale_; }
const gfx::Rect& bounding_box() const { return bounding_box_; }
int tap_count() const { return tap_count_; }
+ int flags() const { return flags_; }
void WaitUntilReceivedGesture(ui::EventType type) {
wait_until_event_ = type;
@@ -195,6 +197,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
virtual void OnGestureEvent(ui::GestureEvent* gesture) OVERRIDE {
events_.push_back(gesture->type());
bounding_box_ = gesture->details().bounding_box();
+ flags_ = gesture->flags();
switch (gesture->type()) {
case ui::ET_GESTURE_TAP:
tap_location_ = gesture->location();
@@ -265,6 +268,9 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
swipe_up_ = gesture->details().swipe_up();
swipe_down_ = gesture->details().swipe_down();
break;
+ case ui::ET_SCROLL_FLING_CANCEL:
+ // Only used in unified gesture detection.
+ break;
default:
NOTREACHED();
}
@@ -315,6 +321,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate {
float scale_;
gfx::Rect bounding_box_;
int tap_count_;
+ int flags_;
ui::EventType wait_until_event_;
@@ -528,7 +535,9 @@ class TimedEvents {
int simulated_now_;
public:
- TimedEvents() : simulated_now_(0) {
+ // Use a non-zero start time to pass DCHECKs which ensure events have had a
+ // time assigned.
+ TimedEvents() : simulated_now_(1) {
}
base::TimeDelta Now() {
@@ -666,13 +675,23 @@ class RemoveOnTouchCancelHandler : public TestEventHandler {
} // namespace
-class GestureRecognizerTest : public AuraTestBase {
+class GestureRecognizerTest : public AuraTestBase,
+ public ::testing::WithParamInterface<bool> {
public:
GestureRecognizerTest() {}
+ bool UsingUnifiedGR() {
+ return GetParam();
+ }
+
virtual void SetUp() OVERRIDE {
- CommandLine::ForCurrentProcess()->AppendSwitch(
- switches::kEnableScrollPrediction);
+ // TODO(tdresser): Once unified GR has landed, only run these tests once.
+ if (UsingUnifiedGR()) {
+ // TODO(tdresser): use unified GR once it's available.
+ // CommandLine::ForCurrentProcess()->AppendSwitch(
+ // switches::kUseUnifiedGestureDetector);
+ }
+
AuraTestBase::SetUp();
}
@@ -680,7 +699,7 @@ class GestureRecognizerTest : public AuraTestBase {
};
// Check that appropriate touch events generate tap gesture events.
-TEST_F(GestureRecognizerTest, GestureEventTap) {
+TEST_P(GestureRecognizerTest, GestureEventTap) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -731,7 +750,7 @@ TEST_F(GestureRecognizerTest, GestureEventTap) {
// Check that appropriate touch events generate tap gesture events
// when information about the touch radii are provided.
-TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
+TEST_P(GestureRecognizerTest, GestureEventTapRegion) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -971,7 +990,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
}
// Check that appropriate touch events generate scroll gesture events.
-TEST_F(GestureRecognizerTest, GestureEventScroll) {
+TEST_P(GestureRecognizerTest, GestureEventScroll) {
// We'll start by moving the touch point by (10.5, 10.5). We want 5 dips of
// that distance to be consumed by the slop, so we set the slop radius to
// sqrt(5 * 5 + 5 * 5).
@@ -1015,14 +1034,15 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
// be empty, since it's a single point and the radius for testing is zero.
EXPECT_TRUE(delegate->bounding_box().IsEmpty());
- // Move some more to generate a few more scroll updates.
- tes.SendScrollEvent(event_processor(), 91, 192, kTouchId, delegate.get());
+ // Move some more to generate a few more scroll updates. Make sure that we get
+ // out of the snap channel for the unified GR.
+ tes.SendScrollEvent(event_processor(), 20, 120, kTouchId, delegate.get());
EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE);
- EXPECT_FLOAT_EQ(-20.5, delegate->scroll_x());
- EXPECT_FLOAT_EQ(-19.5, delegate->scroll_y());
+ EXPECT_FLOAT_EQ(-91.5, delegate->scroll_x());
+ EXPECT_FLOAT_EQ(-91.5, delegate->scroll_y());
EXPECT_TRUE(delegate->bounding_box().IsEmpty());
- tes.SendScrollEvent(event_processor(), 121, 196, kTouchId, delegate.get());
+ tes.SendScrollEvent(event_processor(), 50, 124, kTouchId, delegate.get());
EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE);
EXPECT_EQ(30, delegate->scroll_x());
EXPECT_EQ(4, delegate->scroll_y());
@@ -1041,7 +1061,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
}
// Check that predicted scroll update positions are correct.
-TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) {
+TEST_P(GestureRecognizerTest, GestureEventScrollPrediction) {
const double prediction_interval = 0.03;
ui::GestureConfiguration::set_scroll_prediction_seconds(prediction_interval);
// We'll start by moving the touch point by (5, 5). We want all of that
@@ -1073,7 +1093,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) {
delegate->Reset();
// Get rid of touch slop.
- ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(101, 201),
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(111, 211),
kTouchId, tes.Now());
DispatchEventUsingWindowDispatcher(&move);
EXPECT_3_EVENTS(delegate->events(),
@@ -1116,7 +1136,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) {
}
// Check that the bounding box during a scroll event is correct.
-TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) {
+TEST_P(GestureRecognizerTest, GestureEventScrollBoundingBox) {
TimedEvents tes;
for (int radius = 1; radius <= 10; ++radius) {
ui::GestureConfiguration::set_default_radius(radius);
@@ -1173,7 +1193,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) {
// Check Scroll End Events report correct velocities
// if the user was on a horizontal rail
-TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) {
+TEST_P(GestureRecognizerTest, GestureEventHorizontalRailFling) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -1187,7 +1207,7 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) {
DispatchEventUsingWindowDispatcher(&press);
// Get rid of touch slop.
- ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(5, 0),
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 0),
kTouchId, tes.Now());
DispatchEventUsingWindowDispatcher(&move);
delegate->Reset();
@@ -1195,9 +1215,9 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) {
// Move the touch-point horizontally enough that it is considered a
// horizontal scroll.
- tes.SendScrollEvent(event_processor(), 25, 1, kTouchId, delegate.get());
- EXPECT_EQ(0, delegate->scroll_y());
- EXPECT_EQ(20, delegate->scroll_x());
+ tes.SendScrollEvent(event_processor(), 30, 1, kTouchId, delegate.get());
+ EXPECT_FLOAT_EQ(0, delegate->scroll_y());
+ EXPECT_FLOAT_EQ(20, delegate->scroll_x());
// Get a high x velocity, while still staying on the rail
tes.SendScrollEvents(event_processor(), 1, 1,
@@ -1218,7 +1238,7 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) {
// Check Scroll End Events report correct velocities
// if the user was on a vertical rail
-TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) {
+TEST_P(GestureRecognizerTest, GestureEventVerticalRailFling) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -1232,14 +1252,14 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) {
DispatchEventUsingWindowDispatcher(&press);
// Get rid of touch slop.
- ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(0, 5),
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(0, 10),
kTouchId, tes.Now());
DispatchEventUsingWindowDispatcher(&move);
delegate->Reset();
// Move the touch-point vertically enough that it is considered a
// vertical scroll.
- tes.SendScrollEvent(event_processor(), 1, 25, kTouchId, delegate.get());
+ tes.SendScrollEvent(event_processor(), 1, 30, kTouchId, delegate.get());
EXPECT_EQ(20, delegate->scroll_y());
EXPECT_EQ(0, delegate->scroll_x());
EXPECT_EQ(0, delegate->scroll_velocity_x());
@@ -1262,9 +1282,9 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) {
EXPECT_GT(delegate->velocity_y(), 0);
}
-// Check Scroll End Events reports zero velocities
-// if the user is not on a rail
-TEST_F(GestureRecognizerTest, GestureEventNonRailFling) {
+// Check Scroll End Events report non-zero velocities if the user is not on a
+// rail
+TEST_P(GestureRecognizerTest, GestureEventNonRailFling) {
ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(0);
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
@@ -1278,10 +1298,11 @@ TEST_F(GestureRecognizerTest, GestureEventNonRailFling) {
kTouchId, tes.Now());
DispatchEventUsingWindowDispatcher(&press);
- // Move the touch-point such that a non-rail scroll begins
- tes.SendScrollEvent(event_processor(), 20, 20, kTouchId, delegate.get());
- EXPECT_EQ(20, delegate->scroll_y());
- EXPECT_EQ(20, delegate->scroll_x());
+ // Move the touch-point such that a non-rail scroll begins, and we're outside
+ // the snap channel for the unified GR.
+ tes.SendScrollEvent(event_processor(), 50, 50, kTouchId, delegate.get());
+ EXPECT_EQ(50, delegate->scroll_y());
+ EXPECT_EQ(50, delegate->scroll_x());
tes.SendScrollEvents(event_processor(), 1, 1,
10, 100, kTouchId, 1,
@@ -1300,10 +1321,9 @@ TEST_F(GestureRecognizerTest, GestureEventNonRailFling) {
}
// Check that appropriate touch events generate long press events
-TEST_F(GestureRecognizerTest, GestureEventLongPress) {
+TEST_P(GestureRecognizerTest, GestureEventLongPress) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
- TimedEvents tes;
const int kWindowWidth = 123;
const int kWindowHeight = 45;
const int kTouchId = 2;
@@ -1318,8 +1338,10 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) {
ScopedGestureRecognizerSetter gr_setter(gesture_recognizer);
- ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
- kTouchId, tes.Now());
+ ui::TouchEvent press1(ui::ET_TOUCH_PRESSED,
+ gfx::Point(101, 201),
+ kTouchId,
+ ui::EventTimeForNow());
DispatchEventUsingWindowDispatcher(&press1);
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->begin());
@@ -1334,17 +1356,20 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) {
EXPECT_FALSE(delegate->tap_cancel());
delegate->Reset();
- ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
- kTouchId, tes.Now());
+ ui::TouchEvent release1(ui::ET_TOUCH_RELEASED,
+ gfx::Point(101, 201),
+ kTouchId,
+ ui::EventTimeForNow());
DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->long_press());
- // Note the tap down isn't cancelled until the release
+ // Note the tap cancel isn't dispatched until the release
EXPECT_TRUE(delegate->tap_cancel());
+ EXPECT_FALSE(delegate->tap());
}
// Check that scrolling cancels a long press
-TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) {
+TEST_P(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -1391,10 +1416,9 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) {
}
// Check that appropriate touch events generate long tap events
-TEST_F(GestureRecognizerTest, GestureEventLongTap) {
+TEST_P(GestureRecognizerTest, GestureEventLongTap) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
- TimedEvents tes;
const int kWindowWidth = 123;
const int kWindowHeight = 45;
const int kTouchId = 2;
@@ -1409,8 +1433,10 @@ TEST_F(GestureRecognizerTest, GestureEventLongTap) {
ScopedGestureRecognizerSetter gr_setter(gesture_recognizer);
- ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
- kTouchId, tes.Now());
+ ui::TouchEvent press1(ui::ET_TOUCH_PRESSED,
+ gfx::Point(101, 201),
+ kTouchId,
+ ui::EventTimeForNow());
DispatchEventUsingWindowDispatcher(&press1);
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->begin());
@@ -1425,18 +1451,26 @@ TEST_F(GestureRecognizerTest, GestureEventLongTap) {
EXPECT_FALSE(delegate->tap_cancel());
delegate->Reset();
- ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
- kTouchId, tes.Now());
+ ui::TouchEvent release1(ui::ET_TOUCH_RELEASED,
+ gfx::Point(101, 201),
+ kTouchId,
+ ui::EventTimeForNow());
DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->long_press());
EXPECT_TRUE(delegate->long_tap());
- // Note the tap down isn't cancelled until the release
+ // Note the tap cancel isn't dispatched until the release
EXPECT_TRUE(delegate->tap_cancel());
+ EXPECT_FALSE(delegate->tap());
}
// Check that second tap cancels a long press
-TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) {
+TEST_P(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) {
+ // TODO(tdresser): enable this test with unified GR once two finger tap is
+ // supported. See crbug.com/354396.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -1493,7 +1527,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) {
// Check that horizontal scroll gestures cause scrolls on horizontal rails.
// Also tests that horizontal rails can be broken.
-TEST_F(GestureRecognizerTest, GestureEventHorizontalRailScroll) {
+TEST_P(GestureRecognizerTest, GestureEventHorizontalRailScroll) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -1515,7 +1549,7 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailScroll) {
// Move the touch-point horizontally enough that it is considered a
// horizontal scroll.
- tes.SendScrollEvent(event_processor(), 25, 1, kTouchId, delegate.get());
+ tes.SendScrollEvent(event_processor(), 25, 0, kTouchId, delegate.get());
EXPECT_EQ(0, delegate->scroll_y());
EXPECT_EQ(20, delegate->scroll_x());
@@ -1543,7 +1577,7 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailScroll) {
// Check that vertical scroll gestures cause scrolls on vertical rails.
// Also tests that vertical rails can be broken.
-TEST_F(GestureRecognizerTest, GestureEventVerticalRailScroll) {
+TEST_P(GestureRecognizerTest, GestureEventVerticalRailScroll) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -1564,7 +1598,7 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailScroll) {
// Move the touch-point vertically enough that it is considered a
// vertical scroll.
- tes.SendScrollEvent(event_processor(), 1, 25, kTouchId, delegate.get());
+ tes.SendScrollEvent(event_processor(), 0, 25, kTouchId, delegate.get());
EXPECT_EQ(0, delegate->scroll_x());
EXPECT_EQ(20, delegate->scroll_y());
@@ -1591,7 +1625,7 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailScroll) {
EXPECT_EQ(5, delegate->scroll_y());
}
-TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
+TEST_P(GestureRecognizerTest, GestureTapFollowedByScroll) {
// We'll start by moving the touch point by (5, 5). We want all of that
// distance to be consumed by the slop, so we set the slop radius to
// sqrt(5 * 5 + 5 * 5).
@@ -1647,14 +1681,14 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
EXPECT_FALSE(delegate->scroll_end());
// Get rid of touch slop.
- ui::TouchEvent move_remove_slop(ui::ET_TOUCH_MOVED, gfx::Point(106, 206),
+ ui::TouchEvent move_remove_slop(ui::ET_TOUCH_MOVED, gfx::Point(116, 216),
kTouchId, tes.Now());
DispatchEventUsingWindowDispatcher(&move_remove_slop);
EXPECT_TRUE(delegate->tap_cancel());
EXPECT_TRUE(delegate->scroll_begin());
- EXPECT_FALSE(delegate->scroll_update());
- EXPECT_EQ(5, delegate->scroll_x_hint());
- EXPECT_EQ(5, delegate->scroll_y_hint());
+ EXPECT_TRUE(delegate->scroll_update());
+ EXPECT_EQ(15, delegate->scroll_x_hint());
+ EXPECT_EQ(15, delegate->scroll_y_hint());
delegate->Reset();
@@ -1672,8 +1706,8 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_TRUE(delegate->scroll_update());
EXPECT_FALSE(delegate->scroll_end());
- EXPECT_EQ(29, delegate->scroll_x());
- EXPECT_EQ(29, delegate->scroll_y());
+ EXPECT_EQ(19, delegate->scroll_x());
+ EXPECT_EQ(19, delegate->scroll_y());
// Move some more to generate a few more scroll updates.
delegate->Reset();
@@ -1718,7 +1752,11 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
EXPECT_TRUE(delegate->fling());
}
-TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
+TEST_P(GestureRecognizerTest, AsynchronousGestureRecognition) {
+ // TODO(tdresser): enable this test with unified GR once two finger tap is
+ // supported. See crbug.com/354396.
+ if (UsingUnifiedGR())
+ return;
scoped_ptr<QueueTouchEventDelegate> queued_delegate(
new QueueTouchEventDelegate(host()->dispatcher()));
const int kWindowWidth = 123;
@@ -1910,7 +1948,12 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
}
// Check that appropriate touch events generate pinch gesture events.
-TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
+TEST_P(GestureRecognizerTest, GestureEventPinchFromScroll) {
+ // Disabled for unified GR due to differences in when pinch begin is sent. The
+ // Aura GR sends it earlier than is necessary.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -1995,7 +2038,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
EXPECT_TRUE(delegate->bounding_box().IsEmpty());
}
-TEST_F(GestureRecognizerTest, GestureEventPinchFromScrollFromPinch) {
+TEST_P(GestureRecognizerTest, GestureEventPinchFromScrollFromPinch) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -2043,16 +2086,20 @@ scoped_ptr<GestureEventConsumeDelegate> delegate(
DispatchEventUsingWindowDispatcher(&press3);
// Now the touch points are close. So we will go into two finger tap.
// Move the touch-point enough to break two-finger-tap and enter pinch.
- ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(101, 202),
+ ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(101, 50),
kTouchId1, tes.Now());
DispatchEventUsingWindowDispatcher(&move2);
EXPECT_TRUE(delegate->pinch_begin());
- tes.SendScrollEvent(event_processor(), 130, 230, kTouchId1, delegate.get());
+ tes.SendScrollEvent(event_processor(), 350, 350, kTouchId1, delegate.get());
EXPECT_TRUE(delegate->pinch_update());
}
-TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
+TEST_P(GestureRecognizerTest, GestureEventPinchFromTap) {
+ // TODO(tdresser): enable this test with unified GR once two finger tap.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -2126,7 +2173,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
EXPECT_TRUE(delegate->bounding_box().IsEmpty());
}
-TEST_F(GestureRecognizerTest, GestureEventIgnoresDisconnectedEvents) {
+TEST_P(GestureRecognizerTest, GestureEventIgnoresDisconnectedEvents) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -2140,7 +2187,7 @@ TEST_F(GestureRecognizerTest, GestureEventIgnoresDisconnectedEvents) {
// Check that a touch is locked to the window of the closest current touch
// within max_separation_for_gesture_touches_in_pixels
-TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) {
+TEST_P(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) {
ui::GestureRecognizer* gesture_recognizer = new ui::GestureRecognizerImpl();
TimedEvents tes;
ScopedGestureRecognizerSetter gr_setter(gesture_recognizer);
@@ -2226,7 +2273,7 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) {
// Check that a touch's target will not be effected by a touch on a different
// screen.
-TEST_F(GestureRecognizerTest, GestureEventTouchLockIgnoresOtherScreens) {
+TEST_P(GestureRecognizerTest, GestureEventTouchLockIgnoresOtherScreens) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
gfx::Rect bounds(0, 0, 10, 10);
@@ -2256,7 +2303,11 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockIgnoresOtherScreens) {
// Check that touch events outside the root window are still handled
// by the root window's gesture sequence.
-TEST_F(GestureRecognizerTest, GestureEventOutsideRootWindowTap) {
+TEST_P(GestureRecognizerTest, GestureEventOutsideRootWindowTap) {
+ // TODO(tdresser): write a version of this test for the unified GR.
+ if (UsingUnifiedGR())
+ return;
+
TestGestureRecognizer* gesture_recognizer =
new TestGestureRecognizer();
TimedEvents tes;
@@ -2285,7 +2336,7 @@ TEST_F(GestureRecognizerTest, GestureEventOutsideRootWindowTap) {
EXPECT_EQ(2, root_window_gesture_sequence->point_count());
}
-TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) {
+TEST_P(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) {
scoped_ptr<QueueTouchEventDelegate> delegate(
new QueueTouchEventDelegate(host()->dispatcher()));
TimedEvents tes;
@@ -2312,7 +2363,12 @@ TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) {
EXPECT_TRUE(delegate->tap_cancel());
}
-TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) {
+TEST_P(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) {
+ // Disabled for unified GR due to differences in when pinch begin is sent. The
+ // Aura GR sends it earlier than is necessary.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<QueueTouchEventDelegate> delegate(
new QueueTouchEventDelegate(host()->dispatcher()));
TimedEvents tes;
@@ -2406,7 +2462,7 @@ TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) {
EXPECT_TRUE(delegate->end());
}
-TEST_F(GestureRecognizerTest, GestureEndLocation) {
+TEST_P(GestureRecognizerTest, GestureEndLocation) {
GestureEventConsumeDelegate delegate;
scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
&delegate, -1234, gfx::Rect(10, 10, 300, 300), root_window()));
@@ -2424,7 +2480,7 @@ TEST_F(GestureRecognizerTest, GestureEndLocation) {
delegate.gesture_end_location().ToString());
}
-TEST_F(GestureRecognizerTest, CaptureSendsGestureEnd) {
+TEST_P(GestureRecognizerTest, CaptureSendsGestureEnd) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TestGestureRecognizer* gesture_recognizer =
@@ -2453,7 +2509,7 @@ TEST_F(GestureRecognizerTest, CaptureSendsGestureEnd) {
// Check that previous touch actions that are completely finished (either
// released or cancelled), do not receive extra synthetic cancels upon change of
// capture.
-TEST_F(GestureRecognizerTest, CaptureDoesNotCancelFinishedTouches) {
+TEST_P(GestureRecognizerTest, CaptureDoesNotCancelFinishedTouches) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
scoped_ptr<TestEventHandler> handler(new TestEventHandler);
@@ -2506,7 +2562,8 @@ TEST_F(GestureRecognizerTest, CaptureDoesNotCancelFinishedTouches) {
root_window()->RemovePreTargetHandler(handler.get());
}
-TEST_F(GestureRecognizerTest, PressDoesNotCrash) {
+// Tests that a press with the same touch id as an existing touch is ignored.
+TEST_P(GestureRecognizerTest, PressDoesNotCrash) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TestGestureRecognizer* gesture_recognizer =
@@ -2535,7 +2592,12 @@ TEST_F(GestureRecognizerTest, PressDoesNotCrash) {
EXPECT_FALSE(delegate->scroll_begin());
}
-TEST_F(GestureRecognizerTest, TwoFingerTap) {
+TEST_P(GestureRecognizerTest, TwoFingerTap) {
+ // TODO(tdresser): enable this test with unified GR once two finger tap is
+ // supported. See crbug.com/354396.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
const int kWindowWidth = 123;
@@ -2623,7 +2685,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
EXPECT_FALSE(delegate->two_finger_tap());
}
-TEST_F(GestureRecognizerTest, TwoFingerTapExpired) {
+TEST_P(GestureRecognizerTest, TwoFingerTapExpired) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
const int kWindowWidth = 123;
@@ -2664,7 +2726,12 @@ TEST_F(GestureRecognizerTest, TwoFingerTapExpired) {
EXPECT_FALSE(delegate->two_finger_tap());
}
-TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) {
+TEST_P(GestureRecognizerTest, TwoFingerTapChangesToPinch) {
+ // TODO(tdresser): enable this test with unified GR once two finger tap is
+ // supported. See crbug.com/354396.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
const int kWindowWidth = 123;
@@ -2736,7 +2803,12 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) {
}
}
-TEST_F(GestureRecognizerTest, NoTwoFingerTapWhenFirstFingerHasScrolled) {
+TEST_P(GestureRecognizerTest, NoTwoFingerTapWhenFirstFingerHasScrolled) {
+ // Disabled for unified GR due to differences in when pinch begin is sent. The
+ // Aura GR sends it earlier than is necessary.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
const int kWindowWidth = 123;
@@ -2773,7 +2845,7 @@ TEST_F(GestureRecognizerTest, NoTwoFingerTapWhenFirstFingerHasScrolled) {
EXPECT_TRUE(delegate->pinch_end());
}
-TEST_F(GestureRecognizerTest, MultiFingerSwipe) {
+TEST_P(GestureRecognizerTest, MultiFingerSwipe) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
const int kWindowWidth = 123;
@@ -2794,30 +2866,33 @@ TEST_F(GestureRecognizerTest, MultiFingerSwipe) {
aura::test::EventGenerator generator(root_window(), window.get());
+ // The unified gesture recognizer assumes a finger has stopped if it hasn't
+ // moved for too long. See ui/events/gesture_detection/velocity_tracker.cc's
+ // kAssumePointerStoppedTimeMs.
for (int count = 2; count <= kTouchPoints; ++count) {
generator.GestureMultiFingerScroll(
- count, points, 1000, kSteps, 0, -11 * kSteps);
+ count, points, 10, kSteps, 0, -11 * kSteps);
EXPECT_TRUE(delegate->swipe_up());
delegate->Reset();
generator.GestureMultiFingerScroll(
- count, points, 1000, kSteps, 0, 11 * kSteps);
+ count, points, 10, kSteps, 0, 11 * kSteps);
EXPECT_TRUE(delegate->swipe_down());
delegate->Reset();
generator.GestureMultiFingerScroll(
- count, points, 1000, kSteps, -11 * kSteps, 0);
+ count, points, 10, kSteps, -11 * kSteps, 0);
EXPECT_TRUE(delegate->swipe_left());
delegate->Reset();
generator.GestureMultiFingerScroll(
- count, points, 1000, kSteps, 11 * kSteps, 0);
+ count, points, 10, kSteps, 11 * kSteps, 0);
EXPECT_TRUE(delegate->swipe_right());
delegate->Reset();
}
}
-TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) {
+TEST_P(GestureRecognizerTest, TwoFingerTapCancelled) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
const int kWindowWidth = 123;
@@ -2891,7 +2966,13 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) {
}
}
-TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) {
+TEST_P(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) {
+ // Disabled for unified GR due to differences in when scroll update is
+ // sent. The Aura GR will never send a ScrollUpdate with a ScrollBegin, but
+ // the unified GR will.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
const int kWindowWidth = 523;
@@ -2948,7 +3029,7 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) {
// Verifies if a window is the target of multiple touch-ids and we hide the
// window everything is cleaned up correctly.
-TEST_F(GestureRecognizerTest, FlushAllOnHide) {
+TEST_P(GestureRecognizerTest, FlushAllOnHide) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
gfx::Rect bounds(0, 0, 200, 200);
@@ -2971,7 +3052,11 @@ TEST_F(GestureRecognizerTest, FlushAllOnHide) {
ui::GestureRecognizer::Get()->GetTouchLockedTarget(press2));
}
-TEST_F(GestureRecognizerTest, LongPressTimerStopsOnPreventDefaultedTouchMoves) {
+TEST_P(GestureRecognizerTest, LongPressTimerStopsOnPreventDefaultedTouchMoves) {
+ // TODO(tdresser): write a version of this test for the unified GR.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<QueueTouchEventDelegate> delegate(
new QueueTouchEventDelegate(host()->dispatcher()));
const int kTouchId = 2;
@@ -3031,7 +3116,7 @@ class ConsumesTouchMovesDelegate : public GestureEventConsumeDelegate {
// Same as GestureEventScroll, but tests that the behavior is the same
// even if all the touch-move events are consumed.
-TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
+TEST_P(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
scoped_ptr<ConsumesTouchMovesDelegate> delegate(
new ConsumesTouchMovesDelegate());
const int kWindowWidth = 123;
@@ -3083,7 +3168,12 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
}
// Tests the behavior of 2F scroll when all the touch-move events are consumed.
-TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) {
+TEST_P(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) {
+ // TODO(tdresser): enable this test with unified GR once two finger tap is
+ // supported. See crbug.com/354396.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<ConsumesTouchMovesDelegate> delegate(
new ConsumesTouchMovesDelegate());
const int kWindowWidth = 123;
@@ -3190,7 +3280,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) {
// Like as GestureEventTouchMoveConsumed but tests the different behavior
// depending on whether the events were consumed before or after the scroll
// started.
-TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
+TEST_P(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
scoped_ptr<ConsumesTouchMovesDelegate> delegate(
new ConsumesTouchMovesDelegate());
const int kWindowWidth = 123;
@@ -3284,7 +3374,12 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
}
// Check that appropriate touch events generate double tap gesture events.
-TEST_F(GestureRecognizerTest, GestureEventDoubleTap) {
+TEST_P(GestureRecognizerTest, GestureEventDoubleTap) {
+ // TODO(tdresser): enable this test with unified GR once double / triple tap
+ // gestures work. See crbug.com/357270.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
const int kWindowWidth = 123;
@@ -3325,7 +3420,12 @@ TEST_F(GestureRecognizerTest, GestureEventDoubleTap) {
}
// Check that appropriate touch events generate triple tap gesture events.
-TEST_F(GestureRecognizerTest, GestureEventTripleTap) {
+TEST_P(GestureRecognizerTest, GestureEventTripleTap) {
+ // TODO(tdresser): enable this test with unified GR once double / triple tap
+ // gestures work. See crbug.com/357270.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
const int kWindowWidth = 123;
@@ -3380,7 +3480,7 @@ TEST_F(GestureRecognizerTest, GestureEventTripleTap) {
}
// Check that we don't get a double tap when the two taps are far apart.
-TEST_F(GestureRecognizerTest, TwoTapsFarApart) {
+TEST_P(GestureRecognizerTest, TwoTapsFarApart) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
const int kWindowWidth = 123;
@@ -3422,7 +3522,7 @@ TEST_F(GestureRecognizerTest, TwoTapsFarApart) {
// Check that we don't get a double tap when the two taps have a long enough
// delay in between.
-TEST_F(GestureRecognizerTest, TwoTapsWithDelayBetween) {
+TEST_P(GestureRecognizerTest, TwoTapsWithDelayBetween) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
const int kWindowWidth = 123;
@@ -3465,7 +3565,12 @@ TEST_F(GestureRecognizerTest, TwoTapsWithDelayBetween) {
// Checks that if the bounding-box of a gesture changes because of change in
// radius of a touch-point, and not because of change in position, then there
// are not gesture events from that.
-TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) {
+TEST_P(GestureRecognizerTest, BoundingBoxRadiusChange) {
+ // TODO(tdresser): enable this test with unified GR when (if?) bounding box
+ // behavior is unified.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
const int kWindowWidth = 234;
@@ -3519,7 +3624,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) {
// Checks that slow scrolls deliver the correct deltas.
// In particular, fix for http;//crbug.com/150573.
-TEST_F(GestureRecognizerTest, NoDriftInScroll) {
+TEST_P(GestureRecognizerTest, NoDriftInScroll) {
ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(3);
ui::GestureConfiguration::set_min_scroll_delta_squared(9);
scoped_ptr<GestureEventConsumeDelegate> delegate(
@@ -3577,7 +3682,7 @@ TEST_F(GestureRecognizerTest, NoDriftInScroll) {
// Ensure that move events which are preventDefaulted will cause a tap
// cancel gesture event to be fired if the move would normally cause a
// scroll. See bug http://crbug.com/146397.
-TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveCanFireTapCancel) {
+TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMoveCanFireTapCancel) {
scoped_ptr<ConsumesTouchMovesDelegate> delegate(
new ConsumesTouchMovesDelegate());
const int kTouchId = 5;
@@ -3607,7 +3712,7 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveCanFireTapCancel) {
EXPECT_FALSE(delegate->scroll_end());
}
-TEST_F(GestureRecognizerTest,
+TEST_P(GestureRecognizerTest,
TransferEventDispatchesTouchCancel) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
@@ -3650,7 +3755,7 @@ TEST_F(GestureRecognizerTest,
}
// Check that appropriate touch events generate show press events
-TEST_F(GestureRecognizerTest, GestureEventShowPress) {
+TEST_P(GestureRecognizerTest, GestureEventShowPress) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -3689,12 +3794,13 @@ TEST_F(GestureRecognizerTest, GestureEventShowPress) {
DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->long_press());
- // Note the tap down isn't cancelled until the release
- EXPECT_TRUE(delegate->tap_cancel());
+ // Note the tap isn't dispatched until the release
+ EXPECT_FALSE(delegate->tap_cancel());
+ EXPECT_TRUE(delegate->tap());
}
// Check that scrolling cancels a show press
-TEST_F(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) {
+TEST_P(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -3741,7 +3847,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) {
}
// Test that show press events are sent immediately on tap
-TEST_F(GestureRecognizerTest, GestureEventShowPressSentOnTap) {
+TEST_P(GestureRecognizerTest, GestureEventShowPressSentOnTap) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TimedEvents tes;
@@ -3773,7 +3879,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressSentOnTap) {
}
// Test that consuming the first move touch event prevents a scroll.
-TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveScrollTest) {
+TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMoveScrollTest) {
scoped_ptr<QueueTouchEventDelegate> delegate(
new QueueTouchEventDelegate(host()->dispatcher()));
TimedEvents tes;
@@ -3787,7 +3893,10 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveScrollTest) {
DispatchEventUsingWindowDispatcher(&press);
delegate->ReceivedAck();
- ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(2, 2),
+ // A touch move within the slop region is never consumed in web contents. The
+ // unified GR won't prevent scroll if a touch move within the slop region is
+ // consumed, so make sure this touch move exceeds the slop region.
+ ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(10, 10),
kTouchId, tes.Now());
DispatchEventUsingWindowDispatcher(&move1);
delegate->ReceivedAckPreventDefaulted();
@@ -3803,7 +3912,12 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveScrollTest) {
// Test that consuming the first touch move event of a touch point doesn't
// prevent pinching once an additional touch has been pressed.
-TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMovePinchTest) {
+TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMovePinchTest) {
+ // Consuming moves within the touch slop and the the disposition handling of
+ // pinch events behave differently between the Unified GR and the Aura GR.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<QueueTouchEventDelegate> delegate(
new QueueTouchEventDelegate(host()->dispatcher()));
TimedEvents tes;
@@ -3860,7 +3974,7 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMovePinchTest) {
}
// Test that consuming the first move touch doesn't prevent a tap.
-TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveTapTest) {
+TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMoveTapTest) {
scoped_ptr<QueueTouchEventDelegate> delegate(
new QueueTouchEventDelegate(host()->dispatcher()));
TimedEvents tes;
@@ -3888,7 +4002,7 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveTapTest) {
}
// Test that consuming the first move touch doesn't prevent a long press.
-TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveLongPressTest) {
+TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMoveLongPressTest) {
scoped_ptr<QueueTouchEventDelegate> delegate(
new QueueTouchEventDelegate(host()->dispatcher()));
TimedEvents tes;
@@ -3922,7 +4036,11 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveLongPressTest) {
}
// Tests that the deltas are correct when leaving the slop region very slowly.
-TEST_F(GestureRecognizerTest, TestExceedingSlopSlowly) {
+TEST_P(GestureRecognizerTest, TestExceedingSlopSlowly) {
+ // Disabled for unified GR due to subtle differences in touch slop handling.
+ if (UsingUnifiedGR())
+ return;
+
ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(3);
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
@@ -3980,7 +4098,7 @@ TEST_F(GestureRecognizerTest, TestExceedingSlopSlowly) {
delegate->Reset();
}
-TEST_F(GestureRecognizerTest, ScrollAlternatelyConsumedTest) {
+TEST_P(GestureRecognizerTest, ScrollAlternatelyConsumedTest) {
scoped_ptr<QueueTouchEventDelegate> delegate(
new QueueTouchEventDelegate(host()->dispatcher()));
TimedEvents tes;
@@ -4039,7 +4157,13 @@ TEST_F(GestureRecognizerTest, ScrollAlternatelyConsumedTest) {
}
}
-TEST_F(GestureRecognizerTest, PinchAlternatelyConsumedTest) {
+TEST_P(GestureRecognizerTest, PinchAlternatelyConsumedTest) {
+ // Disabled for unified GR due to differences in when scroll update is
+ // sent. The Aura GR will never send a ScrollUpdate with a ScrollBegin, but
+ // the unified GR will.
+ if (UsingUnifiedGR())
+ return;
+
scoped_ptr<QueueTouchEventDelegate> delegate(
new QueueTouchEventDelegate(host()->dispatcher()));
TimedEvents tes;
@@ -4123,5 +4247,38 @@ TEST_F(GestureRecognizerTest, PinchAlternatelyConsumedTest) {
}
}
+// Test that touch event flags are passed through to the gesture event.
+TEST_P(GestureRecognizerTest, GestureEventFlagsPassedFromTouchEvent) {
+ scoped_ptr<GestureEventConsumeDelegate> delegate(
+ new GestureEventConsumeDelegate());
+ TimedEvents tes;
+ const int kWindowWidth = 123;
+ const int kWindowHeight = 45;
+ const int kTouchId = 6;
+ gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight);
+ scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
+ delegate.get(), -1234, bounds, root_window()));
+
+ delegate->Reset();
+
+ ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
+ kTouchId, tes.Now());
+ DispatchEventUsingWindowDispatcher(&press1);
+ EXPECT_TRUE(delegate->tap_down());
+
+ int default_flags = delegate->flags();
+
+ ui::TouchEvent move1(
+ ui::ET_TOUCH_MOVED, gfx::Point(397, 149), kTouchId, tes.LeapForward(50));
+ move1.set_flags(992);
+
+ DispatchEventUsingWindowDispatcher(&move1);
+ EXPECT_NE(default_flags, delegate->flags());
+}
+
+INSTANTIATE_TEST_CASE_P(GestureRecognizer,
+ GestureRecognizerTest,
+ ::testing::Bool());
+
} // namespace test
} // namespace aura
« no previous file with comments | « no previous file | ui/aura/test/aura_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698