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

Unified Diff: ui/chromeos/touch_exploration_controller_unittest.cc

Issue 465543003: Modified state flow for touch explore released in touch_exploration_controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: log unrecognized state Created 6 years, 4 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 | « ui/chromeos/touch_exploration_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/chromeos/touch_exploration_controller_unittest.cc
diff --git a/ui/chromeos/touch_exploration_controller_unittest.cc b/ui/chromeos/touch_exploration_controller_unittest.cc
index c43885ecba68861cfac4be4cedd329ae02d66f5e..67861ce10f097be01d62206eee6f3b862c06871a 100644
--- a/ui/chromeos/touch_exploration_controller_unittest.cc
+++ b/ui/chromeos/touch_exploration_controller_unittest.cc
@@ -776,7 +776,7 @@ TEST_F(TouchExplorationTest, DoubleTapPassthrough) {
generator_->set_current_location(second_tap_location);
generator_->PressTouchId(1);
// Advance to the finger passing through.
- AdvanceSimulatedTimePastTapDelay();
+ AdvanceSimulatedTimePastPassthroughDelay();
gfx::Vector2d passthrough_offset = second_tap_location - tap_location;
@@ -864,7 +864,7 @@ TEST_F(TouchExplorationTest, DoubleTapLongPress) {
generator_->set_current_location(second_tap_location);
generator_->PressTouch();
// Advance to the finger passing through, and then to the longpress timeout.
- AdvanceSimulatedTimePastTapDelay();
+ AdvanceSimulatedTimePastPassthroughDelay();
simulated_clock_->Advance(gesture_detector_config_.longpress_timeout);
generator_->ReleaseTouch();
@@ -916,6 +916,61 @@ TEST_F(TouchExplorationTest, SingleTap) {
EXPECT_EQ(tap_location, captured_events[3]->location());
}
+// Single-tapping and holding should send a touch press and release through to
+// the location of the last successful touch exploration. There should be a
+// delay between the touch and release events (right click). The user should
+// not enter passthrough mode - touch moves should be discarded.
+TEST_F(TouchExplorationTest, SingleTapLongPress) {
+ SwitchTouchExplorationMode(true);
+
+ // Tap once to simulate a mouse moved event.
+ gfx::Point initial_location(11, 12);
+ generator_->set_current_location(initial_location);
+ generator_->PressTouch();
+ AdvanceSimulatedTimePastTapDelay();
+ ClearCapturedEvents();
+
+ // Move to another location for single tap
+ gfx::Point tap_location(22, 23);
+ generator_->MoveTouch(tap_location);
+ generator_->ReleaseTouch();
+
+ std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents();
+ ASSERT_EQ(2U, captured_events.size());
+ EXPECT_EQ(ui::ET_MOUSE_MOVED, captured_events[0]->type());
+ EXPECT_EQ(ui::ET_MOUSE_MOVED, captured_events[1]->type());
+ ClearCapturedEvents();
+
+ // Tap again for a long press single tap.
+ gfx::Point final_location(33, 34);
+ generator_->set_current_location(final_location);
+ generator_->PressTouch();
+ simulated_clock_->Advance(gesture_detector_config_.longpress_timeout);
+
+ captured_events = GetCapturedLocatedEvents();
+ ASSERT_EQ(1U, 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();
+ ClearCapturedEvents();
+
+ // Touch moves should not send any events through, since the user should be
+ // in a wait for release state.
+ gfx::Point move_location(44, 45);
+ generator_->MoveTouch(move_location);
+ captured_events = GetCapturedLocatedEvents();
+ ASSERT_EQ(0U, captured_events.size());
+
+ generator_->ReleaseTouch();
+ captured_events = GetCapturedLocatedEvents();
+ ASSERT_EQ(1U, captured_events.size());
+ EXPECT_EQ(ui::ET_TOUCH_RELEASED, captured_events[0]->type());
+ EXPECT_EQ(tap_location, captured_events[0]->location());
+ base::TimeDelta released_time = captured_events[0]->time_stamp();
+ EXPECT_EQ(gesture_detector_config_.longpress_timeout,
+ released_time - pressed_time);
+}
+
// Double-tapping without coming from touch exploration (no previous touch
// exploration event) should not generate any events.
TEST_F(TouchExplorationTest, DoubleTapNoTouchExplore) {
« no previous file with comments | « ui/chromeos/touch_exploration_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698