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

Unified Diff: components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc

Issue 2917883002: Do not fire multiple password reuse events for the same page. (Closed)
Patch Set: comment fixes Created 3 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
« no previous file with comments | « components/password_manager/core/browser/password_reuse_detection_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc
diff --git a/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc b/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc
index 151c1fa678adad627d49af75aae5fdc8e59b3d78..50e0c8903f4c32920c82fc9305bc267536ac574a 100644
--- a/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc
@@ -130,6 +130,26 @@ TEST_F(PasswordReuseDetectionManagerTest, CheckThatBufferClearedAfterEnter) {
manager.OnKeyPressed(base::ASCIIToUTF16("2"));
}
+// Verify that after reuse found, no reuse checking happens till next main frame
+// navigation.
+TEST_F(PasswordReuseDetectionManagerTest, NoReuseCheckingAfterReuseFound) {
+ EXPECT_CALL(client_, GetPasswordStore())
+ .WillRepeatedly(testing::Return(store_.get()));
+ PasswordReuseDetectionManager manager(&client_);
+
+ // Simulate that reuse found.
+ manager.OnReuseFound(base::string16(), std::string(), 0, 0);
+
+ // Expect no checking of reuse.
+ EXPECT_CALL(*store_, CheckReuse(_, _, _)).Times(0);
+ manager.OnKeyPressed(base::ASCIIToUTF16("1"));
+
+ // Expect that after main frame navigation checking is restored.
+ manager.DidNavigateMainFrame(GURL("https://www.example.com"));
+ EXPECT_CALL(*store_, CheckReuse(base::ASCIIToUTF16("1"), _, _));
+ manager.OnKeyPressed(base::ASCIIToUTF16("1"));
+}
+
} // namespace
} // namespace password_manager
« no previous file with comments | « components/password_manager/core/browser/password_reuse_detection_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698