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

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

Issue 2754273003: Introduce restricted PasswordFormManager::GrabFetcher (Closed)
Patch Set: Remove redundant CredentialManagerPasswordFormManager::form_fetcher_ Created 3 years, 9 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_form_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_form_manager_unittest.cc
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc
index 8450eb129264039b909c9d1c23364f4a29ff7b89..e2532847a87a73a10a089fb616086651373a9c5d 100644
--- a/components/password_manager/core/browser/password_form_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -98,6 +98,11 @@ class MockFormSaver : public StubFormSaver {
DISALLOW_COPY_AND_ASSIGN(MockFormSaver);
};
+class MockFormFetcher : public FakeFormFetcher {
+ public:
+ MOCK_METHOD1(AddConsumer, void(Consumer*));
+};
+
MATCHER_P(CheckUsername, username_value, "Username incorrect") {
return arg.username_value == username_value;
}
@@ -2959,4 +2964,18 @@ TEST_F(PasswordFormManagerTest, ResetStoredMatches) {
EXPECT_THAT(credentials_to_update, IsEmpty());
}
+// Check that if asked to take ownership of the same FormFetcher which it had
+// consumed before, the PasswordFormManager does not add itself as a consumer
+// again.
+TEST_F(PasswordFormManagerTest, GrabFetcher_Same) {
+ auto fetcher = base::MakeUnique<MockFormFetcher>();
+ fetcher->Fetch();
+ PasswordFormManager form_manager(
+ password_manager(), client(), client()->driver(), *observed_form(),
+ base::MakeUnique<MockFormSaver>(), fetcher.get());
+
+ EXPECT_CALL(*fetcher, AddConsumer(_)).Times(0);
+ form_manager.GrabFetcher(std::move(fetcher));
+}
+
} // namespace password_manager
« no previous file with comments | « components/password_manager/core/browser/password_form_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698