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

Unified Diff: chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc

Issue 428673002: Fix Touch Exploration tests so they don't break eager gesture detection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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: chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc
diff --git a/chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc b/chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc
index ed22cac686682d2be8ed80eb39bd67b8c8af8ef9..470f84bf30a3be7affcae204fa63ea4c2c2e0214 100644
--- a/chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc
+++ b/chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc
@@ -83,10 +83,53 @@ private:
DISALLOW_COPY_AND_ASSIGN(TouchExplorationTest);
};
-// This test turns the touch exploration mode on/off and confirms that events
-// get rewritten when the touch exploration mode is on, and aren't affected
-// after the touch exploration mode is turned off.
-IN_PROC_BROWSER_TEST_F(TouchExplorationTest, ToggleOnOff) {
+// This test turns the touch exploration mode off and confirms that events
+// aren't modified.
+IN_PROC_BROWSER_TEST_F(TouchExplorationTest, NoRewritingEventsWhenOff) {
+ SwitchTouchExplorationMode(false);
+ ui::test::EventGenerator generator(root_window_);
+
+ base::TimeDelta initial_time = Now();
+ ui::TouchEvent initial_press(
+ ui::ET_TOUCH_PRESSED, gfx::Point(100, 200), 1, initial_time);
+ generator.Dispatch(&initial_press);
+
+ ui::TouchEvent touch_time_advance(ui::ET_TOUCH_MOVED,
+ gfx::Point(100, 200),
+ 1,
+ initial_time +
+ gesture_detector_config_.double_tap_timeout +
+ base::TimeDelta::FromMilliseconds(1));
+ generator.Dispatch(&touch_time_advance);
+
+ // Number of mouse events may be greater than 1 because of ET_MOUSE_ENTERED.
+ EXPECT_EQ(0, event_handler_->num_mouse_events());
+ EXPECT_EQ(2, event_handler_->num_touch_events());
+ event_handler_->Reset();
+
+ generator.MoveTouchId(gfx::Point(11, 12), 1);
+ EXPECT_EQ(0, event_handler_->num_mouse_events());
+ EXPECT_EQ(1, event_handler_->num_touch_events());
+ event_handler_->Reset();
+
+ initial_time = Now();
+ ui::TouchEvent second_initial_press(
+ ui::ET_TOUCH_PRESSED, gfx::Point(500, 600), 2, initial_time);
+ generator.Dispatch(&second_initial_press);
+ ui::TouchEvent second_touch_time_advance(
+ ui::ET_TOUCH_MOVED,
+ gfx::Point(500, 600),
+ 2,
+ initial_time + gesture_detector_config_.double_tap_timeout +
+ base::TimeDelta::FromMilliseconds(1));
+ generator.Dispatch(&second_touch_time_advance);
+ EXPECT_EQ(0, event_handler_->num_mouse_events());
+ EXPECT_EQ(2, event_handler_->num_touch_events());
+}
+
+// This test turns the touch exploration mode on and confirms that events get
+// rewritten.
+IN_PROC_BROWSER_TEST_F(TouchExplorationTest, RewritesEventsWhenOn) {
SwitchTouchExplorationMode(true);
ui::test::EventGenerator generator(root_window_);
@@ -113,13 +156,6 @@ IN_PROC_BROWSER_TEST_F(TouchExplorationTest, ToggleOnOff) {
EXPECT_EQ(0, event_handler_->num_touch_events());
event_handler_->Reset();
- SwitchTouchExplorationMode(false);
- generator.MoveTouchId(gfx::Point(11, 12), 1);
- EXPECT_EQ(0, event_handler_->num_mouse_events());
- EXPECT_EQ(1, event_handler_->num_touch_events());
- event_handler_->Reset();
-
- SwitchTouchExplorationMode(true);
initial_time = Now();
ui::TouchEvent second_initial_press(
ui::ET_TOUCH_PRESSED, gfx::Point(500, 600), 2, initial_time);
@@ -132,7 +168,7 @@ IN_PROC_BROWSER_TEST_F(TouchExplorationTest, ToggleOnOff) {
base::TimeDelta::FromMilliseconds(1));
generator.Dispatch(&second_touch_time_advance);
EXPECT_GT(event_handler_->num_mouse_events(), 0);
- EXPECT_EQ(0, event_handler_->num_touch_events());
+ EXPECT_EQ(1, event_handler_->num_touch_events());
}
// This test makes sure that after the user clicks with split tap,
« no previous file with comments | « no previous file | ui/chromeos/touch_exploration_controller.h » ('j') | ui/chromeos/touch_exploration_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698