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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_DBUS_MOCK_CRYPTOHOME_CLIENT_H_
6 #define CHROMEOS_DBUS_MOCK_CRYPTOHOME_CLIENT_H_
10 #include "chromeos/dbus/cryptohome_client.h"
11 #include "testing/gmock/include/gmock/gmock.h"
15 class MockCryptohomeClient
: public CryptohomeClient
{
17 MockCryptohomeClient();
18 virtual ~MockCryptohomeClient();
20 MOCK_METHOD2(SetAsyncCallStatusHandlers
,
21 void(const AsyncCallStatusHandler
& handler
,
22 const AsyncCallStatusWithDataHandler
& data_handler
));
23 MOCK_METHOD0(ResetAsyncCallStatusHandlers
, void());
24 MOCK_METHOD1(IsMounted
, void(const BoolDBusMethodCallback
& callback
));
25 MOCK_METHOD1(Unmount
, bool(bool* success
));
26 MOCK_METHOD3(AsyncCheckKey
,
27 void(const std::string
& username
,
28 const std::string
& key
,
29 const AsyncMethodCallback
& callback
));
30 MOCK_METHOD4(AsyncMigrateKey
,
31 void(const std::string
& username
,
32 const std::string
& from_key
,
33 const std::string
& to_key
,
34 const AsyncMethodCallback
& callback
));
35 MOCK_METHOD2(AsyncRemove
, void(const std::string
& username
,
36 const AsyncMethodCallback
& callback
));
37 MOCK_METHOD1(GetSystemSalt
, bool(std::vector
<uint8
>* salt
));
38 MOCK_METHOD2(GetSanitizedUsername
,
39 void(const std::string
& username
,
40 const StringDBusMethodCallback
& callback
));
41 MOCK_METHOD4(AsyncMount
, void(const std::string
& username
,
42 const std::string
& key
,
44 const AsyncMethodCallback
& callback
));
45 MOCK_METHOD1(AsyncMountGuest
,
46 void(const AsyncMethodCallback
& callback
));
47 MOCK_METHOD1(TpmIsReady
, void(const BoolDBusMethodCallback
& callback
));
48 MOCK_METHOD1(TpmIsEnabled
, void(const BoolDBusMethodCallback
& callback
));
49 MOCK_METHOD1(CallTpmIsEnabledAndBlock
, bool(bool* enabled
));
50 MOCK_METHOD1(TpmGetPassword
, void(const StringDBusMethodCallback
& callback
));
51 MOCK_METHOD1(TpmIsOwned
, void(const BoolDBusMethodCallback
& callback
));
52 MOCK_METHOD1(CallTpmIsOwnedAndBlock
, bool(bool* owned
));
53 MOCK_METHOD1(TpmIsBeingOwned
, void(const BoolDBusMethodCallback
& callback
));
54 MOCK_METHOD1(CallTpmIsBeingOwnedAndBlock
, bool(bool* owning
));
55 MOCK_METHOD1(TpmCanAttemptOwnership
,
56 void(const VoidDBusMethodCallback
& callback
));
57 MOCK_METHOD1(TpmClearStoredPassword
,
58 void(const VoidDBusMethodCallback
& callback
));
59 MOCK_METHOD0(CallTpmClearStoredPasswordAndBlock
, bool());
60 MOCK_METHOD1(Pkcs11IsTpmTokenReady
,
61 void(const BoolDBusMethodCallback
& callback
));
62 MOCK_METHOD1(Pkcs11GetTpmTokenInfo
,
63 void(const Pkcs11GetTpmTokenInfoCallback
& callback
));
64 MOCK_METHOD3(InstallAttributesGet
,
65 bool(const std::string
& name
,
66 std::vector
<uint8
>* value
,
68 MOCK_METHOD3(InstallAttributesSet
,
69 bool(const std::string
& name
,
70 const std::vector
<uint8
>& value
,
72 MOCK_METHOD1(InstallAttributesFinalize
, bool(bool* successful
));
73 MOCK_METHOD1(InstallAttributesIsReady
,
74 void(const BoolDBusMethodCallback
& callback
));
75 MOCK_METHOD1(InstallAttributesIsInvalid
, bool(bool* is_invalid
));
76 MOCK_METHOD1(InstallAttributesIsFirstInstall
, bool(bool* is_first_install
));
77 MOCK_METHOD1(TpmAttestationIsPrepared
,
78 void(const BoolDBusMethodCallback
& callback
));
79 MOCK_METHOD1(TpmAttestationIsEnrolled
,
80 void(const BoolDBusMethodCallback
& callback
));
81 MOCK_METHOD1(AsyncTpmAttestationCreateEnrollRequest
,
82 void(const AsyncMethodCallback
& callback
));
83 MOCK_METHOD2(AsyncTpmAttestationEnroll
,
84 void(const std::string
& pca_response
,
85 const AsyncMethodCallback
& callback
));
86 MOCK_METHOD2(AsyncTpmAttestationCreateCertRequest
,
88 const AsyncMethodCallback
& callback
));
89 MOCK_METHOD4(AsyncTpmAttestationFinishCertRequest
,
90 void(const std::string
& pca_response
,
91 AttestationKeyType key_type
,
92 const std::string
& key_name
,
93 const AsyncMethodCallback
& callback
));
94 MOCK_METHOD3(TpmAttestationDoesKeyExist
,
95 void(AttestationKeyType key_type
,
96 const std::string
& key_name
,
97 const BoolDBusMethodCallback
& callback
));
98 MOCK_METHOD3(TpmAttestationGetCertificate
,
99 void(AttestationKeyType key_type
,
100 const std::string
& key_name
,
101 const DataMethodCallback
& callback
));
102 MOCK_METHOD3(TpmAttestationGetPublicKey
,
103 void(AttestationKeyType key_type
,
104 const std::string
& key_name
,
105 const DataMethodCallback
& callback
));
106 MOCK_METHOD3(TpmAttestationRegisterKey
,
107 void(AttestationKeyType key_type
,
108 const std::string
& key_name
,
109 const AsyncMethodCallback
& callback
));
110 MOCK_METHOD7(TpmAttestationSignEnterpriseChallenge
,
111 void(AttestationKeyType key_type
,
112 const std::string
& key_name
,
113 const std::string
& domain
,
114 const std::string
& device_id
,
115 AttestationChallengeOptions options
,
116 const std::string
& challenge
,
117 const AsyncMethodCallback
& callback
));
118 MOCK_METHOD4(TpmAttestationSignSimpleChallenge
,
119 void(AttestationKeyType key_type
,
120 const std::string
& key_name
,
121 const std::string
& challenge
,
122 const AsyncMethodCallback
& callback
));
125 } // namespace chromeos
127 #endif // CHROMEOS_DBUS_MOCK_CRYPTOHOME_CLIENT_H_