| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "crypto/keychain_mac.h" | 15 #include "crypto/keychain_mac.h" |
| 16 | 16 |
| 17 namespace crypto { | 17 namespace crypto { |
| 18 | 18 |
| 19 // Mock Keychain wrapper for testing code that interacts with the OS X | 19 // Mock Keychain wrapper for testing code that interacts with the OS X |
| 20 // Keychain. Implemented by storing SecKeychainAttributeList and | 20 // Keychain. Implemented by storing SecKeychainAttributeList and |
| 21 // KeychainPasswordData values in separate mutable containers and | 21 // KeychainPasswordData values in separate mutable containers and |
| 22 // mapping them to integer keys. | 22 // mapping them to integer keys. |
| 23 // | 23 // |
| 24 // Note that "const" is pretty much meaningless for this class; the const-ness | 24 // Note that "const" is pretty much meaningless for this class; the const-ness |
| 25 // of MacKeychain doesn't apply to the actual keychain data, so all of the Mock | 25 // of MacKeychain doesn't apply to the actual keychain data, so all of the Mock |
| 26 // data is mutable; don't assume that it won't change over the life of tests. | 26 // data is mutable; don't assume that it won't change over the life of tests. |
| 27 class MockKeychain : public MacKeychain { | 27 class CRYPTO_EXPORT MockKeychain : public MacKeychain { |
| 28 public: | 28 public: |
| 29 MockKeychain(); | 29 MockKeychain(); |
| 30 virtual ~MockKeychain(); | 30 virtual ~MockKeychain(); |
| 31 | 31 |
| 32 // MacKeychain implementation. | 32 // MacKeychain implementation. |
| 33 virtual OSStatus ItemCopyAttributesAndData( | 33 virtual OSStatus ItemCopyAttributesAndData( |
| 34 SecKeychainItemRef itemRef, | 34 SecKeychainItemRef itemRef, |
| 35 SecKeychainAttributeInfo* info, | 35 SecKeychainAttributeInfo* info, |
| 36 SecItemClass* itemClass, | 36 SecItemClass* itemClass, |
| 37 SecKeychainAttributeList** attrList, | 37 SecKeychainAttributeList** attrList, |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // and |ItemFreeContent|. | 217 // and |ItemFreeContent|. |
| 218 mutable unsigned int password_data_count_; | 218 mutable unsigned int password_data_count_; |
| 219 | 219 |
| 220 // Records the password being set when |AddGenericPassword()| gets called. | 220 // Records the password being set when |AddGenericPassword()| gets called. |
| 221 mutable std::string add_generic_password_; | 221 mutable std::string add_generic_password_; |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 } // namespace crypto | 224 } // namespace crypto |
| 225 | 225 |
| 226 #endif // CRYPTO_MOCK_KEYCHAIN_MAC_H_ | 226 #endif // CRYPTO_MOCK_KEYCHAIN_MAC_H_ |
| OLD | NEW |