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

Unified Diff: ui/chromeos/touch_exploration_controller_unittest.cc

Issue 359453003: Added accurate TouchToMouseMode testing to SplitTap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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
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 86582f0ff06b5bc06698b094700dc7c677d3e52e..8293367d83e82ccfba276b10eec1b8b883a3a966 100644
--- a/ui/chromeos/touch_exploration_controller_unittest.cc
+++ b/ui/chromeos/touch_exploration_controller_unittest.cc
@@ -782,6 +782,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,
@@ -790,10 +791,17 @@ 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();
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());
const ScopedVector<ui::LocatedEvent>& captured_events = GetCapturedEvents();
ASSERT_EQ(2U, captured_events.size());
@@ -801,6 +809,13 @@ TEST_F(TouchExplorationTest, SplitTap) {
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();
mfomitchev 2014/06/27 19:15:46 Hmm.. why do we advance the time? Doesn't seems li
evy 2014/06/30 23:28:47 We added single tap, which means that when you lif
+ EXPECT_TRUE(IsInNoFingersDownState());
}
// If split tap is started but the touch explore finger is released first,

Powered by Google App Engine
This is Rietveld 408576698