Commit dce1d3a7 authored by estade@chromium.org's avatar estade@chromium.org

Thwart clickjacking in autofill popups by ignoring double clicks

BUG=369848

Review URL: https://codereview.chromium.org/294043017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274452 0039d316-1c4b-4281-b951-d872f2087c98
parent 0861d7f2
......@@ -161,7 +161,7 @@ void AutofillPopupBaseView::OnMouseMoved(const ui::MouseEvent& event) {
}
bool AutofillPopupBaseView::OnMousePressed(const ui::MouseEvent& event) {
return true;
return event.GetClickCount() == 1;
}
void AutofillPopupBaseView::OnMouseReleased(const ui::MouseEvent& event) {
......@@ -240,5 +240,4 @@ gfx::NativeView AutofillPopupBaseView::container_view() {
return delegate_->container_view();
}
} // namespace autofill
......@@ -70,7 +70,7 @@ class AutofillPopupBaseViewTest : public InProcessBrowserTest {
}
protected:
MockAutofillPopupViewDelegate mock_delegate_;
testing::NiceMock<MockAutofillPopupViewDelegate> mock_delegate_;
AutofillPopupBaseView* view_;
};
......@@ -112,4 +112,22 @@ IN_PROC_BROWSER_TEST_F(AutofillPopupBaseViewTest, MAYBE_GestureTest) {
SimulateGesture(&outside_tap);
}
IN_PROC_BROWSER_TEST_F(AutofillPopupBaseViewTest, DoubleClickTest) {
gfx::Rect bounds(0, 0, 5, 5);
gfx::Point point = bounds.CenterPoint();
EXPECT_CALL(mock_delegate_, popup_bounds()).WillRepeatedly(ReturnRef(bounds));
ShowView();
ui::MouseEvent mouse_down(ui::ET_MOUSE_PRESSED,
gfx::Point(0, 0),
gfx::Point(0, 0),
0, 0);
EXPECT_TRUE(static_cast<views::View*>(view_)->OnMousePressed(mouse_down));
// Ignore double clicks.
mouse_down.SetClickCount(2);
EXPECT_FALSE(static_cast<views::View*>(view_)->OnMousePressed(mouse_down));
}
} // namespace autofill
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment