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

Unified Diff: chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc

Issue 294043017: Thwart clickjacking in autofill popups by ignoring double clicks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: way simpler Created 6 years, 7 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: chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc b/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc
index 0f810fadb8408fe802de7501235328a469204238..b224464cc824f6ce4f4d0c8d9325088c73077da3 100644
--- a/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc
+++ b/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc
@@ -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

Powered by Google App Engine
This is Rietveld 408576698