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

Unified Diff: ui/views/controls/textfield/textfield_unittest.cc

Issue 577833003: Revert of Clean up GestureEventDetails constructors and fix unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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: ui/views/controls/textfield/textfield_unittest.cc
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc
index b7a61170db195132f0ae35a3da81bf22d76b48fa..2cd92c08966fc61bc2fc69c8d57486ec7cc48bcf 100644
--- a/ui/views/controls/textfield/textfield_unittest.cc
+++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -103,8 +103,16 @@
// Convenience to make constructing a GestureEvent simpler.
class GestureEventForTest : public ui::GestureEvent {
public:
- GestureEventForTest(int x, int y, ui::GestureEventDetails details)
- : GestureEvent(x, y, 0, base::TimeDelta(), details) {}
+ GestureEventForTest(ui::EventType type,
+ int x,
+ int y,
+ float delta_x,
+ float delta_y)
+ : GestureEvent(x,
+ y,
+ 0,
+ base::TimeDelta(),
+ ui::GestureEventDetails(type, delta_x, delta_y)) {}
private:
DISALLOW_COPY_AND_ASSIGN(GestureEventForTest);
@@ -322,26 +330,23 @@
// Simulates a complete tap.
void Tap(const gfx::Point& point) {
GestureEventForTest begin(
- point.x(), point.y(), ui::GestureEventDetails(ui::ET_GESTURE_BEGIN));
+ ui::ET_GESTURE_BEGIN, point.x(), point.y(), 0.0f, 0.0f);
textfield_->OnGestureEvent(&begin);
GestureEventForTest tap_down(
- point.x(), point.y(), ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN));
+ ui::ET_GESTURE_TAP_DOWN, point.x(), point.y(), 0.0f, 0.0f);
textfield_->OnGestureEvent(&tap_down);
GestureEventForTest show_press(
- point.x(),
- point.y(),
- ui::GestureEventDetails(ui::ET_GESTURE_SHOW_PRESS));
+ ui::ET_GESTURE_SHOW_PRESS, point.x(), point.y(), 0.0f, 0.0f);
textfield_->OnGestureEvent(&show_press);
- ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP);
- tap_details.set_tap_count(1);
- GestureEventForTest tap(point.x(), point.y(), tap_details);
+ GestureEventForTest tap(
+ ui::ET_GESTURE_TAP, point.x(), point.y(), 1.0f, 0.0f);
textfield_->OnGestureEvent(&tap);
GestureEventForTest end(
- point.x(), point.y(), ui::GestureEventDetails(ui::ET_GESTURE_END));
+ ui::ET_GESTURE_END, point.x(), point.y(), 0.0f, 0.0f);
textfield_->OnGestureEvent(&end);
}
@@ -1952,9 +1957,7 @@
CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableTouchEditing);
// Tapping on the textfield should turn on the TouchSelectionController.
- ui::GestureEventDetails tap_details(ui::ET_GESTURE_TAP);
- tap_details.set_tap_count(1);
- GestureEventForTest tap(x, 0, tap_details);
+ GestureEventForTest tap(ui::ET_GESTURE_TAP, x, 0, 1.0f, 0.0f);
textfield_->OnGestureEvent(&tap);
EXPECT_TRUE(test_api_->touch_selection_controller());
@@ -1965,8 +1968,7 @@
// With touch editing enabled, long press should not show context menu.
// Instead, select word and invoke TouchSelectionController.
- GestureEventForTest long_press_1(
- x, 0, ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS));
+ GestureEventForTest long_press_1(ui::ET_GESTURE_LONG_PRESS, x, 0, 0.0f, 0.0f);
textfield_->OnGestureEvent(&long_press_1);
EXPECT_STR_EQ("hello", textfield_->GetSelectedText());
EXPECT_TRUE(test_api_->touch_selection_controller());
@@ -1975,8 +1977,7 @@
// With touch drag drop enabled, long pressing in the selected region should
// start a drag and remove TouchSelectionController.
ASSERT_TRUE(switches::IsTouchDragDropEnabled());
- GestureEventForTest long_press_2(
- x, 0, ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS));
+ GestureEventForTest long_press_2(ui::ET_GESTURE_LONG_PRESS, x, 0, 0.0f, 0.0f);
textfield_->OnGestureEvent(&long_press_2);
EXPECT_STR_EQ("hello", textfield_->GetSelectedText());
EXPECT_FALSE(test_api_->touch_selection_controller());
@@ -1987,8 +1988,7 @@
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kDisableTouchDragDrop);
ASSERT_FALSE(switches::IsTouchDragDropEnabled());
- GestureEventForTest long_press_3(
- x, 0, ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS));
+ GestureEventForTest long_press_3(ui::ET_GESTURE_LONG_PRESS, x, 0, 0.0f, 0.0f);
textfield_->OnGestureEvent(&long_press_3);
EXPECT_STR_EQ("hello", textfield_->GetSelectedText());
EXPECT_FALSE(test_api_->touch_selection_controller());
@@ -2033,10 +2033,8 @@
switches::kEnableTouchDragDrop);
// Create a long press event in the selected region should start a drag.
- GestureEventForTest long_press(
- kStringPoint.x(),
- kStringPoint.y(),
- ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS));
+ GestureEventForTest long_press(ui::ET_GESTURE_LONG_PRESS, kStringPoint.x(),
+ kStringPoint.y(), 0.0f, 0.0f);
textfield_->OnGestureEvent(&long_press);
EXPECT_TRUE(textfield_->CanStartDragForView(NULL, kStringPoint,
kStringPoint));
« no previous file with comments | « ui/views/controls/table/table_view_unittest.cc ('k') | ui/views/corewm/desktop_capture_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698