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

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

Issue 147203004: aura: Remove event-dispatch methods from WindowTreeHostDelegate interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win Created 6 years, 11 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 | « mojo/examples/launcher/launcher.cc ('k') | ui/aura/remote_root_window_host_win.h » ('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 1754e713a418352108b52881561c55d4af29c1e9..76b9b21dbafb27276ff9a7c149d488908c329e3b 100644
--- a/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -596,7 +596,8 @@ class TimedEvents {
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::PointF(x, y),
touch_id,
base::TimeDelta::FromMilliseconds(simulated_now_));
- root_window->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ ui::EventDispatchDetails details = root_window->OnEventFromSource(&move);
+ ASSERT_FALSE(details.dispatcher_destroyed);
simulated_now_ += time_step;
}
}
@@ -610,7 +611,8 @@ class TimedEvents {
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::PointF(x, y),
touch_id,
base::TimeDelta::FromMilliseconds(simulated_now_));
- root_window->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ ui::EventDispatchDetails details = root_window->OnEventFromSource(&move);
+ ASSERT_FALSE(details.dispatcher_destroyed);
simulated_now_++;
}
};
@@ -724,7 +726,7 @@ TEST_F(GestureRecognizerTest, GestureEventTap) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->show_press());
EXPECT_TRUE(delegate->tap_down());
@@ -746,7 +748,7 @@ TEST_F(GestureRecognizerTest, GestureEventTap) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -779,7 +781,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.Now());
press.set_radius_x(5);
press.set_radius_y(12);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -797,7 +799,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
release.set_radius_x(5);
release.set_radius_y(12);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -822,7 +824,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.Now());
press.set_radius_x(8);
press.set_radius_y(14);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -838,7 +840,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
release.set_radius_x(20);
release.set_radius_y(13);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -863,7 +865,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.Now());
press.set_radius_x(6);
press.set_radius_y(10);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -879,7 +881,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.LeapForward(50));
move.set_radius_x(8);
move.set_radius_y(12);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -895,7 +897,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
release.set_radius_x(4);
release.set_radius_y(8);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -920,7 +922,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.Now());
press.set_radius_x(7);
press.set_radius_y(10);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -935,7 +937,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.LeapForward(50));
move.set_radius_x(13);
move.set_radius_y(12);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -950,7 +952,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.LeapForward(50));
move1.set_radius_x(16);
move1.set_radius_y(16);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move1);
+ DispatchEventUsingWindowDispatcher(&move1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -965,7 +967,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.LeapForward(50));
move2.set_radius_x(14);
move2.set_radius_y(10);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+ DispatchEventUsingWindowDispatcher(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -981,7 +983,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
release.set_radius_x(8);
release.set_radius_y(9);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1020,7 +1022,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_BEGIN,
ui::ET_GESTURE_TAP_DOWN);
@@ -1062,7 +1064,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId,
tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_SCROLL_FLING_START,
ui::ET_GESTURE_END);
@@ -1095,7 +1097,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) {
gfx::Vector2dF total_scroll;
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(96, 196),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_BEGIN,
ui::ET_GESTURE_TAP_DOWN);
@@ -1104,7 +1106,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) {
// Get rid of touch slop.
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
EXPECT_3_EVENTS(delegate->events(),
ui::ET_GESTURE_TAP_CANCEL,
ui::ET_GESTURE_SCROLL_BEGIN,
@@ -1155,7 +1157,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId,
tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
}
// Check that the bounding box during a scroll event is correct.
@@ -1179,7 +1181,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) {
gfx::Point(kPositionX, kPositionY),
kTouchId,
tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_EQ(gfx::Rect(kPositionX - radius,
kPositionY - radius,
radius * 2,
@@ -1204,7 +1206,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) {
kPositionY + kScrollAmount),
kTouchId, press.time_stamp() +
base::TimeDelta::FromMilliseconds(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_EQ(gfx::Rect(kPositionX + kScrollAmount - radius,
kPositionY + kScrollAmount - radius,
radius * 2,
@@ -1227,12 +1229,12 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
// Get rid of touch slop.
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(5, 0),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
delegate->Reset();
@@ -1257,7 +1259,7 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_TRUE(delegate->fling());
EXPECT_FALSE(delegate->scroll_end());
@@ -1278,12 +1280,12 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
// Get rid of touch slop.
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(0, 5),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
delegate->Reset();
// Move the touch-point vertically enough that it is considered a
@@ -1307,7 +1309,7 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 206),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_TRUE(delegate->fling());
EXPECT_FALSE(delegate->scroll_end());
@@ -1329,7 +1331,7 @@ TEST_F(GestureRecognizerTest, GestureEventNonRailFling) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
// Move the touch-point such that a non-rail scroll begins
tes.SendScrollEvent(dispatcher(), 20, 20, kTouchId, delegate.get());
@@ -1344,7 +1346,7 @@ TEST_F(GestureRecognizerTest, GestureEventNonRailFling) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_TRUE(delegate->fling());
EXPECT_FALSE(delegate->scroll_end());
@@ -1373,7 +1375,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->begin());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1390,7 +1392,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->long_press());
// Note the tap down isn't cancelled until the release
@@ -1422,7 +1424,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
EXPECT_TRUE(delegate->tap_down());
// We haven't pressed long enough for a long press to occur
@@ -1439,7 +1441,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(10));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->long_press());
EXPECT_FALSE(delegate->tap_cancel());
}
@@ -1465,7 +1467,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongTap) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->begin());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1482,7 +1484,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongTap) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->long_press());
EXPECT_TRUE(delegate->long_tap());
@@ -1515,7 +1517,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->begin());
@@ -1526,7 +1528,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) {
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap.
EXPECT_TRUE(delegate->tap_cancel());
EXPECT_TRUE(delegate->begin());
@@ -1540,7 +1542,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->long_press());
EXPECT_TRUE(delegate->two_finger_tap());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1559,13 +1561,13 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailScroll) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
// Get rid of touch slop.
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(5, 0),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
delegate->Reset();
// Move the touch-point horizontally enough that it is considered a
@@ -1613,12 +1615,12 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailScroll) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
// Get rid of touch slop.
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(0, 5),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
delegate->Reset();
// Move the touch-point vertically enough that it is considered a
@@ -1673,7 +1675,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1686,7 +1688,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1699,7 +1701,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(1000));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1710,7 +1712,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
// Get rid of touch slop.
ui::TouchEvent move_remove_slop(ui::ET_TOUCH_MOVED, gfx::Point(106, 206),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move_remove_slop);
+ DispatchEventUsingWindowDispatcher(&move_remove_slop);
EXPECT_TRUE(delegate->tap_cancel());
EXPECT_TRUE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
@@ -1726,7 +1728,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(135, 235),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1740,7 +1742,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(115, 216),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move1);
+ DispatchEventUsingWindowDispatcher(&move1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1755,7 +1757,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(145, 220),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+ DispatchEventUsingWindowDispatcher(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1769,7 +1771,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1796,7 +1798,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
queued_delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, GetTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
EXPECT_FALSE(queued_delegate->tap_cancel());
@@ -1811,7 +1813,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, press.time_stamp() +
base::TimeDelta::FromMilliseconds(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
EXPECT_FALSE(queued_delegate->tap_cancel());
@@ -1830,7 +1832,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 20),
kTouchId2, GetTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1842,7 +1844,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(10, 20),
kTouchId2, GetTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release2);
+ DispatchEventUsingWindowDispatcher(&release2);
// Process the first queued event.
queued_delegate->Reset();
@@ -1873,7 +1875,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
queued_delegate->Reset();
ui::TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, GetTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press3);
+ DispatchEventUsingWindowDispatcher(&press3);
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
EXPECT_FALSE(queued_delegate->tap_cancel());
@@ -1889,7 +1891,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
delegate->Reset();
ui::TouchEvent press4(ui::ET_TOUCH_PRESSED, gfx::Point(103, 203),
kTouchId2, GetTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press4);
+ DispatchEventUsingWindowDispatcher(&press4);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1914,7 +1916,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
int x_move = ui::GestureConfiguration::max_touch_move_in_pixels_for_click();
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(103 + x_move, 203),
kTouchId2, GetTime());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1983,12 +1985,10 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
delegate.get(), -1234, bounds, root_window()));
- aura::RootWindow* root = dispatcher();
-
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_BEGIN,
ui::ET_GESTURE_TAP_DOWN);
@@ -1998,7 +1998,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
delegate->Reset();
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(130, 301),
kTouchId1, tes.Now());
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
EXPECT_3_EVENTS(delegate->events(),
ui::ET_GESTURE_TAP_CANCEL,
ui::ET_GESTURE_SCROLL_BEGIN,
@@ -2009,7 +2009,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10),
kTouchId2, tes.Now());
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_BEGIN,
ui::ET_GESTURE_PINCH_BEGIN);
@@ -2020,7 +2020,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
delegate->Reset();
ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(95, 201),
kTouchId1, tes.Now());
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move3);
+ DispatchEventUsingWindowDispatcher(&move3);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_PINCH_UPDATE,
ui::ET_GESTURE_SCROLL_UPDATE);
@@ -2031,7 +2031,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
delegate->Reset();
ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(55, 15),
kTouchId2, tes.Now());
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move4);
+ DispatchEventUsingWindowDispatcher(&move4);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_PINCH_UPDATE,
ui::ET_GESTURE_SCROLL_UPDATE);
@@ -2042,7 +2042,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_PINCH_END,
ui::ET_GESTURE_END);
@@ -2053,7 +2053,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
delegate->Reset();
ui::TouchEvent move5(ui::ET_TOUCH_MOVED, gfx::Point(25, 10),
kTouchId2, tes.Now());
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move5);
+ DispatchEventUsingWindowDispatcher(&move5);
EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE);
EXPECT_TRUE(delegate->bounding_box().IsEmpty());
}
@@ -2072,11 +2072,11 @@ scoped_ptr<GestureEventConsumeDelegate> delegate(
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 301),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
EXPECT_FALSE(delegate->pinch_begin());
// Touch move triggers pinch begin.
@@ -2093,7 +2093,7 @@ scoped_ptr<GestureEventConsumeDelegate> delegate(
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_TRUE(delegate->pinch_end());
tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId2, delegate.get());
@@ -2103,12 +2103,12 @@ scoped_ptr<GestureEventConsumeDelegate> delegate(
delegate->Reset();
ui::TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press3);
+ 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),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+ DispatchEventUsingWindowDispatcher(&move2);
EXPECT_TRUE(delegate->pinch_begin());
tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId1, delegate.get());
@@ -2127,12 +2127,10 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
delegate.get(), -1234, bounds, root_window()));
- aura::RootWindow* root = dispatcher();
-
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 301),
kTouchId1, tes.Now());
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_BEGIN,
ui::ET_GESTURE_TAP_DOWN);
@@ -2142,7 +2140,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10),
kTouchId2, tes.Now());
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_TAP_CANCEL,
ui::ET_GESTURE_BEGIN);
@@ -2153,7 +2151,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
delegate->Reset();
ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(65, 201),
kTouchId1, tes.Now());
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move3);
+ DispatchEventUsingWindowDispatcher(&move3);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_PINCH_BEGIN,
ui::ET_GESTURE_SCROLL_BEGIN);
@@ -2164,7 +2162,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
delegate->Reset();
ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(55, 15),
kTouchId2, tes.Now());
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move4);
+ DispatchEventUsingWindowDispatcher(&move4);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_PINCH_UPDATE,
ui::ET_GESTURE_SCROLL_UPDATE);
@@ -2175,7 +2173,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.LeapForward(10));
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_PINCH_END,
ui::ET_GESTURE_END);
@@ -2186,7 +2184,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
delegate->Reset();
ui::TouchEvent move5(ui::ET_TOUCH_MOVED, gfx::Point(25, 10),
kTouchId2, tes.Now());
- root->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move5);
+ DispatchEventUsingWindowDispatcher(&move5);
EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE);
EXPECT_TRUE(delegate->bounding_box().IsEmpty());
}
@@ -2198,7 +2196,7 @@ TEST_F(GestureRecognizerTest, GestureEventIgnoresDisconnectedEvents) {
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
6, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
}
@@ -2236,7 +2234,7 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) {
windows[i]->set_id(i);
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, window_bounds[i].origin(),
i, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
}
// Touches should now be associated with the closest touch within
@@ -2253,10 +2251,10 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) {
// Add a touch in the middle associated with windows[2]
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 500),
kNumWindows, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(250, 250),
kNumWindows, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
target = gesture_recognizer->GetTargetForLocation(gfx::Point(250, 250), -1);
EXPECT_EQ("2", WindowIDAsString(target));
@@ -2277,7 +2275,7 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) {
// Move a touch associated with windows[2] to 1000, 1000
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(1000, 1000),
kNumWindows, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+ DispatchEventUsingWindowDispatcher(&move2);
target = gesture_recognizer->GetTargetForLocation(gfx::Point(1000, 1000), -1);
EXPECT_EQ("2", WindowIDAsString(target));
@@ -2305,12 +2303,12 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockIgnoresOtherScreens) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(5, 5),
kTouchId1, tes.Now());
press1.set_source_device_id(1);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20),
kTouchId2, tes.Now());
press2.set_source_device_id(2);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
// The second press should not have been locked to the same target as the
// first, as they occured on different displays.
@@ -2338,11 +2336,11 @@ TEST_F(GestureRecognizerTest, GestureEventOutsideRootWindowTap) {
gfx::Point pos1(-10, -10);
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, pos1, 0, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
gfx::Point pos2(1000, 1000);
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, pos2, 1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
// As these presses were outside the root window, they should be
// associated with the root window.
@@ -2363,10 +2361,10 @@ TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
delegate->Reset();
delegate->ReceivedAck();
@@ -2396,9 +2394,9 @@ TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) {
tes.LeapForward(200));
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(15, 25), kTouchId1,
tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&press);
+ DispatchEventUsingWindowDispatcher(&move);
+ DispatchEventUsingWindowDispatcher(&release);
delegate->Reset();
// Ack the press event.
@@ -2432,12 +2430,12 @@ TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) {
tes.LeapForward(14));
// Do a pinch.
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release2);
+ DispatchEventUsingWindowDispatcher(&press);
+ DispatchEventUsingWindowDispatcher(&move);
+ DispatchEventUsingWindowDispatcher(&press2);
+ DispatchEventUsingWindowDispatcher(&move2);
+ DispatchEventUsingWindowDispatcher(&release);
+ DispatchEventUsingWindowDispatcher(&release2);
// Ack the press and move events.
delegate->Reset();
@@ -2584,14 +2582,14 @@ TEST_F(GestureRecognizerTest, PressDoesNotCrash) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(45, 45), 7, tes.Now());
press.set_radius_x(40);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_TRUE(delegate->tap_down());
EXPECT_EQ(gfx::Rect(5, 5, 80, 80).ToString(),
delegate->bounding_box().ToString());
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(55, 45), 7, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
// This new press should not generate a tap-down.
EXPECT_FALSE(delegate->begin());
@@ -2615,7 +2613,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -2628,7 +2626,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap.
EXPECT_TRUE(delegate->tap_cancel());
@@ -2642,10 +2640,10 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
delegate->Reset();
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(102, 202),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move1);
+ DispatchEventUsingWindowDispatcher(&move1);
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(131, 202),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+ DispatchEventUsingWindowDispatcher(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -2661,7 +2659,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -2677,7 +2675,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201),
kTouchId2, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release2);
+ DispatchEventUsingWindowDispatcher(&release2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -2703,19 +2701,19 @@ TEST_F(GestureRecognizerTest, TwoFingerTapExpired) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
// Send release event after sufficient delay so that two finger time expires.
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.LeapForward(1000));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->two_finger_tap());
// Lift second finger.
@@ -2725,7 +2723,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapExpired) {
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201),
kTouchId2, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release2);
+ DispatchEventUsingWindowDispatcher(&release2);
EXPECT_FALSE(delegate->two_finger_tap());
}
@@ -2747,12 +2745,12 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId1, delegate.get());
EXPECT_FALSE(delegate->two_finger_tap());
@@ -2764,7 +2762,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId2, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_FALSE(delegate->two_finger_tap());
EXPECT_TRUE(delegate->pinch_end());
}
@@ -2778,12 +2776,12 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
tes.SendScrollEvent(dispatcher(), 101, 230, kTouchId2, delegate.get());
EXPECT_FALSE(delegate->two_finger_tap());
@@ -2795,7 +2793,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_FALSE(delegate->two_finger_tap());
EXPECT_TRUE(delegate->pinch_end());
}
@@ -2817,13 +2815,13 @@ TEST_F(GestureRecognizerTest, NoTwoFingerTapWhenFirstFingerHasScrolled) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId1, delegate.get());
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
EXPECT_TRUE(delegate->pinch_begin());
@@ -2833,7 +2831,7 @@ TEST_F(GestureRecognizerTest, NoTwoFingerTapWhenFirstFingerHasScrolled) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId2, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_FALSE(delegate->two_finger_tap());
EXPECT_TRUE(delegate->pinch_end());
}
@@ -2896,17 +2894,17 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
delegate->Reset();
ui::TouchEvent cancel(ui::ET_TOUCH_CANCELLED, gfx::Point(130, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&cancel);
+ DispatchEventUsingWindowDispatcher(&cancel);
EXPECT_FALSE(delegate->two_finger_tap());
// Make sure there is enough delay before the touch is released so that it
@@ -2915,7 +2913,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId2, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_FALSE(delegate->two_finger_tap());
}
@@ -2928,17 +2926,17 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
delegate->Reset();
ui::TouchEvent cancel(ui::ET_TOUCH_CANCELLED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&cancel);
+ DispatchEventUsingWindowDispatcher(&cancel);
EXPECT_FALSE(delegate->two_finger_tap());
// Make sure there is enough delay before the touch is released so that it
@@ -2947,7 +2945,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_FALSE(delegate->two_finger_tap());
}
}
@@ -2967,7 +2965,7 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -2980,7 +2978,7 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) {
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(430, 201),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap.
EXPECT_TRUE(delegate->tap_cancel());
@@ -2994,7 +2992,7 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) {
delegate->Reset();
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(530, 301),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+ DispatchEventUsingWindowDispatcher(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3021,10 +3019,10 @@ TEST_F(GestureRecognizerTest, FlushAllOnHide) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
window->Hide();
EXPECT_EQ(NULL,
ui::GestureRecognizer::Get()->GetTouchLockedTarget(press1));
@@ -3053,7 +3051,7 @@ TEST_F(GestureRecognizerTest, LongPressTimerStopsOnPreventDefaultedTouchMoves) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
// Scroll around, to cancel the long press
tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get());
@@ -3106,7 +3104,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3132,7 +3130,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(130, 230),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3160,7 +3158,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
tes.SendScrollEvent(dispatcher(), 131, 231, kTouchId1, delegate.get());
// First finger touches down and moves.
@@ -3173,7 +3171,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) {
// Second finger touches down and moves.
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
tes.SendScrollEvent(dispatcher(), 161, 231, kTouchId2, delegate.get());
// PinchBegin & ScrollBegin were not sent if the touch-move events were
@@ -3230,8 +3228,8 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) {
kTouchId1, tes.Now());
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release2);
+ DispatchEventUsingWindowDispatcher(&release1);
+ DispatchEventUsingWindowDispatcher(&release2);
EXPECT_FALSE(delegate->tap());
// Touch release is not consumed, so we still see two finger tap.
@@ -3264,7 +3262,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3331,7 +3329,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3358,19 +3356,19 @@ TEST_F(GestureRecognizerTest, GestureEventDoubleTap) {
// First tap (tested in GestureEventTap)
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(104, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(104, 201),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
delegate->Reset();
// Second tap
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(101, 203),
kTouchId, tes.LeapForward(200));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release2);
+ DispatchEventUsingWindowDispatcher(&release2);
EXPECT_TRUE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
@@ -3399,10 +3397,10 @@ TEST_F(GestureRecognizerTest, GestureEventTripleTap) {
// First tap (tested in GestureEventTap)
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(104, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(104, 201),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
EXPECT_EQ(1, delegate->tap_count());
delegate->Reset();
@@ -3410,10 +3408,10 @@ TEST_F(GestureRecognizerTest, GestureEventTripleTap) {
// Second tap (tested in GestureEventDoubleTap)
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(101, 203),
kTouchId, tes.LeapForward(200));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release2);
+ DispatchEventUsingWindowDispatcher(&release2);
EXPECT_EQ(2, delegate->tap_count());
delegate->Reset();
@@ -3421,10 +3419,10 @@ TEST_F(GestureRecognizerTest, GestureEventTripleTap) {
// Third tap
ui::TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(102, 206),
kTouchId, tes.LeapForward(200));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press3);
+ DispatchEventUsingWindowDispatcher(&press3);
ui::TouchEvent release3(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release3);
+ DispatchEventUsingWindowDispatcher(&release3);
EXPECT_TRUE(delegate->tap());
@@ -3454,19 +3452,19 @@ TEST_F(GestureRecognizerTest, TwoTapsFarApart) {
// First tap (tested in GestureEventTap)
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
delegate->Reset();
// Second tap, close in time but far in distance
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(201, 201),
kTouchId, tes.LeapForward(200));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(201, 201),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release2);
+ DispatchEventUsingWindowDispatcher(&release2);
EXPECT_TRUE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
@@ -3496,19 +3494,19 @@ TEST_F(GestureRecognizerTest, TwoTapsWithDelayBetween) {
// First tap (tested in GestureEventTap)
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
delegate->Reset();
// Second tap, close in distance but after some delay
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(2000));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release2);
+ DispatchEventUsingWindowDispatcher(&release2);
EXPECT_TRUE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
@@ -3538,7 +3536,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) {
ui::TouchEvent press1(
ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
EXPECT_TRUE(delegate->bounding_box().IsEmpty());
delegate->Reset();
@@ -3547,7 +3545,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) {
ui::ET_TOUCH_PRESSED, gfx::Point(201, 201), kTouchId2,
tes.LeapForward(400));
press2.set_radius_x(5);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
EXPECT_FALSE(delegate->pinch_begin());
EXPECT_EQ(gfx::Rect(101, 201, 100, 0).ToString(),
delegate->bounding_box().ToString());
@@ -3556,7 +3554,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) {
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(141, 201), kTouchId,
tes.LeapForward(40));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move1);
+ DispatchEventUsingWindowDispatcher(&move1);
EXPECT_TRUE(delegate->pinch_begin());
EXPECT_EQ(gfx::Rect(141, 201, 60, 0).ToString(),
delegate->bounding_box().ToString());
@@ -3568,7 +3566,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) {
tes.LeapForward(40));
move2.set_radius_x(50);
move2.set_radius_y(60);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+ DispatchEventUsingWindowDispatcher(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->scroll_update());
@@ -3594,21 +3592,21 @@ TEST_F(GestureRecognizerTest, NoDriftInScroll) {
ui::TouchEvent press1(
ui::ET_TOUCH_PRESSED, gfx::Point(101, 208), kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
EXPECT_TRUE(delegate->begin());
delegate->Reset();
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(101, 206), kTouchId,
tes.LeapForward(40));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move1);
+ DispatchEventUsingWindowDispatcher(&move1);
EXPECT_FALSE(delegate->scroll_begin());
delegate->Reset();
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(101, 204), kTouchId,
tes.LeapForward(40));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+ DispatchEventUsingWindowDispatcher(&move2);
EXPECT_TRUE(delegate->tap_cancel());
EXPECT_TRUE(delegate->scroll_begin());
EXPECT_TRUE(delegate->scroll_update());
@@ -3620,14 +3618,14 @@ TEST_F(GestureRecognizerTest, NoDriftInScroll) {
ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(101, 204), kTouchId,
tes.LeapForward(40));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move3);
+ DispatchEventUsingWindowDispatcher(&move3);
EXPECT_FALSE(delegate->scroll_update());
delegate->Reset();
ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(101, 203), kTouchId,
tes.LeapForward(40));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move4);
+ DispatchEventUsingWindowDispatcher(&move4);
EXPECT_TRUE(delegate->scroll_update());
EXPECT_EQ(-1, delegate->scroll_y());
@@ -3651,7 +3649,7 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveCanFireTapCancel) {
kTouchId, tes.Now());
delegate->set_consume_touch_move(false);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
delegate->set_consume_touch_move(true);
delegate->Reset();
// Move the touch-point enough so that it would normally be considered a
@@ -3688,8 +3686,8 @@ TEST_F(GestureRecognizerTest,
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
ui::TouchEvent p2(ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&p2);
+ DispatchEventUsingWindowDispatcher(&press);
+ DispatchEventUsingWindowDispatcher(&p2);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->tap_cancel());
@@ -3730,7 +3728,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPress) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->begin());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3746,7 +3744,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPress) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->long_press());
// Note the tap down isn't cancelled until the release
@@ -3778,7 +3776,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
EXPECT_TRUE(delegate->tap_down());
// We haven't pressed long enough for a show press to occur
@@ -3795,7 +3793,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(10));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
EXPECT_FALSE(delegate->show_press());
EXPECT_FALSE(delegate->tap_cancel());
}
@@ -3816,7 +3814,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressSentOnTap) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
EXPECT_TRUE(delegate->tap_down());
// We haven't pressed long enough for a show press to occur
@@ -3826,7 +3824,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressSentOnTap) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release1);
+ DispatchEventUsingWindowDispatcher(&release1);
EXPECT_TRUE(delegate->show_press());
EXPECT_FALSE(delegate->tap_cancel());
EXPECT_TRUE(delegate->tap());
@@ -3844,17 +3842,17 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveScrollTest) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
delegate->ReceivedAck();
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(2, 2),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move1);
+ DispatchEventUsingWindowDispatcher(&move1);
delegate->ReceivedAckPreventDefaulted();
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+ DispatchEventUsingWindowDispatcher(&move2);
delegate->ReceivedAck();
EXPECT_FALSE(delegate->scroll_begin());
@@ -3875,17 +3873,17 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMovePinchTest) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
delegate->ReceivedAck();
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(2, 2),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move1);
+ DispatchEventUsingWindowDispatcher(&move1);
delegate->ReceivedAckPreventDefaulted();
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20),
kTouchId1, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+ DispatchEventUsingWindowDispatcher(&move2);
delegate->ReceivedAck();
// We can't scroll, because a move has been consumed.
@@ -3896,12 +3894,12 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMovePinchTest) {
// An additional press will allow us to pinch.
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+ DispatchEventUsingWindowDispatcher(&press2);
delegate->ReceivedAck();
ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(20, 20),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move3);
+ DispatchEventUsingWindowDispatcher(&move3);
delegate->ReceivedAck();
EXPECT_TRUE(delegate->pinch_begin());
@@ -3911,7 +3909,7 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMovePinchTest) {
ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(40, 40),
kTouchId2, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move4);
+ DispatchEventUsingWindowDispatcher(&move4);
delegate->ReceivedAck();
EXPECT_TRUE(delegate->pinch_update());
@@ -3931,17 +3929,17 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveTapTest) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
delegate->ReceivedAck();
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(2, 2),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
delegate->ReceivedAckPreventDefaulted();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(2, 2),
kTouchId, tes.LeapForward(50));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+ DispatchEventUsingWindowDispatcher(&release);
delegate->ReceivedAck();
EXPECT_TRUE(delegate->tap());
@@ -3968,12 +3966,12 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveLongPressTest) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press1);
+ DispatchEventUsingWindowDispatcher(&press1);
delegate->ReceivedAck();
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(103, 203),
kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+ DispatchEventUsingWindowDispatcher(&move);
delegate->ReceivedAckPreventDefaulted();
// Wait until the timer runs out
@@ -3996,14 +3994,14 @@ TEST_F(GestureRecognizerTest, TestExceedingSlopSlowly) {
ui::TouchEvent press(
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), kTouchId, tes.Now());
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+ DispatchEventUsingWindowDispatcher(&press);
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
delegate->Reset();
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(11, 10), kTouchId,
tes.LeapForward(40));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move1);
+ DispatchEventUsingWindowDispatcher(&move1);
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
EXPECT_EQ(0, delegate->scroll_x());
@@ -4012,7 +4010,7 @@ TEST_F(GestureRecognizerTest, TestExceedingSlopSlowly) {
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(12, 10), kTouchId,
tes.LeapForward(40));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+ DispatchEventUsingWindowDispatcher(&move2);
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
EXPECT_EQ(0, delegate->scroll_x());
@@ -4022,7 +4020,7 @@ TEST_F(GestureRecognizerTest, TestExceedingSlopSlowly) {
ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(13, 10), kTouchId,
tes.LeapForward(40));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move3);
+ DispatchEventUsingWindowDispatcher(&move3);
EXPECT_TRUE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
EXPECT_EQ(0, delegate->scroll_x());
@@ -4032,7 +4030,7 @@ TEST_F(GestureRecognizerTest, TestExceedingSlopSlowly) {
ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(14, 10), kTouchId,
tes.LeapForward(40));
- dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move4);
+ DispatchEventUsingWindowDispatcher(&move4);
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_TRUE(delegate->scroll_update());
EXPECT_EQ(1, delegate->scroll_x());
« no previous file with comments | « mojo/examples/launcher/launcher.cc ('k') | ui/aura/remote_root_window_host_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698