diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-10 06:16:08 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-10 06:16:08 +0000 |
commit | 688c225e6f3825179e1b8d706f05e4438fa1e36a (patch) | |
tree | a4b7ce2c97553f52b6fb89a75b37b3e00bc62505 /ui/aura/gestures | |
parent | 6ed843366f5ee413ca48f1ad245ab0000981b8f6 (diff) | |
download | chromium_src-688c225e6f3825179e1b8d706f05e4438fa1e36a.zip chromium_src-688c225e6f3825179e1b8d706f05e4438fa1e36a.tar.gz chromium_src-688c225e6f3825179e1b8d706f05e4438fa1e36a.tar.bz2 |
Use Window instead of RootWindow in many more places throughout the codebase
TBR=sky@chromium.org
http://crbug.com/308843
Review URL: https://codereview.chromium.org/66653005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234166 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/gestures')
-rw-r--r-- | ui/aura/gestures/gesture_recognizer_unittest.cc | 406 |
1 files changed, 203 insertions, 203 deletions
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc index 911f8d3..2d0a09c 100644 --- a/ui/aura/gestures/gesture_recognizer_unittest.cc +++ b/ui/aura/gestures/gesture_recognizer_unittest.cc @@ -698,7 +698,7 @@ TEST_F(GestureRecognizerTest, GestureEventTap) { delegate->Reset(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->show_press()); EXPECT_TRUE(delegate->tap_down()); @@ -720,7 +720,7 @@ TEST_F(GestureRecognizerTest, GestureEventTap) { ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -753,7 +753,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { kTouchId, tes.Now()); press.set_radius_x(5); press.set_radius_y(12); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -771,7 +771,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { release.set_radius_x(5); release.set_radius_y(12); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -796,7 +796,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { kTouchId, tes.Now()); press.set_radius_x(8); press.set_radius_y(14); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -812,7 +812,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { release.set_radius_x(20); release.set_radius_y(13); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -837,7 +837,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { kTouchId, tes.Now()); press.set_radius_x(6); press.set_radius_y(10); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -853,7 +853,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { kTouchId, tes.LeapForward(50)); move.set_radius_x(8); move.set_radius_y(12); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -869,7 +869,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { release.set_radius_x(4); release.set_radius_y(8); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -894,7 +894,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { kTouchId, tes.Now()); press.set_radius_x(7); press.set_radius_y(10); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -909,7 +909,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { kTouchId, tes.LeapForward(50)); move.set_radius_x(13); move.set_radius_y(12); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -924,7 +924,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { kTouchId, tes.LeapForward(50)); move1.set_radius_x(16); move1.set_radius_y(16); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -939,7 +939,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { kTouchId, tes.LeapForward(50)); move2.set_radius_x(14); move2.set_radius_y(10); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -955,7 +955,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { release.set_radius_x(8); release.set_radius_y(9); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -989,7 +989,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) { delegate->Reset(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_2_EVENTS(delegate->events(), ui::ET_GESTURE_BEGIN, ui::ET_GESTURE_TAP_DOWN); @@ -998,7 +998,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) { // should generate both SCROLL_BEGIN and SCROLL_UPDATE gestures. // The first movement is diagonal, to ensure that we have a free scroll, // and not a rail scroll. - tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get()); EXPECT_3_EVENTS(delegate->events(), ui::ET_GESTURE_TAP_CANCEL, ui::ET_GESTURE_SCROLL_BEGIN, @@ -1013,13 +1013,13 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) { EXPECT_TRUE(delegate->bounding_box().IsEmpty()); // Move some more to generate a few more scroll updates. - tes.SendScrollEvent(root_window(), 110, 211, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 110, 211, kTouchId, delegate.get()); EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); EXPECT_EQ(-20, delegate->scroll_x()); EXPECT_EQ(-19, delegate->scroll_y()); EXPECT_TRUE(delegate->bounding_box().IsEmpty()); - tes.SendScrollEvent(root_window(), 140, 215, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 140, 215, 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()); @@ -1030,7 +1030,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) { ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_2_EVENTS(delegate->events(), ui::ET_SCROLL_FLING_START, ui::ET_GESTURE_END); @@ -1057,7 +1057,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) { gfx::Vector2dF total_scroll; ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_2_EVENTS(delegate->events(), ui::ET_GESTURE_BEGIN, ui::ET_GESTURE_TAP_DOWN); @@ -1067,7 +1067,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) { // The first movement is diagonal, to ensure that we have a free scroll, // and not a rail scroll. tes.LeapForward(30); - tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get()); EXPECT_3_EVENTS(delegate->events(), ui::ET_GESTURE_TAP_CANCEL, ui::ET_GESTURE_SCROLL_BEGIN, @@ -1083,7 +1083,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) { // Move some more to generate a few more scroll updates. tes.LeapForward(30); - tes.SendScrollEvent(root_window(), 110, 211, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 110, 211, kTouchId, delegate.get()); EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); total_scroll.set_x(total_scroll.x() + delegate->scroll_x()); total_scroll.set_y(total_scroll.y() + delegate->scroll_y()); @@ -1093,7 +1093,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) { (int)(total_scroll.y())); tes.LeapForward(30); - tes.SendScrollEvent(root_window(), 140, 215, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 140, 215, kTouchId, delegate.get()); EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); total_scroll.set_x(total_scroll.x() + delegate->scroll_x()); total_scroll.set_y(total_scroll.y() + delegate->scroll_y()); @@ -1107,7 +1107,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) { ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); } // Check that the bounding box during a scroll event is correct. @@ -1131,7 +1131,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) { gfx::Point(kPositionX, kPositionY), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_EQ(gfx::Rect(kPositionX - radius, kPositionY - radius, radius * 2, @@ -1139,7 +1139,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) { delegate->bounding_box().ToString()); const int kScrollAmount = 50; - tes.SendScrollEvents(root_window(), kPositionX, kPositionY, + tes.SendScrollEvents(dispatcher(), kPositionX, kPositionY, 1, 1, kTouchId, 1, kScrollAmount, delegate.get()); EXPECT_EQ(gfx::Point(1, 1).ToString(), delegate->scroll_begin_position().ToString()); @@ -1156,7 +1156,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) { kPositionY + kScrollAmount), kTouchId, press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_EQ(gfx::Rect(kPositionX + kScrollAmount - radius, kPositionY + kScrollAmount - radius, radius * 2, @@ -1179,18 +1179,18 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) { ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Move the touch-point horizontally enough that it is considered a // horizontal scroll. - tes.SendScrollEvent(root_window(), 20, 1, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 20, 1, kTouchId, delegate.get()); EXPECT_EQ(0, delegate->scroll_y()); EXPECT_EQ(1, delegate->scroll_y_ordinal()); EXPECT_EQ(20, delegate->scroll_x()); EXPECT_EQ(20, delegate->scroll_x_ordinal()); // Get a high x velocity, while still staying on the rail - tes.SendScrollEvents(root_window(), 1, 1, + tes.SendScrollEvents(dispatcher(), 1, 1, 100, 10, kTouchId, 1, ui::GestureConfiguration::points_buffered_for_velocity(), delegate.get()); @@ -1202,7 +1202,7 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) { delegate->Reset(); ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->fling()); EXPECT_FALSE(delegate->scroll_end()); @@ -1223,11 +1223,11 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) { ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Move the touch-point vertically enough that it is considered a // vertical scroll. - tes.SendScrollEvent(root_window(), 1, 20, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 1, 20, kTouchId, delegate.get()); EXPECT_EQ(20, delegate->scroll_y()); EXPECT_EQ(20, delegate->scroll_y_ordinal()); EXPECT_EQ(0, delegate->scroll_x()); @@ -1236,7 +1236,7 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) { EXPECT_GT(delegate->scroll_velocity_x_ordinal(), 0); // Get a high y velocity, while still staying on the rail - tes.SendScrollEvents(root_window(), 1, 1, + tes.SendScrollEvents(dispatcher(), 1, 1, 10, 100, kTouchId, 1, ui::GestureConfiguration::points_buffered_for_velocity(), delegate.get()); @@ -1246,7 +1246,7 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) { delegate->Reset(); ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->fling()); EXPECT_FALSE(delegate->scroll_end()); @@ -1267,14 +1267,14 @@ TEST_F(GestureRecognizerTest, GestureEventNonRailFling) { ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Move the touch-point such that a non-rail scroll begins - tes.SendScrollEvent(root_window(), 20, 20, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 20, 20, kTouchId, delegate.get()); EXPECT_EQ(20, delegate->scroll_y()); EXPECT_EQ(20, delegate->scroll_x()); - tes.SendScrollEvents(root_window(), 1, 1, + tes.SendScrollEvents(dispatcher(), 1, 1, 10, 100, kTouchId, 1, ui::GestureConfiguration::points_buffered_for_velocity(), delegate.get()); @@ -1282,7 +1282,7 @@ TEST_F(GestureRecognizerTest, GestureEventNonRailFling) { delegate->Reset(); ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->fling()); EXPECT_FALSE(delegate->scroll_end()); @@ -1311,7 +1311,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) { ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_TRUE(delegate->tap_down()); EXPECT_TRUE(delegate->begin()); EXPECT_FALSE(delegate->tap_cancel()); @@ -1328,7 +1328,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) { delegate->Reset(); ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->long_press()); // Note the tap down isn't cancelled until the release @@ -1360,7 +1360,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) { ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_TRUE(delegate->tap_down()); // We haven't pressed long enough for a long press to occur @@ -1368,7 +1368,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) { EXPECT_FALSE(delegate->tap_cancel()); // Scroll around, to cancel the long press - tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get()); // Wait until the timer runs out gesture_sequence->ForceTimeout(); EXPECT_FALSE(delegate->long_press()); @@ -1377,7 +1377,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) { delegate->Reset(); ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.LeapForward(10)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->long_press()); EXPECT_FALSE(delegate->tap_cancel()); } @@ -1403,7 +1403,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongTap) { ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_TRUE(delegate->tap_down()); EXPECT_TRUE(delegate->begin()); EXPECT_FALSE(delegate->tap_cancel()); @@ -1420,7 +1420,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongTap) { delegate->Reset(); ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->long_press()); EXPECT_TRUE(delegate->long_tap()); @@ -1453,7 +1453,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) { delegate->Reset(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_TRUE(delegate->tap_down()); EXPECT_TRUE(delegate->begin()); @@ -1464,7 +1464,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) { delegate->Reset(); ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap. EXPECT_TRUE(delegate->tap_cancel()); EXPECT_TRUE(delegate->begin()); @@ -1478,7 +1478,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) { delegate->Reset(); ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->long_press()); EXPECT_TRUE(delegate->two_finger_tap()); EXPECT_FALSE(delegate->tap_cancel()); @@ -1497,15 +1497,15 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailScroll) { ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Move the touch-point horizontally enough that it is considered a // horizontal scroll. - tes.SendScrollEvent(root_window(), 20, 1, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 20, 1, kTouchId, delegate.get()); EXPECT_EQ(0, delegate->scroll_y()); EXPECT_EQ(20, delegate->scroll_x()); - tes.SendScrollEvent(root_window(), 25, 6, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 25, 6, kTouchId, delegate.get()); EXPECT_TRUE(delegate->scroll_update()); EXPECT_EQ(5, delegate->scroll_x()); // y shouldn't change, as we're on a horizontal rail. @@ -1513,7 +1513,7 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailScroll) { // Send enough information that a velocity can be calculated for the gesture, // and we can break the rail - tes.SendScrollEvents(root_window(), 1, 1, + tes.SendScrollEvents(dispatcher(), 1, 1, 1, 100, kTouchId, 1, ui::GestureConfiguration::points_buffered_for_velocity(), delegate.get()); @@ -1522,8 +1522,8 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailScroll) { EXPECT_GT(delegate->scroll_velocity_x(), 0); EXPECT_GT(delegate->scroll_velocity_y(), 0); - tes.SendScrollEvent(root_window(), 0, 0, kTouchId, delegate.get()); - tes.SendScrollEvent(root_window(), 5, 5, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 0, 0, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 5, 5, kTouchId, delegate.get()); // The rail should be broken EXPECT_TRUE(delegate->scroll_update()); @@ -1544,15 +1544,15 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailScroll) { ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Move the touch-point vertically enough that it is considered a // vertical scroll. - tes.SendScrollEvent(root_window(), 1, 20, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 1, 20, kTouchId, delegate.get()); EXPECT_EQ(0, delegate->scroll_x()); EXPECT_EQ(20, delegate->scroll_y()); - tes.SendScrollEvent(root_window(), 6, 25, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 6, 25, kTouchId, delegate.get()); EXPECT_TRUE(delegate->scroll_update()); EXPECT_EQ(5, delegate->scroll_y()); // x shouldn't change, as we're on a vertical rail. @@ -1561,15 +1561,15 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailScroll) { // Send enough information that a velocity can be calculated for the gesture, // and we can break the rail - tes.SendScrollEvents(root_window(), 1, 1, + tes.SendScrollEvents(dispatcher(), 1, 1, 100, 1, kTouchId, 1, ui::GestureConfiguration::points_buffered_for_velocity(), delegate.get()); EXPECT_GT(delegate->scroll_velocity_x(), 0); EXPECT_GT(delegate->scroll_velocity_y(), 0); - tes.SendScrollEvent(root_window(), 0, 0, kTouchId, delegate.get()); - tes.SendScrollEvent(root_window(), 5, 5, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 0, 0, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 5, 5, kTouchId, delegate.get()); // The rail should be broken EXPECT_TRUE(delegate->scroll_update()); @@ -1592,7 +1592,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { delegate->Reset(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -1605,7 +1605,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { delegate->Reset(); ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -1618,7 +1618,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { delegate->Reset(); ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.LeapForward(1000)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -1633,7 +1633,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { delegate->Reset(); ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(130, 230), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_TRUE(delegate->tap_cancel()); @@ -1647,7 +1647,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { delegate->Reset(); ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(110, 211), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -1660,7 +1660,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { delegate->Reset(); ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(140, 215), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -1674,7 +1674,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { delegate->Reset(); ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -1686,7 +1686,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { scoped_ptr<QueueTouchEventDelegate> queued_delegate( - new QueueTouchEventDelegate(root_window())); + new QueueTouchEventDelegate(dispatcher())); const int kWindowWidth = 123; const int kWindowHeight = 45; const int kTouchId1 = 6; @@ -1701,7 +1701,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { queued_delegate->Reset(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId1, GetTime()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); EXPECT_FALSE(queued_delegate->tap_cancel()); @@ -1716,7 +1716,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId1, press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); EXPECT_FALSE(queued_delegate->tap_cancel()); @@ -1735,7 +1735,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { delegate->Reset(); ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 20), kTouchId2, GetTime()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -1747,7 +1747,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), kTouchId2, GetTime()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); // Process the first queued event. queued_delegate->Reset(); @@ -1778,7 +1778,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { queued_delegate->Reset(); ui::TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId1, GetTime()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); EXPECT_FALSE(queued_delegate->tap_cancel()); @@ -1794,7 +1794,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { delegate->Reset(); ui::TouchEvent press4(ui::ET_TOUCH_PRESSED, gfx::Point(103, 203), kTouchId2, GetTime()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press4); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press4); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -1819,7 +1819,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()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -1888,7 +1888,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) { scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( delegate.get(), -1234, bounds, root_window())); - aura::RootWindow* root = root_window(); + aura::RootWindow* root = dispatcher(); delegate->Reset(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), @@ -1977,20 +1977,20 @@ scoped_ptr<GestureEventConsumeDelegate> delegate( ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 301), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); delegate->Reset(); ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->pinch_begin()); // Touch move triggers pinch begin. - tes.SendScrollEvent(root_window(), 130, 230, kTouchId1, delegate.get()); + tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId1, delegate.get()); EXPECT_TRUE(delegate->pinch_begin()); EXPECT_FALSE(delegate->pinch_update()); // Touch move triggers pinch update. - tes.SendScrollEvent(root_window(), 160, 200, kTouchId1, delegate.get()); + tes.SendScrollEvent(dispatcher(), 160, 200, kTouchId1, delegate.get()); EXPECT_FALSE(delegate->pinch_begin()); EXPECT_TRUE(delegate->pinch_update()); @@ -1998,25 +1998,25 @@ scoped_ptr<GestureEventConsumeDelegate> delegate( delegate->Reset(); ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_TRUE(delegate->pinch_end()); - tes.SendScrollEvent(root_window(), 130, 230, kTouchId2, delegate.get()); + tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId2, delegate.get()); EXPECT_TRUE(delegate->scroll_update()); // Pinch again delegate->Reset(); ui::TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&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()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); EXPECT_TRUE(delegate->pinch_begin()); - tes.SendScrollEvent(root_window(), 130, 230, kTouchId1, delegate.get()); + tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId1, delegate.get()); EXPECT_TRUE(delegate->pinch_update()); } @@ -2032,7 +2032,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) { scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( delegate.get(), -1234, bounds, root_window())); - aura::RootWindow* root = root_window(); + aura::RootWindow* root = dispatcher(); delegate->Reset(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 301), @@ -2103,7 +2103,7 @@ TEST_F(GestureRecognizerTest, GestureEventIgnoresDisconnectedEvents) { ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), 6, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); } @@ -2141,7 +2141,7 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) { windows[i]->set_id(i); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, window_bounds[i].origin(), i, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); } // Touches should now be associated with the closest touch within @@ -2158,10 +2158,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()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(250, 250), kNumWindows, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); target = gesture_recognizer->GetTargetForLocation(gfx::Point(250, 250)); EXPECT_EQ("2", WindowIDAsString(target)); @@ -2182,7 +2182,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()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); target = gesture_recognizer->GetTargetForLocation(gfx::Point(1000, 1000)); EXPECT_EQ("2", WindowIDAsString(target)); @@ -2213,11 +2213,11 @@ TEST_F(GestureRecognizerTest, GestureEventOutsideRootWindowTap) { gfx::Point pos1(-10, -10); ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, pos1, 0, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); gfx::Point pos2(1000, 1000); ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, pos2, 1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); // As these presses were outside the root window, they should be // associated with the root window. @@ -2227,7 +2227,7 @@ TEST_F(GestureRecognizerTest, GestureEventOutsideRootWindowTap) { TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) { scoped_ptr<QueueTouchEventDelegate> delegate( - new QueueTouchEventDelegate(root_window())); + new QueueTouchEventDelegate(dispatcher())); TimedEvents tes; const int kTouchId = 2; gfx::Rect bounds(100, 200, 100, 100); @@ -2238,10 +2238,10 @@ TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) { delegate->Reset(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); delegate->Reset(); delegate->ReceivedAck(); @@ -2254,7 +2254,7 @@ TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) { TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) { scoped_ptr<QueueTouchEventDelegate> delegate( - new QueueTouchEventDelegate(root_window())); + new QueueTouchEventDelegate(dispatcher())); TimedEvents tes; const int kTouchId1 = 7; const int kTouchId2 = 5; @@ -2271,9 +2271,9 @@ TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) { tes.LeapForward(200)); ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(15, 25), kTouchId1, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); delegate->Reset(); // Ack the press event. @@ -2307,12 +2307,12 @@ TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) { tes.LeapForward(14)); // Do a pinch. - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); // Ack the press and move events. delegate->Reset(); @@ -2439,14 +2439,14 @@ TEST_F(GestureRecognizerTest, PressDoesNotCrash) { ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(45, 45), 7, tes.Now()); press.set_radius_x(40); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&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()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); // This new press should not generate a tap-down. EXPECT_FALSE(delegate->begin()); @@ -2470,7 +2470,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) { delegate->Reset(); ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -2483,7 +2483,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) { delegate->Reset(); ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap. EXPECT_TRUE(delegate->tap_cancel()); @@ -2497,10 +2497,10 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) { delegate->Reset(); ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(102, 202), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(131, 202), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -2516,7 +2516,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) { ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId1, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -2532,7 +2532,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) { ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201), kTouchId2, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -2558,19 +2558,19 @@ TEST_F(GestureRecognizerTest, TwoFingerTapExpired) { delegate->Reset(); ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); delegate->Reset(); ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&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)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->two_finger_tap()); // Lift second finger. @@ -2580,7 +2580,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapExpired) { ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201), kTouchId2, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); EXPECT_FALSE(delegate->two_finger_tap()); } @@ -2602,14 +2602,14 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) { delegate->Reset(); ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); delegate->Reset(); ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); - tes.SendScrollEvent(root_window(), 130, 230, kTouchId1, delegate.get()); + tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId1, delegate.get()); EXPECT_FALSE(delegate->two_finger_tap()); EXPECT_TRUE(delegate->pinch_begin()); @@ -2619,7 +2619,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) { ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId2, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->two_finger_tap()); EXPECT_TRUE(delegate->pinch_end()); } @@ -2633,14 +2633,14 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) { delegate->Reset(); ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); delegate->Reset(); ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); - tes.SendScrollEvent(root_window(), 101, 230, kTouchId2, delegate.get()); + tes.SendScrollEvent(dispatcher(), 101, 230, kTouchId2, delegate.get()); EXPECT_FALSE(delegate->two_finger_tap()); EXPECT_TRUE(delegate->pinch_begin()); @@ -2650,7 +2650,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) { ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId1, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->two_finger_tap()); EXPECT_TRUE(delegate->pinch_end()); } @@ -2672,13 +2672,13 @@ TEST_F(GestureRecognizerTest, NoTwoFingerTapWhenFirstFingerHasScrolled) { delegate->Reset(); ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); - tes.SendScrollEvent(root_window(), 130, 230, kTouchId1, delegate.get()); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&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()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_TRUE(delegate->pinch_begin()); @@ -2688,7 +2688,7 @@ TEST_F(GestureRecognizerTest, NoTwoFingerTapWhenFirstFingerHasScrolled) { ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId2, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->two_finger_tap()); EXPECT_TRUE(delegate->pinch_end()); } @@ -2751,17 +2751,17 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) { delegate->Reset(); ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); delegate->Reset(); ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); delegate->Reset(); ui::TouchEvent cancel(ui::ET_TOUCH_CANCELLED, gfx::Point(130, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&cancel); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&cancel); EXPECT_FALSE(delegate->two_finger_tap()); // Make sure there is enough delay before the touch is released so that it @@ -2770,7 +2770,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) { ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId2, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->two_finger_tap()); } @@ -2783,17 +2783,17 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) { delegate->Reset(); ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); delegate->Reset(); ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); delegate->Reset(); ui::TouchEvent cancel(ui::ET_TOUCH_CANCELLED, gfx::Point(130, 201), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&cancel); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&cancel); EXPECT_FALSE(delegate->two_finger_tap()); // Make sure there is enough delay before the touch is released so that it @@ -2802,7 +2802,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) { ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId1, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->two_finger_tap()); } } @@ -2822,7 +2822,7 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) { delegate->Reset(); ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -2835,7 +2835,7 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) { delegate->Reset(); ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(430, 201), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap. EXPECT_TRUE(delegate->tap_cancel()); @@ -2849,7 +2849,7 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) { delegate->Reset(); ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(530, 301), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -2876,10 +2876,10 @@ TEST_F(GestureRecognizerTest, FlushAllOnHide) { ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); window->Hide(); EXPECT_EQ(NULL, ui::GestureRecognizer::Get()->GetTouchLockedTarget(&press1)); @@ -2889,7 +2889,7 @@ TEST_F(GestureRecognizerTest, FlushAllOnHide) { TEST_F(GestureRecognizerTest, LongPressTimerStopsOnPreventDefaultedTouchMoves) { scoped_ptr<QueueTouchEventDelegate> delegate( - new QueueTouchEventDelegate(root_window())); + new QueueTouchEventDelegate(dispatcher())); const int kTouchId = 2; gfx::Rect bounds(100, 200, 100, 100); scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( @@ -2908,9 +2908,9 @@ TEST_F(GestureRecognizerTest, LongPressTimerStopsOnPreventDefaultedTouchMoves) { delegate->Reset(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // Scroll around, to cancel the long press - tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get()); delegate->Reset(); delegate->ReceivedAck(); @@ -2961,7 +2961,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) { delegate->Reset(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -2973,7 +2973,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) { // Move the touch-point enough so that it would normally be considered a // scroll. But since the touch-moves will be consumed, the scroll should not // start. - tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get()); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_TRUE(delegate->tap_cancel()); @@ -2987,7 +2987,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) { delegate->Reset(); ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(130, 230), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -3015,8 +3015,8 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) { delegate->Reset(); ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId1, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); - tes.SendScrollEvent(root_window(), 131, 231, kTouchId1, delegate.get()); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + tes.SendScrollEvent(dispatcher(), 131, 231, kTouchId1, delegate.get()); // First finger touches down and moves. EXPECT_FALSE(delegate->tap()); @@ -3028,8 +3028,8 @@ 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)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); - tes.SendScrollEvent(root_window(), 161, 231, kTouchId2, delegate.get()); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + tes.SendScrollEvent(dispatcher(), 161, 231, kTouchId2, delegate.get()); // PinchBegin & ScrollBegin were not sent if the touch-move events were // consumed. @@ -3047,7 +3047,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) { delegate->Reset(); // Moves First finger again, no PinchUpdate & ScrollUpdate. - tes.SendScrollEvent(root_window(), 161, 261, kTouchId1, delegate.get()); + tes.SendScrollEvent(dispatcher(), 161, 261, kTouchId1, delegate.get()); EXPECT_FALSE(delegate->pinch_update()); EXPECT_FALSE(delegate->pinch_end()); @@ -3059,7 +3059,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) { delegate->Reset(); // Making a pinch gesture. - tes.SendScrollEvent(root_window(), 161, 251, kTouchId1, delegate.get()); + tes.SendScrollEvent(dispatcher(), 161, 251, kTouchId1, delegate.get()); // If touch moves are ever consumed, we should not see PinchBegin/Update // even touch moves become not consumed. EXPECT_FALSE(delegate->scroll_begin()); @@ -3071,7 +3071,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) { EXPECT_FALSE(delegate->pinch_end()); delegate->Reset(); - tes.SendScrollEvent(root_window(), 161, 241, kTouchId2, delegate.get()); + tes.SendScrollEvent(dispatcher(), 161, 241, kTouchId2, delegate.get()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); EXPECT_FALSE(delegate->scroll_end()); @@ -3085,8 +3085,8 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) { kTouchId1, tes.Now()); ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201), kTouchId2, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); EXPECT_FALSE(delegate->tap()); // Touch release is not consumed, so we still see two finger tap. @@ -3119,7 +3119,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) { delegate->Reset(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -3131,7 +3131,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) { // Move the touch-point enough so that it would normally be considered a // scroll. But since the touch-moves will be consumed, the scroll should not // start. - tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get()); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_TRUE(delegate->tap_cancel()); @@ -3142,7 +3142,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) { // Now, stop consuming touch-move events, and move the touch-point again. delegate->set_consume_touch_move(false); - tes.SendScrollEvent(root_window(), 159, 259, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 159, 259, kTouchId, delegate.get()); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -3160,7 +3160,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) { delegate->set_consume_touch_move(true); // Move some more to generate a few more scroll updates. - tes.SendScrollEvent(root_window(), 110, 211, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 110, 211, kTouchId, delegate.get()); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -3171,7 +3171,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) { EXPECT_EQ(0, delegate->scroll_x()); EXPECT_EQ(0, delegate->scroll_y()); - tes.SendScrollEvent(root_window(), 140, 215, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 140, 215, kTouchId, delegate.get()); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -3186,7 +3186,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) { delegate->Reset(); ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_FALSE(delegate->tap_cancel()); @@ -3213,19 +3213,19 @@ TEST_F(GestureRecognizerTest, GestureEventDoubleTap) { // First tap (tested in GestureEventTap) ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(104, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(104, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); delegate->Reset(); // Second tap ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(101, 203), kTouchId, tes.LeapForward(200)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); EXPECT_TRUE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); @@ -3254,10 +3254,10 @@ TEST_F(GestureRecognizerTest, GestureEventTripleTap) { // First tap (tested in GestureEventTap) ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(104, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(104, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_EQ(1, delegate->tap_count()); delegate->Reset(); @@ -3265,10 +3265,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)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); EXPECT_EQ(2, delegate->tap_count()); delegate->Reset(); @@ -3276,10 +3276,10 @@ TEST_F(GestureRecognizerTest, GestureEventTripleTap) { // Third tap ui::TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(102, 206), kTouchId, tes.LeapForward(200)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3); ui::TouchEvent release3(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release3); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release3); EXPECT_TRUE(delegate->tap()); @@ -3309,19 +3309,19 @@ TEST_F(GestureRecognizerTest, TwoTapsFarApart) { // First tap (tested in GestureEventTap) ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&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)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(201, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); EXPECT_TRUE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); @@ -3351,19 +3351,19 @@ TEST_F(GestureRecognizerTest, TwoTapsWithDelayBetween) { // First tap (tested in GestureEventTap) ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&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)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2); EXPECT_TRUE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); @@ -3393,7 +3393,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) { ui::TouchEvent press1( ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_TRUE(delegate->bounding_box().IsEmpty()); delegate->Reset(); @@ -3402,7 +3402,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) { ui::ET_TOUCH_PRESSED, gfx::Point(201, 201), kTouchId2, tes.LeapForward(400)); press2.set_radius_x(5); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_FALSE(delegate->pinch_begin()); EXPECT_EQ(gfx::Rect(101, 201, 100, 0).ToString(), delegate->bounding_box().ToString()); @@ -3411,7 +3411,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) { ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(141, 201), kTouchId, tes.LeapForward(40)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); EXPECT_TRUE(delegate->pinch_begin()); EXPECT_EQ(gfx::Rect(141, 201, 60, 0).ToString(), delegate->bounding_box().ToString()); @@ -3423,7 +3423,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) { tes.LeapForward(40)); move2.set_radius_x(50); move2.set_radius_y(60); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_cancel()); EXPECT_FALSE(delegate->scroll_update()); @@ -3449,21 +3449,21 @@ TEST_F(GestureRecognizerTest, NoDriftInScroll) { ui::TouchEvent press1( ui::ET_TOUCH_PRESSED, gfx::Point(101, 208), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_TRUE(delegate->begin()); delegate->Reset(); ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(101, 206), kTouchId, tes.LeapForward(40)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); EXPECT_FALSE(delegate->scroll_begin()); delegate->Reset(); ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(101, 204), kTouchId, tes.LeapForward(40)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2); EXPECT_TRUE(delegate->tap_cancel()); EXPECT_TRUE(delegate->scroll_begin()); EXPECT_TRUE(delegate->scroll_update()); @@ -3473,14 +3473,14 @@ TEST_F(GestureRecognizerTest, NoDriftInScroll) { ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(101, 204), kTouchId, tes.LeapForward(40)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move3); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move3); EXPECT_FALSE(delegate->scroll_update()); delegate->Reset(); ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(101, 203), kTouchId, tes.LeapForward(40)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4); EXPECT_TRUE(delegate->scroll_update()); EXPECT_EQ(-1, delegate->scroll_y()); @@ -3504,13 +3504,13 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveCanFireTapCancel) { kTouchId, tes.Now()); delegate->set_consume_touch_move(false); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); delegate->set_consume_touch_move(true); delegate->Reset(); // Move the touch-point enough so that it would normally be considered a // scroll. But since the touch-moves will be consumed, the scroll should not // start. - tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get()); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); EXPECT_TRUE(delegate->tap_cancel()); @@ -3541,8 +3541,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()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p2); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p2); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); EXPECT_TRUE(delegate->tap_cancel()); @@ -3583,7 +3583,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPress) { ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_TRUE(delegate->tap_down()); EXPECT_TRUE(delegate->begin()); EXPECT_FALSE(delegate->tap_cancel()); @@ -3599,7 +3599,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPress) { delegate->Reset(); ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->long_press()); // Note the tap down isn't cancelled until the release @@ -3631,7 +3631,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) { ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_TRUE(delegate->tap_down()); // We haven't pressed long enough for a show press to occur @@ -3639,7 +3639,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) { EXPECT_FALSE(delegate->tap_cancel()); // Scroll around, to cancel the show press - tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get()); + tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get()); // Wait until the timer runs out gesture_sequence->ForceTimeout(); EXPECT_FALSE(delegate->show_press()); @@ -3648,7 +3648,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) { delegate->Reset(); ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.LeapForward(10)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_FALSE(delegate->show_press()); EXPECT_FALSE(delegate->tap_cancel()); } @@ -3669,7 +3669,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressSentOnTap) { ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now()); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); EXPECT_TRUE(delegate->tap_down()); // We haven't pressed long enough for a show press to occur @@ -3679,7 +3679,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressSentOnTap) { delegate->Reset(); ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), kTouchId, tes.LeapForward(50)); - root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); + dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1); EXPECT_TRUE(delegate->show_press()); EXPECT_FALSE(delegate->tap_cancel()); EXPECT_TRUE(delegate->tap()); |