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

Side by Side Diff: crypto/mock_keychain_mac.h

Issue 10738003: src/crypto should build on the x86_64 architecture. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « AUTHORS ('k') | crypto/mock_keychain_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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>
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // set. 163 // set.
164 void SetTestDataPort(int item, UInt32 value); 164 void SetTestDataPort(int item, UInt32 value);
165 void SetTestDataProtocol(int item, SecProtocolType value); 165 void SetTestDataProtocol(int item, SecProtocolType value);
166 void SetTestDataAuthType(int item, SecAuthenticationType value); 166 void SetTestDataAuthType(int item, SecAuthenticationType value);
167 void SetTestDataNegativeItem(int item, Boolean value); 167 void SetTestDataNegativeItem(int item, Boolean value);
168 void SetTestDataCreator(int item, OSType value); 168 void SetTestDataCreator(int item, OSType value);
169 // Sets the password data and length for the item-th test item. 169 // Sets the password data and length for the item-th test item.
170 void SetTestDataPasswordBytes(int item, const void* data, size_t length); 170 void SetTestDataPasswordBytes(int item, const void* data, size_t length);
171 // Sets the password for the item-th test item. As with SetTestDataString, 171 // Sets the password for the item-th test item. As with SetTestDataString,
172 // the data will not be null-terminated. 172 // the data will not be null-terminated.
173 void SetTestDataPasswordString(int item, const char* value); 173 void SetTestDataPasswordString(int item, const char* value);
wtc 2012/07/11 21:15:28 All of these "int item" arguments probably should
174 174
175 // Returns the address of the attribute in attribute_list with tag |tag|. 175 // Returns the address of the attribute in attribute_list with tag |tag|.
176 static SecKeychainAttribute* AttributeWithTag( 176 static SecKeychainAttribute* AttributeWithTag(
177 const SecKeychainAttributeList& attribute_list, 177 const SecKeychainAttributeList& attribute_list,
178 UInt32 tag); 178 UInt32 tag);
179 179
180 static const int kDummySearchRef = 1000; 180 static const uintptr_t kDummySearchRef = 1000;
181 181
182 typedef struct KeychainPasswordData { 182 typedef struct KeychainPasswordData {
183 KeychainPasswordData() : data(NULL), length(0) {} 183 KeychainPasswordData() : data(NULL), length(0) {}
184 void* data; 184 void* data;
185 UInt32 length; 185 UInt32 length;
186 } KeychainPasswordData; 186 } KeychainPasswordData;
187 187
188 // Mutable because the MockKeychain API requires its internal keychain storage 188 // Mutable because the MockKeychain API requires its internal keychain storage
189 // to be modifiable by users of this class. 189 // to be modifiable by users of this class.
190 mutable std::map<unsigned int, SecKeychainAttributeList> keychain_attr_list_; 190 mutable std::map<unsigned int, SecKeychainAttributeList> keychain_attr_list_;
191 mutable std::map<unsigned int, KeychainPasswordData> keychain_data_; 191 mutable std::map<unsigned int, KeychainPasswordData> keychain_data_;
192 mutable unsigned int next_item_key_; 192 mutable unsigned int next_item_key_;
wtc 2012/07/11 21:15:28 The key type for the std::map's should probably al
193 193
194 // Tracks the items that should be returned in subsequent calls to 194 // Tracks the items that should be returned in subsequent calls to
195 // SearchCopyNext, based on the last call to SearchCreateFromAttributes. 195 // SearchCopyNext, based on the last call to SearchCreateFromAttributes.
196 // We can't handle multiple active searches, since we don't track the search 196 // We can't handle multiple active searches, since we don't track the search
197 // ref we return, but we don't need to for our mocking. 197 // ref we return, but we don't need to for our mocking.
198 mutable std::vector<unsigned int> remaining_search_results_; 198 mutable std::vector<unsigned int> remaining_search_results_;
199 199
200 // Track copies and releases to make sure they balance. Really these should 200 // Track copies and releases to make sure they balance. Really these should
201 // be maps to track per item, but this should be good enough to catch 201 // be maps to track per item, but this should be good enough to catch
202 // real mistakes. 202 // real mistakes.
(...skipping 14 matching lines...) Expand all
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_
OLDNEW
« no previous file with comments | « AUTHORS ('k') | crypto/mock_keychain_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698