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

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

Issue 1260453006: ui: events: Add a class to hold common touch and stylus properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address build problems, add accessor and unit tests. Created 5 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
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 056a4c569b441b5e3b9c6772b8ef5c3e6976ebca..013fa95581b0fb05e6628b99c8ef9cc5aaaa9520 100644
--- a/ui/views/controls/textfield/textfield_unittest.cc
+++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -597,27 +597,31 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController {
// y-axis is in the middle of |bound|'s vertical range.
void MouseClick(const gfx::Rect bound, int x_offset) {
gfx::Point point(bound.x() + x_offset, bound.y() + bound.height() / 2);
- ui::MouseEvent click(ui::ET_MOUSE_PRESSED, point, point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent click(
+ ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(click);
- ui::MouseEvent release(ui::ET_MOUSE_RELEASED, point, point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent release(
+ ui::ET_MOUSE_RELEASED, point, point, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMouseReleased(release);
}
// This is to avoid double/triple click.
void NonClientMouseClick() {
- ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
- ui::EventTimeForNow(),
- ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_NON_CLIENT,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent click(
+ ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_NON_CLIENT,
+ ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(click);
- ui::MouseEvent release(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(),
- ui::EventTimeForNow(),
- ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_NON_CLIENT,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent release(
+ ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(),
+ ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_NON_CLIENT,
+ ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMouseReleased(release);
}
@@ -1047,9 +1051,10 @@ TEST_F(TextfieldTest, FocusTraversalTest) {
// Test if clicking on textfield view sets the focus.
widget_->GetFocusManager()->AdvanceFocus(true);
EXPECT_EQ(3, GetFocusedView()->id());
- ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent click(
+ ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(click);
EXPECT_EQ(1, GetFocusedView()->id());
@@ -1099,16 +1104,19 @@ TEST_F(TextfieldTest, ContextMenuDisplayTest) {
TEST_F(TextfieldTest, DoubleAndTripleClickTest) {
InitTextfield();
textfield_->SetText(ASCIIToUTF16("hello world"));
- ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
- ui::MouseEvent release(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(),
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
- ui::MouseEvent double_click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
- ui::EventTimeForNow(),
- ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent click(
+ ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
+ ui::MouseEvent release(
+ ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
+ ui::MouseEvent double_click(
+ ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK,
+ ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
// Test for double click.
textfield_->OnMousePressed(click);
@@ -1136,19 +1144,26 @@ TEST_F(TextfieldTest, DragToSelect) {
const int kEnd = 500;
gfx::Point start_point(kStart, 0);
gfx::Point end_point(kEnd, 0);
- ui::MouseEvent click_a(ui::ET_MOUSE_PRESSED, start_point, start_point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
- ui::MouseEvent click_b(ui::ET_MOUSE_PRESSED, end_point, end_point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
- ui::MouseEvent drag_left(ui::ET_MOUSE_DRAGGED, gfx::Point(), gfx::Point(),
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
- ui::MouseEvent drag_right(ui::ET_MOUSE_DRAGGED, end_point, end_point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
- ui::MouseEvent release(ui::ET_MOUSE_RELEASED, end_point, end_point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent click_a(
+ ui::ET_MOUSE_PRESSED, start_point, start_point, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
+ ui::MouseEvent click_b(
+ ui::ET_MOUSE_PRESSED, end_point, end_point, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
+ ui::MouseEvent drag_left(
+ ui::ET_MOUSE_DRAGGED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, 0,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
+ ui::MouseEvent drag_right(
+ ui::ET_MOUSE_DRAGGED, end_point, end_point, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, 0,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
+ ui::MouseEvent release(
+ ui::ET_MOUSE_RELEASED, end_point, end_point, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(click_a);
EXPECT_TRUE(textfield_->GetSelectedText().empty());
// Check that dragging left selects the beginning of the string.
@@ -1252,9 +1267,10 @@ TEST_F(TextfieldTest, DragAndDrop_InitiateDrag) {
textfield_->GetDragOperationsForView(NULL, kStringPoint));
textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_TEXT);
// Ensure that textfields only initiate drag operations inside the selection.
- ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, kStringPoint, kStringPoint,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent press_event(
+ ui::ET_MOUSE_PRESSED, kStringPoint, kStringPoint, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(press_event);
EXPECT_EQ(ui::DragDropTypes::DRAG_NONE,
textfield_->GetDragOperationsForView(NULL, gfx::Point()));
@@ -1282,9 +1298,10 @@ TEST_F(TextfieldTest, DragAndDrop_ToTheRight) {
// Start dragging "ello".
textfield_->SelectRange(gfx::Range(1, 5));
gfx::Point point(GetCursorPositionX(3), 0);
- ui::MouseEvent click_a(ui::ET_MOUSE_PRESSED, point, point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent click_a(
+ ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(click_a);
EXPECT_TRUE(textfield_->CanStartDragForView(textfield_, click_a.location(),
gfx::Point()));
@@ -1336,9 +1353,10 @@ TEST_F(TextfieldTest, DragAndDrop_ToTheLeft) {
// Start dragging " worl".
textfield_->SelectRange(gfx::Range(5, 10));
gfx::Point point(GetCursorPositionX(7), 0);
- ui::MouseEvent click_a(ui::ET_MOUSE_PRESSED, point, point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent click_a(
+ ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(click_a);
EXPECT_TRUE(textfield_->CanStartDragForView(textfield_, click_a.location(),
gfx::Point()));
@@ -1384,9 +1402,10 @@ TEST_F(TextfieldTest, DragAndDrop_Canceled) {
// Start dragging "worl".
textfield_->SelectRange(gfx::Range(6, 10));
gfx::Point point(GetCursorPositionX(8), 0);
- ui::MouseEvent click(ui::ET_MOUSE_PRESSED, point, point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent click(
+ ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(click);
ui::OSExchangeData data;
textfield_->WriteDragDataForView(NULL, click.location(), &data);
@@ -1398,11 +1417,14 @@ TEST_F(TextfieldTest, DragAndDrop_Canceled) {
EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnDragUpdated(drop));
// "Cancel" the drag, via move and release over the selection, and OnDragDone.
gfx::Point drag_point(GetCursorPositionX(9), 0);
- ui::MouseEvent drag(ui::ET_MOUSE_DRAGGED, drag_point, drag_point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
- ui::MouseEvent release(ui::ET_MOUSE_RELEASED, drag_point, drag_point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent drag(
+ ui::ET_MOUSE_DRAGGED, drag_point, drag_point, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, 0,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
+ ui::MouseEvent release(
+ ui::ET_MOUSE_RELEASED, drag_point, drag_point, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMouseDragged(drag);
textfield_->OnMouseReleased(release);
textfield_->OnDragDone();
@@ -2179,15 +2201,18 @@ TEST_F(TextfieldTest, KeepInitiallySelectedWord) {
MouseClick(middle_cursor, 0);
const gfx::Point middle(middle_cursor.x(),
middle_cursor.y() + middle_cursor.height() / 2);
- ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, middle, middle,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent press_event(
+ ui::ET_MOUSE_PRESSED, middle, middle, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(press_event);
EXPECT_EQ(gfx::Range(4, 7), textfield_->GetSelectedRange());
// Drag the mouse to the beginning of the textfield.
- ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, beginning, beginning,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
+ ui::MouseEvent drag_event(
+ ui::ET_MOUSE_DRAGGED, beginning, beginning, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, 0,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMouseDragged(drag_event);
EXPECT_EQ(gfx::Range(7, 0), textfield_->GetSelectedRange());
}
@@ -2203,17 +2228,20 @@ TEST_F(TextfieldTest, DISABLED_SelectionClipboard) {
gfx::Point point_4(GetCursorPositionX(4), 0);
// Text selected by the mouse should be placed on the selection clipboard.
- ui::MouseEvent press(ui::ET_MOUSE_PRESSED, point_1, point_1,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent press(
+ ui::ET_MOUSE_PRESSED, point_1, point_1, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(press);
- ui::MouseEvent drag(ui::ET_MOUSE_DRAGGED, point_3, point_3,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent drag(
+ ui::ET_MOUSE_DRAGGED, point_3, point_3, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMouseDragged(drag);
- ui::MouseEvent release(ui::ET_MOUSE_RELEASED, point_3, point_3,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent release(
+ ui::ET_MOUSE_RELEASED, point_3, point_3, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMouseReleased(release);
EXPECT_EQ(gfx::Range(1, 3), textfield_->GetSelectedRange());
EXPECT_STR_EQ("12", GetClipboardText(ui::CLIPBOARD_TYPE_SELECTION));
@@ -2226,17 +2254,19 @@ TEST_F(TextfieldTest, DISABLED_SelectionClipboard) {
// Shift-click selection modifications should update the clipboard.
NonClientMouseClick();
- ui::MouseEvent press_2(ui::ET_MOUSE_PRESSED, point_2, point_2,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent press_2(
+ ui::ET_MOUSE_PRESSED, point_2, point_2, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
press_2.set_flags(press_2.flags() | ui::EF_SHIFT_DOWN);
#if defined(USE_X11)
ui::UpdateX11EventForFlags(&press_2);
#endif
textfield_->OnMousePressed(press_2);
- ui::MouseEvent release_2(ui::ET_MOUSE_RELEASED, point_2, point_2,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent release_2(
+ ui::ET_MOUSE_RELEASED, point_2, point_2, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMouseReleased(release_2);
EXPECT_EQ(gfx::Range(0, 2), textfield_->GetSelectedRange());
EXPECT_STR_EQ("01", GetClipboardText(ui::CLIPBOARD_TYPE_SELECTION));
@@ -2261,9 +2291,10 @@ TEST_F(TextfieldTest, DISABLED_SelectionClipboard) {
// Middle clicking should paste at the mouse (not cursor) location.
// The cursor should be placed at the end of the pasted text.
- ui::MouseEvent middle(ui::ET_MOUSE_PRESSED, point_4, point_4,
- ui::EventTimeForNow(), ui::EF_MIDDLE_MOUSE_BUTTON,
- ui::EF_MIDDLE_MOUSE_BUTTON);
+ ui::MouseEvent middle(
+ ui::ET_MOUSE_PRESSED, point_4, point_4, ui::EventTimeForNow(),
+ ui::EF_MIDDLE_MOUSE_BUTTON, ui::EF_MIDDLE_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(middle);
EXPECT_STR_EQ("01230123", textfield_->text());
EXPECT_EQ(gfx::Range(8, 8), textfield_->GetSelectedRange());
@@ -2299,18 +2330,21 @@ TEST_F(TextfieldTest, DISABLED_SelectionClipboard) {
// Double and triple clicking should update the clipboard contents.
textfield_->SetText(ASCIIToUTF16("ab cd ef"));
gfx::Point word(GetCursorPositionX(4), 0);
- ui::MouseEvent press_word(ui::ET_MOUSE_PRESSED, word, word,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent press_word(
+ ui::ET_MOUSE_PRESSED, word, word, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(press_word);
- ui::MouseEvent release_word(ui::ET_MOUSE_RELEASED, word, word,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent release_word(
+ ui::ET_MOUSE_RELEASED, word, word, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMouseReleased(release_word);
- ui::MouseEvent double_click(ui::ET_MOUSE_PRESSED, word, word,
- ui::EventTimeForNow(),
- ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent double_click(
+ ui::ET_MOUSE_PRESSED, word, word, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK,
+ ui::EF_LEFT_MOUSE_BUTTON,
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
textfield_->OnMousePressed(double_click);
textfield_->OnMouseReleased(release_word);
EXPECT_EQ(gfx::Range(3, 5), textfield_->GetSelectedRange());

Powered by Google App Engine
This is Rietveld 408576698