Index: ui/views/controls/button/custom_button_unittest.cc |
diff --git a/ui/views/controls/button/custom_button_unittest.cc b/ui/views/controls/button/custom_button_unittest.cc |
index 01a233c7db9ae3f57d0c292bc32808e63d57bc09..fa5c69f1e703bf358d2f4e52ea5ae86d7d670cc6 100644 |
--- a/ui/views/controls/button/custom_button_unittest.cc |
+++ b/ui/views/controls/button/custom_button_unittest.cc |
@@ -253,19 +253,20 @@ TEST_F(CustomButtonTest, NotifyAction) { |
} |
// Tests that OnClickCanceled gets called when NotifyClick is not expected |
-// anymore. |
+// anymore (e.g., release happens outside of the button). |
TEST_F(CustomButtonTest, NotifyActionNoClick) { |
gfx::Point center(10, 10); |
+ gfx::Point outside(10 + button()->width(), 10); |
// By default the button should notify its listener on mouse release. |
button()->OnMousePressed(ui::MouseEvent( |
ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), |
- ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON)); |
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
EXPECT_FALSE(button()->canceled()); |
button()->OnMouseReleased(ui::MouseEvent( |
- ui::ET_MOUSE_RELEASED, center, center, ui::EventTimeForNow(), |
- ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON)); |
+ ui::ET_MOUSE_RELEASED, outside, outside, ui::EventTimeForNow(), |
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
EXPECT_TRUE(button()->canceled()); |
// Set the notify action to its listener on mouse press. |
@@ -273,15 +274,15 @@ TEST_F(CustomButtonTest, NotifyActionNoClick) { |
button()->set_notify_action(CustomButton::NOTIFY_ON_PRESS); |
button()->OnMousePressed(ui::MouseEvent( |
ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), |
- ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON)); |
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
// OnClickCanceled is only sent on mouse release. |
EXPECT_FALSE(button()->canceled()); |
// The button should no longer notify on mouse release. |
button()->Reset(); |
button()->OnMouseReleased(ui::MouseEvent( |
- ui::ET_MOUSE_RELEASED, center, center, ui::EventTimeForNow(), |
- ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON)); |
+ ui::ET_MOUSE_RELEASED, outside, outside, ui::EventTimeForNow(), |
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
EXPECT_FALSE(button()->canceled()); |
} |