| OLD | NEW |
| 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 #ifndef CRYPTO_MOCK_KEYCHAIN_MAC_H_ | 5 #ifndef CRYPTO_MOCK_KEYCHAIN_MAC_H_ |
| 6 #define CRYPTO_MOCK_KEYCHAIN_MAC_H_ | 6 #define CRYPTO_MOCK_KEYCHAIN_MAC_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 // AppleKeychain implementation. | 34 // AppleKeychain implementation. |
| 35 virtual OSStatus FindGenericPassword( | 35 virtual OSStatus FindGenericPassword( |
| 36 CFTypeRef keychainOrArray, | 36 CFTypeRef keychainOrArray, |
| 37 UInt32 serviceNameLength, | 37 UInt32 serviceNameLength, |
| 38 const char* serviceName, | 38 const char* serviceName, |
| 39 UInt32 accountNameLength, | 39 UInt32 accountNameLength, |
| 40 const char* accountName, | 40 const char* accountName, |
| 41 UInt32* passwordLength, | 41 UInt32* passwordLength, |
| 42 void** passwordData, | 42 void** passwordData, |
| 43 SecKeychainItemRef* itemRef) const OVERRIDE; | 43 SecKeychainItemRef* itemRef) const override; |
| 44 virtual OSStatus ItemFreeContent(SecKeychainAttributeList* attrList, | 44 virtual OSStatus ItemFreeContent(SecKeychainAttributeList* attrList, |
| 45 void* data) const OVERRIDE; | 45 void* data) const override; |
| 46 virtual OSStatus AddGenericPassword( | 46 virtual OSStatus AddGenericPassword( |
| 47 SecKeychainRef keychain, | 47 SecKeychainRef keychain, |
| 48 UInt32 serviceNameLength, | 48 UInt32 serviceNameLength, |
| 49 const char* serviceName, | 49 const char* serviceName, |
| 50 UInt32 accountNameLength, | 50 UInt32 accountNameLength, |
| 51 const char* accountName, | 51 const char* accountName, |
| 52 UInt32 passwordLength, | 52 UInt32 passwordLength, |
| 53 const void* passwordData, | 53 const void* passwordData, |
| 54 SecKeychainItemRef* itemRef) const OVERRIDE; | 54 SecKeychainItemRef* itemRef) const override; |
| 55 | 55 |
| 56 #if !defined(OS_IOS) | 56 #if !defined(OS_IOS) |
| 57 virtual OSStatus ItemCopyAttributesAndData( | 57 virtual OSStatus ItemCopyAttributesAndData( |
| 58 SecKeychainItemRef itemRef, | 58 SecKeychainItemRef itemRef, |
| 59 SecKeychainAttributeInfo* info, | 59 SecKeychainAttributeInfo* info, |
| 60 SecItemClass* itemClass, | 60 SecItemClass* itemClass, |
| 61 SecKeychainAttributeList** attrList, | 61 SecKeychainAttributeList** attrList, |
| 62 UInt32* length, | 62 UInt32* length, |
| 63 void** outData) const OVERRIDE; | 63 void** outData) const override; |
| 64 // Pass "fail_me" as the data to get errSecAuthFailed. | 64 // Pass "fail_me" as the data to get errSecAuthFailed. |
| 65 virtual OSStatus ItemModifyAttributesAndData( | 65 virtual OSStatus ItemModifyAttributesAndData( |
| 66 SecKeychainItemRef itemRef, | 66 SecKeychainItemRef itemRef, |
| 67 const SecKeychainAttributeList* attrList, | 67 const SecKeychainAttributeList* attrList, |
| 68 UInt32 length, | 68 UInt32 length, |
| 69 const void* data) const OVERRIDE; | 69 const void* data) const override; |
| 70 virtual OSStatus ItemFreeAttributesAndData(SecKeychainAttributeList* attrList, | 70 virtual OSStatus ItemFreeAttributesAndData(SecKeychainAttributeList* attrList, |
| 71 void* data) const OVERRIDE; | 71 void* data) const override; |
| 72 virtual OSStatus ItemDelete(SecKeychainItemRef itemRef) const OVERRIDE; | 72 virtual OSStatus ItemDelete(SecKeychainItemRef itemRef) const override; |
| 73 virtual OSStatus SearchCreateFromAttributes( | 73 virtual OSStatus SearchCreateFromAttributes( |
| 74 CFTypeRef keychainOrArray, | 74 CFTypeRef keychainOrArray, |
| 75 SecItemClass itemClass, | 75 SecItemClass itemClass, |
| 76 const SecKeychainAttributeList* attrList, | 76 const SecKeychainAttributeList* attrList, |
| 77 SecKeychainSearchRef* searchRef) const OVERRIDE; | 77 SecKeychainSearchRef* searchRef) const override; |
| 78 virtual OSStatus SearchCopyNext(SecKeychainSearchRef searchRef, | 78 virtual OSStatus SearchCopyNext(SecKeychainSearchRef searchRef, |
| 79 SecKeychainItemRef* itemRef) const OVERRIDE; | 79 SecKeychainItemRef* itemRef) const override; |
| 80 // Pass "some.domain.com" as the serverName to get errSecDuplicateItem. | 80 // Pass "some.domain.com" as the serverName to get errSecDuplicateItem. |
| 81 virtual OSStatus AddInternetPassword( | 81 virtual OSStatus AddInternetPassword( |
| 82 SecKeychainRef keychain, | 82 SecKeychainRef keychain, |
| 83 UInt32 serverNameLength, | 83 UInt32 serverNameLength, |
| 84 const char* serverName, | 84 const char* serverName, |
| 85 UInt32 securityDomainLength, | 85 UInt32 securityDomainLength, |
| 86 const char* securityDomain, | 86 const char* securityDomain, |
| 87 UInt32 accountNameLength, | 87 UInt32 accountNameLength, |
| 88 const char* accountName, | 88 const char* accountName, |
| 89 UInt32 pathLength, const char* path, | 89 UInt32 pathLength, const char* path, |
| 90 UInt16 port, SecProtocolType protocol, | 90 UInt16 port, SecProtocolType protocol, |
| 91 SecAuthenticationType authenticationType, | 91 SecAuthenticationType authenticationType, |
| 92 UInt32 passwordLength, | 92 UInt32 passwordLength, |
| 93 const void* passwordData, | 93 const void* passwordData, |
| 94 SecKeychainItemRef* itemRef) const OVERRIDE; | 94 SecKeychainItemRef* itemRef) const override; |
| 95 virtual void Free(CFTypeRef ref) const OVERRIDE; | 95 virtual void Free(CFTypeRef ref) const override; |
| 96 | 96 |
| 97 // Return the counts of objects returned by Create/Copy functions but never | 97 // Return the counts of objects returned by Create/Copy functions but never |
| 98 // Free'd as they should have been. | 98 // Free'd as they should have been. |
| 99 int UnfreedSearchCount() const; | 99 int UnfreedSearchCount() const; |
| 100 int UnfreedKeychainItemCount() const; | 100 int UnfreedKeychainItemCount() const; |
| 101 int UnfreedAttributeDataCount() const; | 101 int UnfreedAttributeDataCount() const; |
| 102 | 102 |
| 103 // Returns true if all items added with AddInternetPassword have a creator | 103 // Returns true if all items added with AddInternetPassword have a creator |
| 104 // code set. | 104 // code set. |
| 105 bool CreatorCodesSetForAddedItems() const; | 105 bool CreatorCodesSetForAddedItems() const; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // and |ItemFreeContent|. | 241 // and |ItemFreeContent|. |
| 242 mutable int password_data_count_; | 242 mutable int password_data_count_; |
| 243 | 243 |
| 244 // Records the password being set when |AddGenericPassword()| gets called. | 244 // Records the password being set when |AddGenericPassword()| gets called. |
| 245 mutable std::string add_generic_password_; | 245 mutable std::string add_generic_password_; |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 } // namespace crypto | 248 } // namespace crypto |
| 249 | 249 |
| 250 #endif // CRYPTO_MOCK_KEYCHAIN_MAC_H_ | 250 #endif // CRYPTO_MOCK_KEYCHAIN_MAC_H_ |
| OLD | NEW |