summaryrefslogtreecommitdiffstats
path: root/ui/chromeos
diff options
context:
space:
mode:
authorevy@chromium.org <evy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-10 23:32:19 +0000
committerevy@chromium.org <evy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-10 23:32:19 +0000
commit558e8326e021562ceec044aed036a403365a2a4d (patch)
treed5487633921261d5d5d9f3368afbb69cfeed029a /ui/chromeos
parentdbcc3f8ada9013a8e6c8d5888d9b1729c4dc6c2f (diff)
downloadchromium_src-558e8326e021562ceec044aed036a403365a2a4d.zip
chromium_src-558e8326e021562ceec044aed036a403365a2a4d.tar.gz
chromium_src-558e8326e021562ceec044aed036a403365a2a4d.tar.bz2
Added a new test to ui/chromeos/touch_exploration_controller_unittest.cc that tests the case where the user double-taps but holds their finger down the second time, for a long-press.
Checked for touch pressed and touch released events, and that the time between press and release was the same as the length of the long-press. BUG=377040 NOTRY=true Review URL: https://codereview.chromium.org/317003002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276206 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/chromeos')
-rw-r--r--ui/chromeos/touch_exploration_controller_unittest.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/ui/chromeos/touch_exploration_controller_unittest.cc b/ui/chromeos/touch_exploration_controller_unittest.cc
index e572f1e..d0e43a5 100644
--- a/ui/chromeos/touch_exploration_controller_unittest.cc
+++ b/ui/chromeos/touch_exploration_controller_unittest.cc
@@ -651,4 +651,54 @@ TEST_F(TouchExplorationTest, DoubleTap) {
EXPECT_TRUE(IsInNoFingersDownState());
}
+
+// Double-tapping where the user holds their finger down for the second time
+// for a longer press should send a touch press and released (right click)
+// to the location of the last successful touch exploration.
+TEST_F(TouchExplorationTest, DoubleTapLongPress) {
+ SwitchTouchExplorationMode(true);
+
+ // Tap at one location, and get a mouse move event.
+ gfx::Point tap_location(11, 12);
+ generator_->set_current_location(tap_location);
+ generator_->PressTouch();
+ generator_->ReleaseTouch();
+ AdvanceSimulatedTimePastTapDelay();
+
+ std::vector<ui::LocatedEvent*> events =
+ GetCapturedEventsOfType(ui::ET_MOUSE_MOVED);
+ ASSERT_EQ(1U, events.size());
+
+ EXPECT_EQ(tap_location, events[0]->location());
+ EXPECT_TRUE(events[0]->flags() & ui::EF_IS_SYNTHESIZED);
+ EXPECT_TRUE(events[0]->flags() & ui::EF_TOUCH_ACCESSIBILITY);
+ ClearCapturedEvents();
+
+ // Now double-tap and hold at a different location.
+ // This should result in a single touch long press and release
+ // at the location of the tap, not at the location of the double-tap.
+ // There should be a time delay between the touch press and release.
+ gfx::Point first_tap_location(33, 34);
+ generator_->set_current_location(first_tap_location);
+ generator_->PressTouch();
+ generator_->ReleaseTouch();
+ gfx::Point second_tap_location(23, 24);
+ generator_->set_current_location(second_tap_location);
+ generator_->PressTouch();
+ simulated_clock_->Advance(base::TimeDelta::FromMilliseconds(8000));
+ generator_->ReleaseTouch();
+
+ const ScopedVector<ui::LocatedEvent>& captured_events = GetCapturedEvents();
+ ASSERT_EQ(2U, captured_events.size());
+ EXPECT_EQ(ui::ET_TOUCH_PRESSED, captured_events[0]->type());
+ EXPECT_EQ(tap_location, captured_events[0]->location());
+ base::TimeDelta pressed_time = captured_events[0]->time_stamp();
+ EXPECT_EQ(ui::ET_TOUCH_RELEASED, captured_events[1]->type());
+ EXPECT_EQ(tap_location, captured_events[1]->location());
+ base::TimeDelta released_time = captured_events[1]->time_stamp();
+ EXPECT_EQ(
+ base::TimeDelta::FromMilliseconds(8000),
+ released_time - pressed_time);
+}
+
} // namespace ui