Home | History | Annotate | Download | only in dbus
      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.
      4 
      5 #ifndef CHROMEOS_DBUS_MOCK_CRYPTOHOME_CLIENT_H_
      6 #define CHROMEOS_DBUS_MOCK_CRYPTOHOME_CLIENT_H_
      7 
      8 #include <string>
      9 
     10 #include "chromeos/dbus/cryptohome_client.h"
     11 #include "testing/gmock/include/gmock/gmock.h"
     12 
     13 namespace chromeos {
     14 
     15 class MockCryptohomeClient : public CryptohomeClient {
     16  public:
     17   MockCryptohomeClient();
     18   virtual ~MockCryptohomeClient();
     19 
     20   MOCK_METHOD1(Init, void(dbus::Bus* bus));
     21   MOCK_METHOD2(SetAsyncCallStatusHandlers,
     22                void(const AsyncCallStatusHandler& handler,
     23                     const AsyncCallStatusWithDataHandler& data_handler));
     24   MOCK_METHOD0(ResetAsyncCallStatusHandlers, void());
     25   MOCK_METHOD1(WaitForServiceToBeAvailable,
     26                void(const WaitForServiceToBeAvailableCallback& callback));
     27   MOCK_METHOD1(IsMounted, void(const BoolDBusMethodCallback& callback));
     28   MOCK_METHOD1(Unmount, bool(bool* success));
     29   MOCK_METHOD3(AsyncCheckKey,
     30                void(const std::string& username,
     31                     const std::string& key,
     32                     const AsyncMethodCallback& callback));
     33   MOCK_METHOD4(AsyncMigrateKey,
     34                void(const std::string& username,
     35                     const std::string& from_key,
     36                     const std::string& to_key,
     37                     const AsyncMethodCallback& callback));
     38   MOCK_METHOD2(AsyncRemove, void(const std::string& username,
     39                                  const AsyncMethodCallback& callback));
     40   MOCK_METHOD1(GetSystemSalt, void(const GetSystemSaltCallback& callback));
     41   MOCK_METHOD2(GetSanitizedUsername,
     42                void(const std::string& username,
     43                     const StringDBusMethodCallback& callback));
     44   MOCK_METHOD1(BlockingGetSanitizedUsername,
     45                std::string(const std::string& username));
     46   MOCK_METHOD4(AsyncMount, void(const std::string& username,
     47                                 const std::string& key,
     48                                 int flags,
     49                                 const AsyncMethodCallback& callback));
     50   MOCK_METHOD4(AsyncAddKey, void(const std::string& username,
     51                                  const std::string& key,
     52                                  const std::string& new_key,
     53                                  const AsyncMethodCallback& callback));
     54   MOCK_METHOD1(AsyncMountGuest,
     55                void(const AsyncMethodCallback& callback));
     56   MOCK_METHOD3(AsyncMountPublic, void(const std::string& public_mount_id,
     57                                       int flags,
     58                                       const AsyncMethodCallback& callback));
     59   MOCK_METHOD1(TpmIsReady, void(const BoolDBusMethodCallback& callback));
     60   MOCK_METHOD1(TpmIsEnabled, void(const BoolDBusMethodCallback& callback));
     61   MOCK_METHOD1(CallTpmIsEnabledAndBlock, bool(bool* enabled));
     62   MOCK_METHOD1(TpmGetPassword, void(const StringDBusMethodCallback& callback));
     63   MOCK_METHOD1(TpmIsOwned, void(const BoolDBusMethodCallback& callback));
     64   MOCK_METHOD1(CallTpmIsOwnedAndBlock, bool(bool* owned));
     65   MOCK_METHOD1(TpmIsBeingOwned, void(const BoolDBusMethodCallback& callback));
     66   MOCK_METHOD1(CallTpmIsBeingOwnedAndBlock, bool(bool* owning));
     67   MOCK_METHOD1(TpmCanAttemptOwnership,
     68                void(const VoidDBusMethodCallback& callback));
     69   MOCK_METHOD1(TpmClearStoredPassword,
     70                void(const VoidDBusMethodCallback& callback));
     71   MOCK_METHOD0(CallTpmClearStoredPasswordAndBlock, bool());
     72   MOCK_METHOD1(Pkcs11IsTpmTokenReady,
     73                void(const BoolDBusMethodCallback& callback));
     74   MOCK_METHOD1(Pkcs11GetTpmTokenInfo,
     75                void(const Pkcs11GetTpmTokenInfoCallback& callback));
     76   MOCK_METHOD2(Pkcs11GetTpmTokenInfoForUser,
     77                void(const std::string& username,
     78                     const Pkcs11GetTpmTokenInfoCallback& callback));
     79   MOCK_METHOD3(InstallAttributesGet,
     80                bool(const std::string& name,
     81                     std::vector<uint8>* value,
     82                     bool* successful));
     83   MOCK_METHOD3(InstallAttributesSet,
     84                bool(const std::string& name,
     85                     const std::vector<uint8>& value,
     86                     bool* successful));
     87   MOCK_METHOD1(InstallAttributesFinalize, bool(bool* successful));
     88   MOCK_METHOD1(InstallAttributesIsReady,
     89                void(const BoolDBusMethodCallback& callback));
     90   MOCK_METHOD1(InstallAttributesIsInvalid, bool(bool* is_invalid));
     91   MOCK_METHOD1(InstallAttributesIsFirstInstall, bool(bool* is_first_install));
     92   MOCK_METHOD1(TpmAttestationIsPrepared,
     93                void(const BoolDBusMethodCallback& callback));
     94   MOCK_METHOD1(TpmAttestationIsEnrolled,
     95                void(const BoolDBusMethodCallback& callback));
     96   MOCK_METHOD1(AsyncTpmAttestationCreateEnrollRequest,
     97                void(const AsyncMethodCallback& callback));
     98   MOCK_METHOD2(AsyncTpmAttestationEnroll,
     99                void(const std::string& pca_response,
    100                     const AsyncMethodCallback& callback));
    101   MOCK_METHOD4(
    102       AsyncTpmAttestationCreateCertRequest,
    103       void(attestation::AttestationCertificateProfile certificate_profile,
    104            const std::string& user_id,
    105            const std::string& request_origin,
    106            const AsyncMethodCallback& callback));
    107   MOCK_METHOD5(AsyncTpmAttestationFinishCertRequest,
    108                void(const std::string& pca_response,
    109                     attestation::AttestationKeyType key_type,
    110                     const std::string& user_id,
    111                     const std::string& key_name,
    112                     const AsyncMethodCallback& callback));
    113   MOCK_METHOD4(TpmAttestationDoesKeyExist,
    114                void(attestation::AttestationKeyType key_type,
    115                     const std::string& user_id,
    116                     const std::string& key_name,
    117                     const BoolDBusMethodCallback& callback));
    118   MOCK_METHOD4(TpmAttestationGetCertificate,
    119                void(attestation::AttestationKeyType key_type,
    120                     const std::string& user_id,
    121                     const std::string& key_name,
    122                     const DataMethodCallback& callback));
    123   MOCK_METHOD4(TpmAttestationGetPublicKey,
    124                void(attestation::AttestationKeyType key_type,
    125                     const std::string& user_id,
    126                     const std::string& key_name,
    127                     const DataMethodCallback& callback));
    128   MOCK_METHOD4(TpmAttestationRegisterKey,
    129                void(attestation::AttestationKeyType key_type,
    130                     const std::string& user_id,
    131                     const std::string& key_name,
    132                     const AsyncMethodCallback& callback));
    133   MOCK_METHOD8(TpmAttestationSignEnterpriseChallenge,
    134                void(attestation::AttestationKeyType key_type,
    135                     const std::string& user_id,
    136                     const std::string& key_name,
    137                     const std::string& domain,
    138                     const std::string& device_id,
    139                     attestation::AttestationChallengeOptions options,
    140                     const std::string& challenge,
    141                     const AsyncMethodCallback& callback));
    142   MOCK_METHOD5(TpmAttestationSignSimpleChallenge,
    143                void(attestation::AttestationKeyType key_type,
    144                     const std::string& user_id,
    145                     const std::string& key_name,
    146                     const std::string& challenge,
    147                     const AsyncMethodCallback& callback));
    148   MOCK_METHOD4(TpmAttestationGetKeyPayload,
    149                void(attestation::AttestationKeyType key_type,
    150                     const std::string& user_id,
    151                     const std::string& key_name,
    152                     const DataMethodCallback& callback));
    153   MOCK_METHOD5(TpmAttestationSetKeyPayload,
    154                void(attestation::AttestationKeyType key_type,
    155                     const std::string& user_id,
    156                     const std::string& key_name,
    157                     const std::string& payload,
    158                     const BoolDBusMethodCallback& callback));
    159   MOCK_METHOD4(TpmAttestationDeleteKeys,
    160                void(attestation::AttestationKeyType key_type,
    161                     const std::string& user_id,
    162                     const std::string& key_prefix,
    163                     const BoolDBusMethodCallback& callback));
    164 };
    165 
    166 }  // namespace chromeos
    167 
    168 #endif  // CHROMEOS_DBUS_MOCK_CRYPTOHOME_CLIENT_H_
    169