| 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 71d3ad8ca556465e47b116b7506401dc885914d7..f9f6a3504d3e1ae5daaeb67292a40a58c344d6d3 100644
|
| --- a/ui/views/controls/textfield/textfield_unittest.cc
|
| +++ b/ui/views/controls/textfield/textfield_unittest.cc
|
| @@ -622,27 +622,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::PointerDetails(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::PointerDetails(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::PointerDetails(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::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| textfield_->OnMouseReleased(release);
|
| }
|
|
|
| @@ -661,16 +665,19 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController {
|
| }
|
|
|
| void PressMouseButton(ui::EventFlags mouse_button_flags, int extra_flags) {
|
| - ui::MouseEvent press(ui::ET_MOUSE_PRESSED, mouse_position_, mouse_position_,
|
| - ui::EventTimeForNow(), mouse_button_flags,
|
| - mouse_button_flags | extra_flags);
|
| + ui::MouseEvent press(
|
| + ui::ET_MOUSE_PRESSED, mouse_position_, mouse_position_,
|
| + ui::EventTimeForNow(), mouse_button_flags,
|
| + mouse_button_flags | extra_flags,
|
| + ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| textfield_->OnMousePressed(press);
|
| }
|
|
|
| void ReleaseMouseButton(ui::EventFlags mouse_button_flags) {
|
| - ui::MouseEvent release(ui::ET_MOUSE_RELEASED, mouse_position_,
|
| - mouse_position_, ui::EventTimeForNow(),
|
| - mouse_button_flags, mouse_button_flags);
|
| + ui::MouseEvent release(
|
| + ui::ET_MOUSE_RELEASED, mouse_position_, mouse_position_,
|
| + ui::EventTimeForNow(), mouse_button_flags, mouse_button_flags,
|
| + ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| textfield_->OnMouseReleased(release);
|
| }
|
|
|
| @@ -694,8 +701,10 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController {
|
|
|
| void DragMouseTo(const gfx::Point& where) {
|
| mouse_position_ = where;
|
| - ui::MouseEvent drag(ui::ET_MOUSE_DRAGGED, where, where,
|
| - ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
|
| + ui::MouseEvent drag(
|
| + ui::ET_MOUSE_DRAGGED, where, where, ui::EventTimeForNow(),
|
| + ui::EF_LEFT_MOUSE_BUTTON, 0,
|
| + ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| textfield_->OnMouseDragged(drag);
|
| }
|
|
|
| @@ -2712,17 +2721,20 @@ TEST_F(TextfieldTest, SelectionClipboard) {
|
| gfx::Point point_4(GetCursorPositionX(4), cursor_y);
|
|
|
| // 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::PointerDetails(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::PointerDetails(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::PointerDetails(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));
|
| @@ -2735,17 +2747,19 @@ TEST_F(TextfieldTest, 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::PointerDetails(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::PointerDetails(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));
|
| @@ -2770,9 +2784,10 @@ TEST_F(TextfieldTest, 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::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| textfield_->OnMousePressed(middle);
|
| EXPECT_STR_EQ("01230123", textfield_->text());
|
| EXPECT_EQ(gfx::Range(8, 8), textfield_->GetSelectedRange());
|
| @@ -2808,18 +2823,21 @@ TEST_F(TextfieldTest, SelectionClipboard) {
|
| // Double and triple clicking should update the clipboard contents.
|
| textfield_->SetText(ASCIIToUTF16("ab cd ef"));
|
| gfx::Point word(GetCursorPositionX(4), cursor_y);
|
| - 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::PointerDetails(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::PointerDetails(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::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| textfield_->OnMousePressed(double_click);
|
| textfield_->OnMouseReleased(release_word);
|
| EXPECT_EQ(gfx::Range(3, 5), textfield_->GetSelectedRange());
|
|
|