summaryrefslogtreecommitdiffstats
path: root/ui/events
diff options
context:
space:
mode:
authorlanwei <lanwei@chromium.org>2014-11-11 12:19:29 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-11 20:19:48 +0000
commitaea8be38fa47e4c1dadacc88faf43a6b099a146f (patch)
tree9cb1584eeb5069fb312f2a785f359681db068f76 /ui/events
parentdfac03e1bd435b80b3c6a588ca8dd98954073185 (diff)
downloadchromium_src-aea8be38fa47e4c1dadacc88faf43a6b099a146f.zip
chromium_src-aea8be38fa47e4c1dadacc88faf43a6b099a146f.tar.gz
chromium_src-aea8be38fa47e4c1dadacc88faf43a6b099a146f.tar.bz2
Reset all the values in the gesture configuration in AuraTestBase::SetUp()
In order to isolate the gesture configuration values for unit tests from the default values of GestureConfiguration instance (so that changing configuration values won't cause unit test failures), we will explicit reset all the values in the gesture configuration in AuraTestBase::SetUp() for every unit test. BUG=428004 Review URL: https://codereview.chromium.org/694973002 Cr-Commit-Position: refs/heads/master@{#303707}
Diffstat (limited to 'ui/events')
-rw-r--r--ui/events/gesture_detection/gesture_configuration.cc8
-rw-r--r--ui/events/gesture_detection/gesture_configuration.h49
2 files changed, 31 insertions, 26 deletions
diff --git a/ui/events/gesture_detection/gesture_configuration.cc b/ui/events/gesture_detection/gesture_configuration.cc
index b93ab06..f81cc1a 100644
--- a/ui/events/gesture_detection/gesture_configuration.cc
+++ b/ui/events/gesture_detection/gesture_configuration.cc
@@ -32,9 +32,8 @@ GestureConfiguration::GestureConfiguration()
// The default value of min_scaling_touch_major_ is 2 * default_radius_.
min_scaling_touch_major_(50),
min_swipe_velocity_(20),
- velocity_tracker_strategy_(VelocityTracker::Strategy::STRATEGY_DEFAULT),
-// TODO(jdduke): Disable and remove entirely when issues with intermittent
-// scroll end detection on the Pixel are resolved, crbug.com/353702.
+ // TODO(jdduke): Disable and remove entirely when issues with intermittent
+ // scroll end detection on the Pixel are resolved, crbug.com/353702.
#if defined(OS_CHROMEOS)
scroll_debounce_interval_in_ms_(30),
#else
@@ -47,7 +46,8 @@ GestureConfiguration::GestureConfiguration()
span_slop_(30),
swipe_enabled_(false),
tab_scrub_activation_delay_in_ms_(200),
- two_finger_tap_enabled_(false) {
+ two_finger_tap_enabled_(false),
+ velocity_tracker_strategy_(VelocityTracker::Strategy::STRATEGY_DEFAULT) {
}
GestureConfiguration::~GestureConfiguration() {
diff --git a/ui/events/gesture_detection/gesture_configuration.h b/ui/events/gesture_detection/gesture_configuration.h
index de05e11..b7ddb2a 100644
--- a/ui/events/gesture_detection/gesture_configuration.h
+++ b/ui/events/gesture_detection/gesture_configuration.h
@@ -40,6 +40,9 @@ class GESTURE_DETECTION_EXPORT GestureConfiguration {
bool gesture_begin_end_types_enabled() const {
return gesture_begin_end_types_enabled_;
}
+ void set_gesture_begin_end_types_enabled(bool val) {
+ gesture_begin_end_types_enabled_ = val;
+ }
int long_press_time_in_ms() const { return long_press_time_in_ms_; }
void set_long_press_time_in_ms(int val) { long_press_time_in_ms_ = val; }
float max_distance_between_taps_for_double_tap() const {
@@ -59,6 +62,9 @@ class GESTURE_DETECTION_EXPORT GestureConfiguration {
float max_gesture_bounds_length() const {
return max_gesture_bounds_length_;
}
+ void set_max_gesture_bounds_length(float val) {
+ max_gesture_bounds_length_ = val;
+ }
float max_separation_for_gesture_touches_in_pixels() const {
return max_separation_for_gesture_touches_in_pixels_;
}
@@ -68,6 +74,9 @@ class GESTURE_DETECTION_EXPORT GestureConfiguration {
float max_swipe_deviation_angle() const {
return max_swipe_deviation_angle_;
}
+ void set_max_swipe_deviation_angle(float val) {
+ max_swipe_deviation_angle_ = val;
+ }
int max_time_between_double_click_in_ms() const {
return max_time_between_double_click_in_ms_;
}
@@ -94,6 +103,7 @@ class GESTURE_DETECTION_EXPORT GestureConfiguration {
min_distance_for_pinch_scroll_in_pixels_ = val;
}
float min_fling_velocity() const { return min_fling_velocity_; }
+ void set_min_fling_velocity(float val) { min_fling_velocity_ = val; }
float min_gesture_bounds_length() const {
return min_gesture_bounds_length_;
}
@@ -106,6 +116,9 @@ class GESTURE_DETECTION_EXPORT GestureConfiguration {
float min_scaling_span_in_pixels() const {
return min_scaling_span_in_pixels_;
}
+ void set_min_scaling_span_in_pixels(float val) {
+ min_scaling_span_in_pixels_ = val;
+ }
float min_scaling_touch_major() const { return min_scaling_touch_major_; }
float min_swipe_velocity() const { return min_swipe_velocity_; }
void set_min_swipe_velocity(float val) { min_swipe_velocity_ = val; }
@@ -118,9 +131,6 @@ class GESTURE_DETECTION_EXPORT GestureConfiguration {
int semi_long_press_time_in_ms() const {
return semi_long_press_time_in_ms_;
}
- VelocityTracker::Strategy velocity_tracker_strategy() const {
- return velocity_tracker_strategy_;
- }
void set_semi_long_press_time_in_ms(int val) {
semi_long_press_time_in_ms_ = val;
double_tap_timeout_in_ms_ = val;
@@ -131,6 +141,7 @@ class GESTURE_DETECTION_EXPORT GestureConfiguration {
}
float span_slop() const { return span_slop_; }
bool swipe_enabled() const { return swipe_enabled_; }
+ void set_swipe_enabled(bool val) { swipe_enabled_ = val; }
// TODO(davemoore): Move into chrome/browser/ui.
int tab_scrub_activation_delay_in_ms() const {
@@ -140,42 +151,36 @@ class GESTURE_DETECTION_EXPORT GestureConfiguration {
tab_scrub_activation_delay_in_ms_ = val;
}
bool two_finger_tap_enabled() const { return two_finger_tap_enabled_; }
+ void set_two_finger_tap_enabled(bool val) { two_finger_tap_enabled_ = val; }
+ VelocityTracker::Strategy velocity_tracker_strategy() const {
+ return velocity_tracker_strategy_;
+ }
+ void set_velocity_tracker_strategy(VelocityTracker::Strategy val) {
+ velocity_tracker_strategy_ = val;
+ }
protected:
GestureConfiguration();
virtual ~GestureConfiguration();
+ // The below configuration parameters are dependent on other parameters,
+ // whose setter functions will setup these values as well, so we will not
+ // provide public setter functions for them.
void set_double_tap_timeout_in_ms(int val) {
double_tap_timeout_in_ms_ = val;
}
- void set_gesture_begin_end_types_enabled(bool val) {
- gesture_begin_end_types_enabled_ = val;
- }
- void set_max_gesture_bounds_length(float val) {
- max_gesture_bounds_length_ = val;
- }
- void set_max_swipe_deviation_angle(float val) {
- max_swipe_deviation_angle_ = val;
- }
- void set_min_fling_velocity(float val) { min_fling_velocity_ = val; }
void set_min_gesture_bounds_length(float val) {
min_gesture_bounds_length_ = val;
}
- void set_min_scaling_span_in_pixels(float val) {
- min_scaling_span_in_pixels_ = val;
- }
void set_min_scaling_touch_major(float val) {
min_scaling_touch_major_ = val;
}
- void set_velocity_tracker_strategy(VelocityTracker::Strategy val) {
- velocity_tracker_strategy_ = val;
- }
void set_span_slop(float val) { span_slop_ = val; }
- void set_swipe_enabled(bool val) { swipe_enabled_ = val; }
- void set_two_finger_tap_enabled(bool val) { two_finger_tap_enabled_ = val; }
private:
// These are listed in alphabetical order ignoring underscores.
+ // NOTE: Adding new configuration parameters requires initializing
+ // corresponding entries in aura_test_base.cc's SetUp().
// The default touch radius length used when the only information given
// by the device is the touch center.
@@ -211,7 +216,6 @@ class GESTURE_DETECTION_EXPORT GestureConfiguration {
float min_scaling_span_in_pixels_;
float min_scaling_touch_major_;
float min_swipe_velocity_;
- VelocityTracker::Strategy velocity_tracker_strategy_;
int scroll_debounce_interval_in_ms_;
int semi_long_press_time_in_ms_;
int show_press_delay_in_ms_;
@@ -221,6 +225,7 @@ class GESTURE_DETECTION_EXPORT GestureConfiguration {
// TODO(davemoore): Move into chrome/browser/ui.
int tab_scrub_activation_delay_in_ms_;
bool two_finger_tap_enabled_;
+ VelocityTracker::Strategy velocity_tracker_strategy_;
friend struct DefaultSingletonTraits<GestureConfiguration>;
DISALLOW_COPY_AND_ASSIGN(GestureConfiguration);