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

Side by Side Diff: chrome/browser/password_manager/password_store_mac_unittest.cc

Issue 2318303002: Remove stl_util's STLDeleteContainerPairSecondPointers. (Closed)
Patch Set: fix Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/password_manager/password_store_mac.h" 5 #include "chrome/browser/password_manager/password_store_mac.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 keychain_adapter.HasPasswordsMergeableWithForm(*query_form)); 507 keychain_adapter.HasPasswordsMergeableWithForm(*query_form));
508 std::vector<SecKeychainItemRef> keychain_items; 508 std::vector<SecKeychainItemRef> keychain_items;
509 std::vector<internal_keychain_helpers::ItemFormPair> item_form_pairs = 509 std::vector<internal_keychain_helpers::ItemFormPair> item_form_pairs =
510 internal_keychain_helpers:: 510 internal_keychain_helpers::
511 ExtractAllKeychainItemAttributesIntoPasswordForms(&keychain_items, 511 ExtractAllKeychainItemAttributesIntoPasswordForms(&keychain_items,
512 *keychain_); 512 *keychain_);
513 matching_items = 513 matching_items =
514 internal_keychain_helpers::ExtractPasswordsMergeableWithForm( 514 internal_keychain_helpers::ExtractPasswordsMergeableWithForm(
515 *keychain_, item_form_pairs, *query_form); 515 *keychain_, item_form_pairs, *query_form);
516 EXPECT_EQ(test_data[i].expected_merge_matches, matching_items.size()); 516 EXPECT_EQ(test_data[i].expected_merge_matches, matching_items.size());
517 base::STLDeleteContainerPairSecondPointers(item_form_pairs.begin(),
518 item_form_pairs.end());
519 for (std::vector<SecKeychainItemRef>::iterator i = keychain_items.begin(); 517 for (std::vector<SecKeychainItemRef>::iterator i = keychain_items.begin();
520 i != keychain_items.end(); ++i) { 518 i != keychain_items.end(); ++i) {
521 keychain_->Free(*i); 519 keychain_->Free(*i);
522 } 520 }
523 521
524 // None of the pre-seeded items are owned by us, so none should match an 522 // None of the pre-seeded items are owned by us, so none should match an
525 // owned-passwords-only search. 523 // owned-passwords-only search.
526 matching_items = owned_keychain_adapter.PasswordsFillingForm( 524 matching_items = owned_keychain_adapter.PasswordsFillingForm(
527 query_form->signon_realm, query_form->scheme); 525 query_form->signon_realm, query_form->scheme);
528 EXPECT_EQ(0U, matching_items.size()); 526 EXPECT_EQ(0U, matching_items.size());
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 EXPECT_EQ(2u, passwords.size()); 2109 EXPECT_EQ(2u, passwords.size());
2112 2110
2113 // Delete everyhting but only the Chrome-owned item should be affected. 2111 // Delete everyhting but only the Chrome-owned item should be affected.
2114 PasswordStoreMac::CleanUpKeychain(keychain(), passwords); 2112 PasswordStoreMac::CleanUpKeychain(keychain(), passwords);
2115 passwords = password_manager_util::ConvertScopedVector( 2113 passwords = password_manager_util::ConvertScopedVector(
2116 keychain_adapter.GetAllPasswordFormPasswords()); 2114 keychain_adapter.GetAllPasswordFormPasswords());
2117 ASSERT_EQ(1u, passwords.size()); 2115 ASSERT_EQ(1u, passwords.size());
2118 EXPECT_EQ("http://some.domain.com/", passwords[0]->signon_realm); 2116 EXPECT_EQ("http://some.domain.com/", passwords[0]->signon_realm);
2119 EXPECT_EQ(ASCIIToUTF16("sekrit"), passwords[0]->password_value); 2117 EXPECT_EQ(ASCIIToUTF16("sekrit"), passwords[0]->password_value);
2120 } 2118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698