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 1ec3f8bde25b675a50b95588d459a4f18c51a25d..0c640d36455fa9bb9333e8106b4ce3f43cc9e4a7 100644 |
--- a/ui/chromeos/touch_exploration_controller_unittest.cc |
+++ b/ui/chromeos/touch_exploration_controller_unittest.cc |
@@ -155,16 +155,24 @@ TEST_F(TouchExplorationTest, OneFingerTouch) { |
SwitchTouchExplorationMode(true); |
cursor_client()->ShowCursor(); |
cursor_client()->DisableMouseEvents(); |
+ |
aura::test::EventGenerator generator(root_window()); |
- gfx::Point location_start = generator.current_location(); |
- gfx::Point location_end(11, 12); |
+ gfx::Point location_start(11, 12); |
+ gfx::Point location_end(13, 14); |
+ generator.set_current_location(location_start); |
+ generator.set_simulated_time(base::TimeDelta::FromMilliseconds(1000)); |
generator.PressTouch(); |
- EXPECT_TRUE(IsInTouchToMouseMode()); |
+ EXPECT_FALSE(IsInTouchToMouseMode()); |
+ |
+ generator.set_simulated_time(base::TimeDelta::FromMilliseconds(2000)); |
generator.MoveTouch(location_end); |
+ EXPECT_TRUE(IsInTouchToMouseMode()); |
mfomitchev
2014/05/28 17:47:45
Can we move this check up before the move?
dmazzoni
2014/05/31 06:53:24
Yes, that makes sense. To do that I had to create
|
+ |
// Confirm the actual mouse moves are unaffected. |
+ gfx::Point location_real_mouse_move(13, 14); |
ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, |
- gfx::Point(13, 14), |
- gfx::Point(13, 14), |
+ location_real_mouse_move, |
+ location_real_mouse_move, |
0, |
0); |
generator.Dispatch(&mouse_move); |
@@ -181,19 +189,20 @@ TEST_F(TouchExplorationTest, OneFingerTouch) { |
if (type == ui::ET_MOUSE_ENTERED || type == ui::ET_MOUSE_EXITED) |
continue; |
EXPECT_EQ(ui::ET_MOUSE_MOVED, (*it)->type()); |
- if (num_mouse_moves == 0) |
- EXPECT_EQ(location_start, (*it)->location()); |
- if (num_mouse_moves == 1 || num_mouse_moves == 3) |
+ |
+ if (num_mouse_moves == 0) { |
mfomitchev
2014/05/28 17:47:45
I think there should be a synthesized mouse move a
dmazzoni
2014/05/31 06:53:24
Agreed, you see all of those now.
(The one for th
|
EXPECT_EQ(location_end, (*it)->location()); |
- if (num_mouse_moves == 2) |
- CONFIRM_EVENTS_ARE_MOUSE_AND_EQUAL(*it, &mouse_move); |
- if (num_mouse_moves != 2) { |
EXPECT_TRUE((*it)->flags() & ui::EF_IS_SYNTHESIZED); |
EXPECT_TRUE((*it)->flags() & ui::EF_FROM_TOUCH); |
} |
+ if (num_mouse_moves == 1) { |
+ EXPECT_EQ(location_real_mouse_move, (*it)->location()); |
+ CONFIRM_EVENTS_ARE_MOUSE_AND_EQUAL(*it, &mouse_move); |
+ } |
+ |
num_mouse_moves++; |
} |
- EXPECT_EQ(4, num_mouse_moves); |
+ EXPECT_EQ(2, num_mouse_moves); |
} |
// Turn the touch exploration mode on in the middle of the touch gesture. |