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

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

Issue 23477015: [sync] Significantly speed up password model association on mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 7 years, 3 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_mac_unittest.cc
diff --git a/chrome/browser/password_manager/password_store_mac_unittest.cc b/chrome/browser/password_manager/password_store_mac_unittest.cc
index 28fed75a9efcbb7b97119e5983f1177151145400..ab385b01b9bf47230d5b5762f4ece826b85169dc 100644
--- a/chrome/browser/password_manager/password_store_mac_unittest.cc
+++ b/chrome/browser/password_manager/password_store_mac_unittest.cc
@@ -280,7 +280,7 @@ TEST_F(PasswordStoreMacInternalsTest, TestKeychainToFormTranslation) {
reinterpret_cast<SecKeychainItemRef>(i + 1);
PasswordForm form;
bool parsed = internal_keychain_helpers::FillPasswordFormFromKeychainItem(
- *keychain_, keychain_item, &form);
+ *keychain_, keychain_item, &form, true);
stuartmorgan 2013/09/30 22:39:12 You added a new param, but set it to true in every
Raghu Simha 2013/10/02 02:09:50 I've added a new test for this called TestFillPass
EXPECT_TRUE(parsed) << "In iteration " << i;
@@ -319,7 +319,7 @@ TEST_F(PasswordStoreMacInternalsTest, TestKeychainToFormTranslation) {
SecKeychainItemRef keychain_item = reinterpret_cast<SecKeychainItemRef>(99);
PasswordForm form;
bool parsed = internal_keychain_helpers::FillPasswordFormFromKeychainItem(
- *keychain_, keychain_item, &form);
+ *keychain_, keychain_item, &form, true);
EXPECT_FALSE(parsed);
}
}
@@ -388,8 +388,20 @@ TEST_F(PasswordStoreMacInternalsTest, TestKeychainSearch) {
// Check matches treating the form as a merging target.
EXPECT_EQ(test_data[i].expected_merge_matches > 0,
keychain_adapter.HasPasswordsMergeableWithForm(*query_form));
- matching_items = keychain_adapter.PasswordsMergeableWithForm(*query_form);
+ std::vector<SecKeychainItemRef> keychain_items;
+ std::vector<MacKeychainPasswordFormAdapter::ItemFormPair> item_form_pairs =
+ internal_keychain_helpers::GetAllKeychainItemAttributesAsPasswordForms(
+ &keychain_items, *keychain_);
+ matching_items =
+ keychain_adapter.ExtractPasswordsMergeableWithForm(item_form_pairs,
+ *query_form);
EXPECT_EQ(test_data[i].expected_merge_matches, matching_items.size());
+ STLDeleteContainerPairSecondPointers(item_form_pairs.begin(),
+ item_form_pairs.end());
+ for (std::vector<SecKeychainItemRef>::iterator i = keychain_items.begin();
+ i != keychain_items.end(); ++i) {
+ keychain_->Free(*i);
+ }
STLDeleteElements(&matching_items);
// None of the pre-seeded items are owned by us, so none should match an
@@ -558,7 +570,8 @@ TEST_F(PasswordStoreMacInternalsTest, TestKeychainAdd) {
PasswordForm stored_form;
internal_keychain_helpers::FillPasswordFormFromKeychainItem(*keychain_,
keychain_item,
- &stored_form);
+ &stored_form,
+ true);
EXPECT_EQ(update_form->password_value, stored_form.password_value);
}
}

Powered by Google App Engine
This is Rietveld 408576698