diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-02 16:58:03 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-02 16:58:03 +0000 |
commit | 75d112d2ab997e2e998007733602c7d1ca72f9ff (patch) | |
tree | 86a41a0bedd9b42118c5f69c2986f65bf115cca4 /chrome/browser/keychain_mock_mac.h | |
parent | 28a750d892a0afd056e6d69cb7da99db8910d090 (diff) | |
download | chromium_src-75d112d2ab997e2e998007733602c7d1ca72f9ff.zip chromium_src-75d112d2ab997e2e998007733602c7d1ca72f9ff.tar.gz chromium_src-75d112d2ab997e2e998007733602c7d1ca72f9ff.tar.bz2 |
Implement Add and Update for PasswordStoreMac.
Modify LoginDatabase slightly to give PasswordStoreMac enough information to do the right thing.
Add creator code for keychain items we create, and unit tests to make sure.
BUG=11745
TEST=Visit a site for which you have a password in the Keychain. Type your username, unfocus the field, and then log in with the filled password. Log out, return to the login page, and the username and password should now autofill without user interaction.
Review URL: http://codereview.chromium.org/151176
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19822 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/keychain_mock_mac.h')
-rw-r--r-- | chrome/browser/keychain_mock_mac.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/chrome/browser/keychain_mock_mac.h b/chrome/browser/keychain_mock_mac.h index 48b3bf8..2c5303b 100644 --- a/chrome/browser/keychain_mock_mac.h +++ b/chrome/browser/keychain_mock_mac.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_KEYCHAIN_MOCK_MAC_H_ #define CHROME_BROWSER_KEYCHAIN_MOCK_MAC_H_ +#include <set> #include <vector> #include "chrome/browser/keychain_mac.h" @@ -62,6 +63,10 @@ class MockKeychain : public MacKeychain { int UnfreedKeychainItemCount() const; int UnfreedAttributeDataCount() const; + // Returns true if all items added with AddInternetPassword have a creator + // code set. + bool CreatorCodesSetForAddedItems() const; + struct KeychainTestData { const SecAuthenticationType auth_type; const char* server; @@ -92,15 +97,16 @@ class MockKeychain : public MacKeychain { void SetTestDataProtocol(int item, SecProtocolType value); void SetTestDataAuthType(int item, SecAuthenticationType value); void SetTestDataNegativeItem(int item, Boolean value); + void SetTestDataCreator(int item, OSType value); // Sets the password data and length for the item-th test item. void SetTestDataPasswordBytes(int item, const void* data, size_t length); // Sets the password for the item-th test item. As with SetTestDataString, // the data will not be null-terminated. void SetTestDataPasswordString(int item, const char* value); - // Returns the index of |tag| in |attribute_list|, or -1 if it's not found. - static int IndexForTag(const SecKeychainAttributeList& attribute_list, - UInt32 tag); + // Returns the address of the attribute in attribute_list with tag |tag|. + static SecKeychainAttribute* AttributeWithTag( + const SecKeychainAttributeList& attribute_list, UInt32 tag); static const int kDummySearchRef = 1000; @@ -126,6 +132,9 @@ class MockKeychain : public MacKeychain { mutable int search_copy_count_; mutable int keychain_item_copy_count_; mutable int attribute_data_copy_count_; + + // Tracks which items (by index) were added with AddInternetPassword. + mutable std::set<unsigned int> added_via_api_; }; #endif // CHROME_BROWSER_KEYCHAIN_MOCK_MAC_H_ |