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

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

Issue 825773003: PasswordStore: Use ScopedVector to express ownership of forms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Leaks fixed + VABR->vabr Created 5 years, 11 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/native_backend_libsecret_unittest.cc
diff --git a/chrome/browser/password_manager/native_backend_libsecret_unittest.cc b/chrome/browser/password_manager/native_backend_libsecret_unittest.cc
index 377f8b14e2f60ba811d3d17461b6e75516be85e8..88e63030e776f3f0fd164b2b6dd1c7ebc5652189 100644
--- a/chrome/browser/password_manager/native_backend_libsecret_unittest.cc
+++ b/chrome/browser/password_manager/native_backend_libsecret_unittest.cc
@@ -410,7 +410,7 @@ class NativeBackendLibsecretTest : public testing::Test {
target_form.signon_realm.append("Realm");
target_form.scheme = scheme;
}
- std::vector<PasswordForm*> form_list;
+ ScopedVector<autofill::PasswordForm> form_list;
backend.GetLogins(target_form, &form_list);
EXPECT_EQ(1u, global_mock_libsecret_items.size());
@@ -424,7 +424,6 @@ class NativeBackendLibsecretTest : public testing::Test {
EXPECT_EQ(1u, form_list.size());
if (result)
*result = *form_list[0];
- STLDeleteElements(&form_list);
return true;
}
@@ -443,13 +442,13 @@ class NativeBackendLibsecretTest : public testing::Test {
PasswordForm m_facebook_lookup;
m_facebook_lookup.origin = kMobileURL;
m_facebook_lookup.signon_realm = kMobileURL.spec();
- std::vector<PasswordForm*> form_list;
+ ScopedVector<autofill::PasswordForm> form_list;
backend.GetLogins(m_facebook_lookup, &form_list);
EXPECT_EQ(1u, global_mock_libsecret_items.size());
EXPECT_EQ(1u, form_list.size());
PasswordForm m_facebook = *form_list[0];
- STLDeleteElements(&form_list);
+ form_list.clear();
EXPECT_EQ(kMobileURL, m_facebook.origin);
EXPECT_EQ(kMobileURL.spec(), m_facebook.signon_realm);
@@ -486,7 +485,7 @@ class NativeBackendLibsecretTest : public testing::Test {
EXPECT_EQ(kMobileURL, form_list[index_non_psl]->origin);
EXPECT_EQ(kMobileURL.spec(), form_list[index_non_psl]->signon_realm);
EXPECT_EQ(kOldPassword, form_list[index_non_psl]->password_value);
- STLDeleteElements(&form_list);
+ form_list.clear();
// Check that www.facebook.com login was modified by the update.
backend.GetLogins(form_facebook_, &form_list);
@@ -499,7 +498,7 @@ class NativeBackendLibsecretTest : public testing::Test {
EXPECT_EQ(form_facebook_.signon_realm,
form_list[index_non_psl]->signon_realm);
EXPECT_EQ(kNewPassword, form_list[index_non_psl]->password_value);
- STLDeleteElements(&form_list);
+ form_list.clear();
}
// Checks various types of matching for forms with a non-HTML |scheme|.
@@ -600,12 +599,12 @@ TEST_F(NativeBackendLibsecretTest, BasicListLogins) {
backend.AddLogin(form_google_);
- std::vector<PasswordForm*> form_list;
+ ScopedVector<autofill::PasswordForm> form_list;
backend.GetAutofillableLogins(&form_list);
// Quick check that we got something back.
EXPECT_EQ(1u, form_list.size());
- STLDeleteElements(&form_list);
+ form_list.clear();
EXPECT_EQ(1u, global_mock_libsecret_items.size());
if (global_mock_libsecret_items.size() > 0)
@@ -731,12 +730,12 @@ TEST_F(NativeBackendLibsecretTest, RemoveNonexistentLogin) {
backend.RemoveLogin(form_isc_);
// Make sure we can still get the first form back.
- std::vector<PasswordForm*> form_list;
+ ScopedVector<autofill::PasswordForm> form_list;
backend.GetAutofillableLogins(&form_list);
// Quick check that we got something back.
EXPECT_EQ(1u, form_list.size());
- STLDeleteElements(&form_list);
+ form_list.clear();
EXPECT_EQ(1u, global_mock_libsecret_items.size());
if (global_mock_libsecret_items.size() > 0)
@@ -797,13 +796,13 @@ TEST_F(NativeBackendLibsecretTest, ListLoginsAppends) {
backend.AddLogin(form_google_);
// Send the same request twice with the same list both times.
- std::vector<PasswordForm*> form_list;
+ ScopedVector<autofill::PasswordForm> form_list;
backend.GetAutofillableLogins(&form_list);
backend.GetAutofillableLogins(&form_list);
// Quick check that we got two results back.
EXPECT_EQ(2u, form_list.size());
- STLDeleteElements(&form_list);
+ form_list.clear();
EXPECT_EQ(1u, global_mock_libsecret_items.size());
if (global_mock_libsecret_items.size() > 0)

Powered by Google App Engine
This is Rietveld 408576698