summaryrefslogtreecommitdiffstats
path: root/ui/views/touchui/touch_selection_controller_impl_unittest.cc
diff options
context:
space:
mode:
authorlanwei <lanwei@chromium.org>2014-09-19 07:52:45 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-19 14:52:57 +0000
commit46f76555938808dd916c4e2d5c0d7de1333a821d (patch)
tree79d3971f5009bf43ff6a4eaa2d72c582c8e69f05 /ui/views/touchui/touch_selection_controller_impl_unittest.cc
parentcd45a3ee8f4ebb2adf7daf383a83267f8dbe5f3b (diff)
downloadchromium_src-46f76555938808dd916c4e2d5c0d7de1333a821d.zip
chromium_src-46f76555938808dd916c4e2d5c0d7de1333a821d.tar.gz
chromium_src-46f76555938808dd916c4e2d5c0d7de1333a821d.tar.bz2
Clean up GestureEventDetails constructors and fix unit tests.
Reland the code change for Issue 573963005: Clean up GestureEventDetails constructors and fix unit tests: https://codereview.chromium.org/573963005/. The code does not change, just merge two commits into one. BUG=350942 TBR=tdresser@chromium.org,jdduke@chromium.org,sadrul@chromium.org,sky@chromium.org Review URL: https://codereview.chromium.org/581963004 Cr-Commit-Position: refs/heads/master@{#295706}
Diffstat (limited to 'ui/views/touchui/touch_selection_controller_impl_unittest.cc')
-rw-r--r--ui/views/touchui/touch_selection_controller_impl_unittest.cc40
1 files changed, 15 insertions, 25 deletions
diff --git a/ui/views/touchui/touch_selection_controller_impl_unittest.cc b/ui/views/touchui/touch_selection_controller_impl_unittest.cc
index acd62ff..b268d2c 100644
--- a/ui/views/touchui/touch_selection_controller_impl_unittest.cc
+++ b/ui/views/touchui/touch_selection_controller_impl_unittest.cc
@@ -252,11 +252,9 @@ TEST_F(TouchSelectionControllerImplTest, SelectionInTextfieldTest) {
CreateTextfield();
textfield_->SetText(ASCIIToUTF16("some text"));
// Tap the textfield to invoke touch selection.
- ui::GestureEvent tap(0,
- 0,
- 0,
- base::TimeDelta(),
- ui::GestureEventDetails(ui::ET_GESTURE_TAP, 1.0f, 0.0f));
+ ui::GestureEventDetails details(ui::ET_GESTURE_TAP);
+ details.set_tap_count(1);
+ ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), details);
textfield_->OnGestureEvent(&tap);
// Test selecting a range.
@@ -287,11 +285,9 @@ TEST_F(TouchSelectionControllerImplTest, SelectionInBidiTextfieldTest) {
CreateTextfield();
textfield_->SetText(WideToUTF16(L"abc\x05d0\x05d1\x05d2"));
// Tap the textfield to invoke touch selection.
- ui::GestureEvent tap(0,
- 0,
- 0,
- base::TimeDelta(),
- ui::GestureEventDetails(ui::ET_GESTURE_TAP, 1.0f, 0.0f));
+ ui::GestureEventDetails details(ui::ET_GESTURE_TAP);
+ details.set_tap_count(1);
+ ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), details);
textfield_->OnGestureEvent(&tap);
// Test cursor at run boundary and with empty selection.
@@ -338,11 +334,9 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectCallbackTest) {
CreateTextfield();
textfield_->SetText(ASCIIToUTF16("textfield with selected text"));
// Tap the textfield to invoke touch selection.
- ui::GestureEvent tap(0,
- 0,
- 0,
- base::TimeDelta(),
- ui::GestureEventDetails(ui::ET_GESTURE_TAP, 1.0f, 0.0f));
+ ui::GestureEventDetails details(ui::ET_GESTURE_TAP);
+ details.set_tap_count(1);
+ ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), details);
textfield_->OnGestureEvent(&tap);
textfield_->SelectRange(gfx::Range(3, 7));
@@ -379,11 +373,9 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) {
CreateTextfield();
textfield_->SetText(WideToUTF16(L"abc\x05e1\x05e2\x05e3" L"def"));
// Tap the textfield to invoke touch selection.
- ui::GestureEvent tap(0,
- 0,
- 0,
- base::TimeDelta(),
- ui::GestureEventDetails(ui::ET_GESTURE_TAP, 1.0f, 0.0f));
+ ui::GestureEventDetails details(ui::ET_GESTURE_TAP);
+ details.set_tap_count(1);
+ ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), details);
textfield_->OnGestureEvent(&tap);
// Select [c] from left to right.
@@ -511,11 +503,9 @@ TEST_F(TouchSelectionControllerImplTest,
textfield_->SetText(ASCIIToUTF16(textfield_text));
// Tap the textfield to invoke selection.
- ui::GestureEvent tap(0,
- 0,
- 0,
- base::TimeDelta(),
- ui::GestureEventDetails(ui::ET_GESTURE_TAP, 1.0f, 0.0f));
+ ui::GestureEventDetails details(ui::ET_GESTURE_TAP);
+ details.set_tap_count(1);
+ ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), details);
textfield_->OnGestureEvent(&tap);
// Select some text such that one handle is hidden.