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

Unified 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: A single typedef and kDummySearchRef of type SecKeychainSearchRef. 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 side-by-side diff with in-line comments
Download patch
Index: crypto/mock_keychain_mac.h
===================================================================
--- crypto/mock_keychain_mac.h (revision 147624)
+++ crypto/mock_keychain_mac.h (working copy)
@@ -15,6 +15,9 @@
namespace crypto {
+// Type used for the keys in the std::map(s) and MockKeychain items.
+typedef uintptr_t MockKeychainKeyType;
wtc 2012/07/23 18:22:02 I think it's better to name this type MockKeychain
+
// Mock Keychain wrapper for testing code that interacts with the OS X
// Keychain. Implemented by storing SecKeychainAttributeList and
// KeychainPasswordData values in separate mutable containers and
@@ -149,34 +152,44 @@
SecProtocolType protocol,
SecAuthenticationType authenticationType) const;
// Initializes storage for keychain data at |key|.
- void InitializeKeychainData(unsigned int key) const;
+ void InitializeKeychainData(MockKeychainKeyType key) const;
// Sets the data and length of |tag| in the item-th test item.
- void SetTestDataBytes(int item, UInt32 tag, const void* data, size_t length);
+ void SetTestDataBytes(
+ MockKeychainKeyType item,
+ UInt32 tag,
+ const void* data,
+ size_t length);
// Sets the data and length of |tag| in the item-th test item based on
// |value|. The null-terminator will not be included; the Keychain Services
// docs don't indicate whether it is or not, so clients should not assume
// that it will be.
- void SetTestDataString(int item, UInt32 tag, const char* value);
+ void SetTestDataString(MockKeychainKeyType item,
+ UInt32 tag,
+ const char* value);
// Sets the data of the corresponding attribute of the item-th test item to
// |value|. Assumes that the space has alread been allocated, and the length
// set.
- void SetTestDataPort(int item, UInt32 value);
- void SetTestDataProtocol(int item, SecProtocolType value);
- void SetTestDataAuthType(int item, SecAuthenticationType value);
- void SetTestDataNegativeItem(int item, Boolean value);
- void SetTestDataCreator(int item, OSType value);
+ void SetTestDataPort(MockKeychainKeyType item, UInt32 value);
+ void SetTestDataProtocol(MockKeychainKeyType item, SecProtocolType value);
+ void SetTestDataAuthType(MockKeychainKeyType item,
+ SecAuthenticationType value);
+ void SetTestDataNegativeItem(MockKeychainKeyType item, Boolean value);
+ void SetTestDataCreator(MockKeychainKeyType 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);
+ void SetTestDataPasswordBytes(
+ MockKeychainKeyType 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);
+ void SetTestDataPasswordString(MockKeychainKeyType item, const char* value);
// 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;
+ static const SecKeychainSearchRef kDummySearchRef;
typedef struct KeychainPasswordData {
KeychainPasswordData() : data(NULL), length(0) {}
@@ -186,15 +199,16 @@
// Mutable because the MockKeychain API requires its internal keychain storage
// to be modifiable by users of this class.
- mutable std::map<unsigned int, SecKeychainAttributeList> keychain_attr_list_;
- mutable std::map<unsigned int, KeychainPasswordData> keychain_data_;
- mutable unsigned int next_item_key_;
+ mutable std::map<MockKeychainKeyType,
+ SecKeychainAttributeList> keychain_attr_list_;
+ mutable std::map<MockKeychainKeyType, KeychainPasswordData> keychain_data_;
+ mutable MockKeychainKeyType next_item_key_;
// Tracks the items that should be returned in subsequent calls to
// SearchCopyNext, based on the last call to SearchCreateFromAttributes.
// We can't handle multiple active searches, since we don't track the search
// ref we return, but we don't need to for our mocking.
- mutable std::vector<unsigned int> remaining_search_results_;
+ mutable std::vector<MockKeychainKeyType> remaining_search_results_;
// Track copies and releases to make sure they balance. Really these should
// be maps to track per item, but this should be good enough to catch
@@ -204,7 +218,7 @@
mutable int attribute_data_copy_count_;
// Tracks which items (by key) were added with AddInternetPassword.
- mutable std::set<unsigned int> added_via_api_;
+ mutable std::set<MockKeychainKeyType> added_via_api_;
// Result code for the |FindGenericPassword()| method.
OSStatus find_generic_result_;
« no previous file with comments | « AUTHORS ('k') | crypto/mock_keychain_mac.cc » ('j') | crypto/mock_keychain_mac.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698