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 3d0fbb69a86ad8052e03d58260c7a46c4ef879e1..479e78186c0a97e5d09ec2757b98e6742699fc3e 100644 |
--- a/ui/chromeos/touch_exploration_controller_unittest.cc |
+++ b/ui/chromeos/touch_exploration_controller_unittest.cc |
@@ -652,6 +652,7 @@ TEST_F(TouchExplorationTest, SplitTap) { |
EXPECT_TRUE(events[0]->flags() & ui::EF_IS_SYNTHESIZED); |
EXPECT_TRUE(events[0]->flags() & ui::EF_TOUCH_ACCESSIBILITY); |
ClearCapturedEvents(); |
+ EXPECT_TRUE(IsInTouchToMouseMode()); |
// Now tap and release at a different location. This should result in a |
// single touch and release at the location of the first (held) tap, |
@@ -660,18 +661,31 @@ TEST_F(TouchExplorationTest, SplitTap) { |
ui::TouchEvent split_tap_press( |
ui::ET_TOUCH_PRESSED, second_touch_location, 1, Now()); |
generator_->Dispatch(&split_tap_press); |
+ // To simulate the behavior of the real device, we manually disable |
+ // mouse events. To not rely on manually setting the state, this is also |
+ // tested in touch_exploration_controller_browsertest. |
+ cursor_client()->DisableMouseEvents(); |
EXPECT_FALSE(IsInGestureInProgressState()); |
ui::TouchEvent split_tap_release( |
ui::ET_TOUCH_RELEASED, second_touch_location, 1, Now()); |
generator_->Dispatch(&split_tap_release); |
EXPECT_FALSE(IsInNoFingersDownState()); |
- |
+ // Releasing the second finger should re-enable mouse events putting us |
+ // back into the touch exploration mode. |
+ EXPECT_TRUE(IsInTouchToMouseMode()); |
std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents(); |
ASSERT_EQ(2U, captured_events.size()); |
EXPECT_EQ(ui::ET_TOUCH_PRESSED, captured_events[0]->type()); |
EXPECT_EQ(initial_touch_location, captured_events[0]->location()); |
EXPECT_EQ(ui::ET_TOUCH_RELEASED, captured_events[1]->type()); |
EXPECT_EQ(initial_touch_location, captured_events[1]->location()); |
+ ClearCapturedEvents(); |
+ |
+ ui::TouchEvent touch_explore_release( |
+ ui::ET_TOUCH_RELEASED, initial_touch_location, 0, Now()); |
+ generator_->Dispatch(&touch_explore_release); |
+ AdvanceSimulatedTimePastTapDelay(); |
+ EXPECT_TRUE(IsInNoFingersDownState()); |
} |
// If split tap is started but the touch explore finger is released first, |
@@ -736,7 +750,8 @@ TEST_F(TouchExplorationTest, SplitTapLongPress) { |
// Now tap and release at a different location. This should result in a |
mfomitchev
2014/07/09 13:26:02
Would be nice to clarify we are doing a long press
evy
2014/07/09 18:20:19
Done.
|
// single touch and release at the location of the first (held) tap, |
// not at the location of the second tap and release. |
- // After the release, there is still a finger in touch explore mode. |
+ // After the release, there is still a finger in touch exploration, and |
+ // touches from this finger should trigger mouse events. |
mfomitchev
2014/07/09 13:26:02
Nit: It doesn't seem we are testing that "touches
evy
2014/07/09 18:20:19
Done.
|
ui::TouchEvent split_tap_press( |
ui::ET_TOUCH_PRESSED, second_touch_location, 1, Now()); |
generator_->Dispatch(&split_tap_press); |
@@ -745,6 +760,7 @@ TEST_F(TouchExplorationTest, SplitTapLongPress) { |
ui::ET_TOUCH_RELEASED, second_touch_location, 1, Now()); |
generator_->Dispatch(&split_tap_release); |
EXPECT_FALSE(IsInNoFingersDownState()); |
+ EXPECT_TRUE(IsInTouchToMouseMode()); |
std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents(); |
ASSERT_EQ(2U, captured_events.size()); |