summaryrefslogtreecommitdiffstats
path: root/ui/chromeos
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-29 05:41:36 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-29 05:41:36 +0000
commite0cc8e2ac33e2943920e8b0f0184cce62c01fd5a (patch)
tree6582f7e34090a1e9c8da4e133637fc1967650edb /ui/chromeos
parente80d9c1dfe495c120e68e25ff6963637e3c86e28 (diff)
downloadchromium_src-e0cc8e2ac33e2943920e8b0f0184cce62c01fd5a.zip
chromium_src-e0cc8e2ac33e2943920e8b0f0184cce62c01fd5a.tar.gz
chromium_src-e0cc8e2ac33e2943920e8b0f0184cce62c01fd5a.tar.bz2
Revert of Fix Touch Exploration tests so they don't break eager gesture detection. (https://codereview.chromium.org/428673002/)
Reason for revert: The "TouchExplorationTest.RewritesEventsWhenOn" test failing on "Linux Chromium OS ASan LSan Tests (2)": http://build.chromium.org/p/chromium.memory/builders/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20%282%29/builds/2152 Original issue's description: > Fix Touch Exploration tests so they don't break eager gesture detection. > > Eager gesture detection is a little bit stricter about requiring > a valid event stream. The touch exploration tests give the > gesture detector an invalid event stream in a few places. > > BUG=398106 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=285983 TBR=dmazzoni@chromium.org,lisayin@chromium.org,mfomitchev@chromium.org,tdresser@chromium.org NOTREECHECKS=true NOTRY=true BUG=398106 Review URL: https://codereview.chromium.org/428643008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286104 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/chromeos')
-rw-r--r--ui/chromeos/touch_exploration_controller.cc7
-rw-r--r--ui/chromeos/touch_exploration_controller.h4
-rw-r--r--ui/chromeos/touch_exploration_controller_unittest.cc8
3 files changed, 18 insertions, 1 deletions
diff --git a/ui/chromeos/touch_exploration_controller.cc b/ui/chromeos/touch_exploration_controller.cc
index 3670f1e..6b2584a 100644
--- a/ui/chromeos/touch_exploration_controller.cc
+++ b/ui/chromeos/touch_exploration_controller.cc
@@ -35,6 +35,7 @@ TouchExplorationController::TouchExplorationController(
: root_window_(root_window),
delegate_(delegate),
state_(NO_FINGERS_DOWN),
+ event_handler_for_testing_(NULL),
gesture_provider_(this),
prev_state_(NO_FINGERS_DOWN),
VLOG_on_(true),
@@ -592,13 +593,13 @@ void TouchExplorationController::OnTapTimerFired() {
case GESTURE_IN_PROGRESS:
// Discard any pending gestures.
delete gesture_provider_.GetAndResetPendingGestures();
+ EnterTouchToMouseMode();
state_ = TOUCH_EXPLORATION;
VLOG_STATE();
break;
default:
return;
}
- EnterTouchToMouseMode();
scoped_ptr<ui::Event> mouse_move =
CreateMouseMoveEvent(initial_press_->location(), initial_press_->flags());
DispatchEvent(mouse_move.get());
@@ -606,6 +607,10 @@ void TouchExplorationController::OnTapTimerFired() {
}
void TouchExplorationController::DispatchEvent(ui::Event* event) {
+ if (event_handler_for_testing_) {
+ event_handler_for_testing_->OnEvent(event);
+ return;
+ }
ui::EventDispatchDetails result ALLOW_UNUSED =
root_window_->GetHost()->dispatcher()->OnEventFromSource(event);
}
diff --git a/ui/chromeos/touch_exploration_controller.h b/ui/chromeos/touch_exploration_controller.h
index 59ff114..8771636 100644
--- a/ui/chromeos/touch_exploration_controller.h
+++ b/ui/chromeos/touch_exploration_controller.h
@@ -374,6 +374,10 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
// A timer to fire an indicating sound when sliding to change volume.
base::RepeatingTimer<TouchExplorationController> sound_timer_;
+ // For testing only, an event handler to use for generated events
+ // outside of the normal event rewriting flow.
+ ui::EventHandler* event_handler_for_testing_;
+
// A default gesture detector config, so we can share the same
// timeout and pixel slop constants.
ui::GestureDetector::Config gesture_detector_config_;
diff --git a/ui/chromeos/touch_exploration_controller_unittest.cc b/ui/chromeos/touch_exploration_controller_unittest.cc
index ffe4d09..f305e2b4 100644
--- a/ui/chromeos/touch_exploration_controller_unittest.cc
+++ b/ui/chromeos/touch_exploration_controller_unittest.cc
@@ -112,6 +112,12 @@ class TouchExplorationControllerTestApi {
}
}
+ void SetEventHandlerForTesting(
+ ui::EventHandler* event_handler_for_testing) {
+ touch_exploration_controller_->event_handler_for_testing_ =
+ event_handler_for_testing;
+ }
+
bool IsInNoFingersDownStateForTesting() const {
return touch_exploration_controller_->state_ ==
touch_exploration_controller_->NO_FINGERS_DOWN;
@@ -254,6 +260,8 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
touch_exploration_controller_.reset(
new ui::TouchExplorationControllerTestApi(
new TouchExplorationController(root_window(), &delegate_)));
+ touch_exploration_controller_->SetEventHandlerForTesting(
+ &event_capturer_);
cursor_client()->ShowCursor();
cursor_client()->DisableMouseEvents();
}