diff options
author | noamsml@google.com <noamsml@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-09 23:55:05 +0000 |
---|---|---|
committer | noamsml@google.com <noamsml@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-09 23:55:05 +0000 |
commit | 98a4770f0f4c110fda6116b6b6846ee946d4c2c7 (patch) | |
tree | c2b793d55b3662b9f96732db7862e9f6ee7f96e2 /ui/aura/gestures | |
parent | 0f258ce73d57a4fe85e4fccba97efc118c2cda65 (diff) | |
download | chromium_src-98a4770f0f4c110fda6116b6b6846ee946d4c2c7.zip chromium_src-98a4770f0f4c110fda6116b6b6846ee946d4c2c7.tar.gz chromium_src-98a4770f0f4c110fda6116b6b6846ee946d4c2c7.tar.bz2 |
Revert 243974 "Target touches to the correct display."
> Target touches to the correct display.
>
> ui::TouchEvents now know the id of their source device.
>
> The target of a touch can't be effected by a touch on another display.
>
> BUG=315651
> TEST=GestureRecognizerTest.GestureEventTouchLockIgnoresOtherScreens
>
> Review URL: https://codereview.chromium.org/103173004
TBR=tdresser@chromium.org
Review URL: https://codereview.chromium.org/132363004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/gestures')
-rw-r--r-- | ui/aura/gestures/gesture_recognizer_unittest.cc | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc index 529af63..1ed8b30 100644 --- a/ui/aura/gestures/gesture_recognizer_unittest.cc +++ b/ui/aura/gestures/gesture_recognizer_unittest.cc @@ -2169,13 +2169,13 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) { // Touches should now be associated with the closest touch within // ui::GestureConfiguration::max_separation_for_gesture_touches_in_pixels - target = gesture_recognizer->GetTargetForLocation(gfx::Point(11, 11), -1); + target = gesture_recognizer->GetTargetForLocation(gfx::Point(11, 11)); EXPECT_EQ("0", WindowIDAsString(target)); - target = gesture_recognizer->GetTargetForLocation(gfx::Point(511, 11), -1); + target = gesture_recognizer->GetTargetForLocation(gfx::Point(511, 11)); EXPECT_EQ("1", WindowIDAsString(target)); - target = gesture_recognizer->GetTargetForLocation(gfx::Point(11, 511), -1); + target = gesture_recognizer->GetTargetForLocation(gfx::Point(11, 511)); EXPECT_EQ("2", WindowIDAsString(target)); - target = gesture_recognizer->GetTargetForLocation(gfx::Point(511, 511), -1); + target = gesture_recognizer->GetTargetForLocation(gfx::Point(511, 511)); EXPECT_EQ("3", WindowIDAsString(target)); // Add a touch in the middle associated with windows[2] @@ -2186,20 +2186,20 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) { kNumWindows, tes.Now()); dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move); - target = gesture_recognizer->GetTargetForLocation(gfx::Point(250, 250), -1); + target = gesture_recognizer->GetTargetForLocation(gfx::Point(250, 250)); EXPECT_EQ("2", WindowIDAsString(target)); // Make sure that ties are broken by distance to a current touch // Closer to the point in the bottom right. - target = gesture_recognizer->GetTargetForLocation(gfx::Point(380, 380), -1); + target = gesture_recognizer->GetTargetForLocation(gfx::Point(380, 380)); EXPECT_EQ("3", WindowIDAsString(target)); // This touch is closer to the point in the middle - target = gesture_recognizer->GetTargetForLocation(gfx::Point(300, 300), -1); + target = gesture_recognizer->GetTargetForLocation(gfx::Point(300, 300)); EXPECT_EQ("2", WindowIDAsString(target)); // A touch too far from other touches won't be locked to anything - target = gesture_recognizer->GetTargetForLocation(gfx::Point(1000, 1000), -1); + target = gesture_recognizer->GetTargetForLocation(gfx::Point(1000, 1000)); EXPECT_TRUE(target == NULL); // Move a touch associated with windows[2] to 1000, 1000 @@ -2207,7 +2207,7 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) { kNumWindows, tes.Now()); dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2); - target = gesture_recognizer->GetTargetForLocation(gfx::Point(1000, 1000), -1); + target = gesture_recognizer->GetTargetForLocation(gfx::Point(1000, 1000)); EXPECT_EQ("2", WindowIDAsString(target)); for (int i = 0; i < kNumWindows; ++i) { @@ -2217,36 +2217,6 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) { } } -// Check that a touch's target will not be effected by a touch on a different -// screen. -TEST_F(GestureRecognizerTest, GestureEventTouchLockIgnoresOtherScreens) { - scoped_ptr<GestureEventConsumeDelegate> delegate( - new GestureEventConsumeDelegate()); - gfx::Rect bounds(0, 0, 10, 10); - scoped_ptr<aura::Window> window( - CreateTestWindowWithDelegate(delegate.get(), 0, bounds, root_window())); - - const int kTouchId1 = 8; - const int kTouchId2 = 2; - TimedEvents tes; - - ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(5, 5), - kTouchId1, tes.Now()); - press1.set_source_device_id(1); - dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&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); - - // The second press should not have been locked to the same target as the - // first, as they occured on different displays. - EXPECT_NE( - ui::GestureRecognizer::Get()->GetTouchLockedTarget(press1), - ui::GestureRecognizer::Get()->GetTouchLockedTarget(press2)); -} - // Check that touch events outside the root window are still handled // by the root window's gesture sequence. TEST_F(GestureRecognizerTest, GestureEventOutsideRootWindowTap) { |