Chromium Code Reviews| 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 ffe4d090b8b3ce8779e8785a3c7ba77a58577ead..6b57dbfe7ed0808887ff6ea98d2c53acaf208366 100644 |
| --- a/ui/chromeos/touch_exploration_controller_unittest.cc |
| +++ b/ui/chromeos/touch_exploration_controller_unittest.cc |
| @@ -818,6 +818,52 @@ 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(); |
| + |
| + // 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); |
| + |
| + // Touch moves should not send any events through, since the user should be |
|
aboxhall
2014/08/13 20:34:32
Assert that no events are sent through?
evy
2014/08/13 22:16:58
Done.
|
| + // in a wait for release state. |
| + gfx::Point move_location(44, 45); |
| + generator_->MoveTouch(move_location); |
| + |
| + generator_->ReleaseTouch(); |
| + |
| + std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents(); |
| + ASSERT_EQ(4U, captured_events.size()); |
| + EXPECT_EQ(ui::ET_MOUSE_MOVED, captured_events[0]->type()); |
|
aboxhall
2014/08/13 20:34:33
Would it be possible to assert these events are ca
evy
2014/08/13 22:16:57
Done.
|
| + EXPECT_EQ(ui::ET_MOUSE_MOVED, captured_events[1]->type()); |
| + EXPECT_EQ(ui::ET_TOUCH_PRESSED, captured_events[2]->type()); |
| + EXPECT_EQ(tap_location, captured_events[2]->location()); |
| + base::TimeDelta pressed_time = captured_events[2]->time_stamp(); |
| + EXPECT_EQ(ui::ET_TOUCH_RELEASED, captured_events[3]->type()); |
| + EXPECT_EQ(tap_location, captured_events[3]->location()); |
| + base::TimeDelta released_time = captured_events[3]->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) { |