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

Unified Diff: content/browser/renderer_host/input/gesture_text_selector_unittest.cc

Issue 468043003: Ignore min/max gesture bounds for mouse or stylus-derived gestures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GestureTextSelectorTest Created 6 years, 4 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
« no previous file with comments | « no previous file | content/browser/renderer_host/input/motion_event_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/input/gesture_text_selector_unittest.cc
diff --git a/content/browser/renderer_host/input/gesture_text_selector_unittest.cc b/content/browser/renderer_host/input/gesture_text_selector_unittest.cc
index cf1e3b93d4e13c8ad31e9a48afe33694c5603711..1ca90d1bdb61f94619e45f9922b5b845d95cc1d1 100644
--- a/content/browser/renderer_host/input/gesture_text_selector_unittest.cc
+++ b/content/browser/renderer_host/input/gesture_text_selector_unittest.cc
@@ -57,6 +57,22 @@ class GestureTextSelectorTest : public testing::Test,
}
protected:
+ static GestureEventData CreateGesture(ui::EventType type,
+ base::TimeTicks event_time,
+ float x,
+ float y) {
+ return GestureEventData(GestureEventDetails(type, 0, 0),
+ 0,
+ MotionEvent::TOOL_TYPE_FINGER,
+ event_time,
+ x,
+ y,
+ x,
+ y,
+ 1,
+ gfx::RectF(0, 0, 0, 0));
+ }
+
scoped_ptr<GestureTextSelector> selector_;
std::vector<std::string> event_log_;
};
@@ -130,25 +146,22 @@ TEST_F(GestureTextSelectorTest, PenDragging) {
// 3. DOUBLE TAP
// Suppress most gesture events when in text selection mode.
event_time += base::TimeDelta::FromMilliseconds(10);
- const GestureEventData double_tap(
- GestureEventDetails(ui::ET_GESTURE_DOUBLE_TAP, 0, 0), 0, event_time,
- x2, y2, x2, y2, 1, gfx::RectF(0, 0, 0, 0));
+ const GestureEventData double_tap =
+ CreateGesture(ui::ET_GESTURE_DOUBLE_TAP, event_time, x2, y2);
EXPECT_TRUE(selector_->OnGestureEvent(double_tap));
EXPECT_TRUE(event_log_.empty());
// 4. ET_GESTURE_SCROLL_BEGIN
event_time += base::TimeDelta::FromMilliseconds(10);
- const GestureEventData scroll_begin(
- GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN, 0, 0), 0, event_time,
- x1, y1, x1, y1, 1, gfx::RectF(0, 0, 0, 0));
+ const GestureEventData scroll_begin =
+ CreateGesture(ui::ET_GESTURE_SCROLL_BEGIN, event_time, x1, y1);
EXPECT_TRUE(selector_->OnGestureEvent(scroll_begin));
EXPECT_EQ(1u, event_log_.size()); // Unselect
// 5. ET_GESTURE_SCROLL_UPDATE
event_time += base::TimeDelta::FromMilliseconds(10);
- const GestureEventData scroll_update(
- GestureEventDetails(ui::ET_GESTURE_SCROLL_UPDATE, 0, 0), 0, event_time,
- x2, y2, x2, y2, 1, gfx::RectF(0, 0, 0, 0));
+ const GestureEventData scroll_update =
+ CreateGesture(ui::ET_GESTURE_SCROLL_UPDATE, event_time, x2, y2);
EXPECT_TRUE(selector_->OnGestureEvent(scroll_update));
EXPECT_EQ(3u, event_log_.size()); // Unselect, Show, SelectRange
EXPECT_STREQ("SelectRange", event_log_.back().c_str());
@@ -163,9 +176,8 @@ TEST_F(GestureTextSelectorTest, PenDragging) {
// 7. ET_GESTURE_SCROLL_END
event_time += base::TimeDelta::FromMilliseconds(10);
- const GestureEventData scroll_end(
- GestureEventDetails(ui::ET_GESTURE_SCROLL_END, 0, 0), 0, event_time,
- x2, y2, x2, y2, 1, gfx::RectF(0, 0, 0, 0));
+ const GestureEventData scroll_end =
+ CreateGesture(ui::ET_GESTURE_SCROLL_END, event_time, x2, y2);
EXPECT_TRUE(selector_->OnGestureEvent(scroll_end));
EXPECT_EQ(3u, event_log_.size()); // NO CHANGE
}
@@ -186,9 +198,8 @@ TEST_F(GestureTextSelectorTest, TapToSelectWord) {
// 5. TAP_DOWN
event_time += base::TimeDelta::FromMilliseconds(10);
- const GestureEventData tap_down(
- GestureEventDetails(ui::ET_GESTURE_TAP_DOWN, 0, 0), 0, event_time,
- x2, y2, x2, y2, 1, gfx::RectF(0, 0, 0, 0));
+ const GestureEventData tap_down =
+ CreateGesture(ui::ET_GESTURE_TAP_DOWN, event_time, x2, y2);
EXPECT_TRUE(selector_->OnGestureEvent(tap_down));
EXPECT_TRUE(event_log_.empty());
@@ -210,9 +221,8 @@ TEST_F(GestureTextSelectorTest, TapToSelectWord) {
// 4. TAP
event_time += base::TimeDelta::FromMilliseconds(10);
- const GestureEventData tap(
- GestureEventDetails(ui::ET_GESTURE_TAP, 0, 0), 0, event_time,
- x1, y1, x1, y1, 1, gfx::RectF(0, 0, 0, 0));
+ const GestureEventData tap =
+ CreateGesture(ui::ET_GESTURE_TAP, event_time, x1, y1);
EXPECT_TRUE(selector_->OnGestureEvent(tap));
EXPECT_EQ(1u, event_log_.size()); // LongPress
EXPECT_STREQ("LongPress", event_log_.back().c_str());
« no previous file with comments | « no previous file | content/browser/renderer_host/input/motion_event_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698