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

Unified Diff: chrome/browser/password_manager/password_store_x_unittest.cc

Issue 906973007: PasswordStore: Clean up expectations about rewriting vectors of forms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just rebased Created 5 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
Index: chrome/browser/password_manager/password_store_x_unittest.cc
diff --git a/chrome/browser/password_manager/password_store_x_unittest.cc b/chrome/browser/password_manager/password_store_x_unittest.cc
index 737353c320e838aadbd6c815d944910fc7a3474e..307098b8059cc31293051c0864c10e73833df25d 100644
--- a/chrome/browser/password_manager/password_store_x_unittest.cc
+++ b/chrome/browser/password_manager/password_store_x_unittest.cc
@@ -80,17 +80,36 @@ class FailingBackend : public PasswordStoreX::NativeBackend {
return false;
}
+ // Use this as a landmine to check whether results of failed Get*Logins calls
+ // get ignored.
+ static ScopedVector<autofill::PasswordForm> CreateTrashForms() {
+ ScopedVector<autofill::PasswordForm> forms;
+ PasswordForm trash;
+ trash.username_element = base::ASCIIToUTF16("trash u. element");
+ trash.username_value = base::ASCIIToUTF16("trash u. value");
+ trash.password_element = base::ASCIIToUTF16("trash p. element");
+ trash.password_value = base::ASCIIToUTF16("trash p. value");
+ for (size_t i = 0; i < 3; ++i) {
+ trash.origin = GURL(base::StringPrintf("http://trash%zu.com", i));
+ forms.push_back(new PasswordForm(trash));
+ }
+ return forms.Pass();
+ }
+
bool GetLogins(const PasswordForm& form,
ScopedVector<autofill::PasswordForm>* forms) override {
+ *forms = CreateTrashForms();
return false;
}
bool GetAutofillableLogins(
ScopedVector<autofill::PasswordForm>* forms) override {
+ *forms = CreateTrashForms();
return false;
}
bool GetBlacklistLogins(
ScopedVector<autofill::PasswordForm>* forms) override {
+ *forms = CreateTrashForms();
return false;
}
};
@@ -207,9 +226,9 @@ void LoginDatabaseQueryCallback(password_manager::LoginDatabase* login_db,
MockLoginDatabaseReturn* mock_return) {
ScopedVector<autofill::PasswordForm> forms;
if (autofillable)
- login_db->GetAutofillableLogins(&forms);
+ EXPECT_TRUE(login_db->GetAutofillableLogins(&forms));
else
- login_db->GetBlacklistLogins(&forms);
+ EXPECT_TRUE(login_db->GetBlacklistLogins(&forms));
mock_return->OnLoginDatabaseQueryDone(forms.get());
}
« no previous file with comments | « chrome/browser/password_manager/password_store_x.cc ('k') | components/password_manager/core/browser/login_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698