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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 const SecKeychainAttributeList& attribute_list, | 202 const SecKeychainAttributeList& attribute_list, |
203 UInt32 tag); | 203 UInt32 tag); |
204 | 204 |
205 static const SecKeychainSearchRef kDummySearchRef; | 205 static const SecKeychainSearchRef kDummySearchRef; |
206 | 206 |
207 // Simulates the state when the user refuses to unclock the Keychain. | 207 // Simulates the state when the user refuses to unclock the Keychain. |
208 // If true, reading and modifying a password value result in errSecAuthFailed. | 208 // If true, reading and modifying a password value result in errSecAuthFailed. |
209 bool locked_; | 209 bool locked_; |
210 | 210 |
211 typedef struct KeychainPasswordData { | 211 typedef struct KeychainPasswordData { |
212 KeychainPasswordData() : data(NULL), length(0) {} | 212 KeychainPasswordData() : data(nullptr), length(0) {} |
213 void* data; | 213 void* data; |
214 UInt32 length; | 214 UInt32 length; |
215 } KeychainPasswordData; | 215 } KeychainPasswordData; |
216 | 216 |
217 // Mutable because the MockAppleKeychain API requires its internal keychain | 217 // Mutable because the MockAppleKeychain API requires its internal keychain |
218 // storage to be modifiable by users of this class. | 218 // storage to be modifiable by users of this class. |
219 mutable MockKeychainAttributesMap keychain_attr_list_; | 219 mutable MockKeychainAttributesMap keychain_attr_list_; |
220 mutable std::map<MockKeychainItemType, | 220 mutable std::map<MockKeychainItemType, |
221 KeychainPasswordData> keychain_data_; | 221 KeychainPasswordData> keychain_data_; |
222 mutable MockKeychainItemType next_item_key_; | 222 mutable MockKeychainItemType next_item_key_; |
(...skipping 25 matching lines...) Expand all Loading... |
248 // and |ItemFreeContent|. | 248 // and |ItemFreeContent|. |
249 mutable int password_data_count_; | 249 mutable int password_data_count_; |
250 | 250 |
251 // Records the password being set when |AddGenericPassword()| gets called. | 251 // Records the password being set when |AddGenericPassword()| gets called. |
252 mutable std::string add_generic_password_; | 252 mutable std::string add_generic_password_; |
253 }; | 253 }; |
254 | 254 |
255 } // namespace crypto | 255 } // namespace crypto |
256 | 256 |
257 #endif // CRYPTO_MOCK_KEYCHAIN_MAC_H_ | 257 #endif // CRYPTO_MOCK_KEYCHAIN_MAC_H_ |
OLD | NEW |