1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef IAM_MOCK_USER_IDM_SERVICE_H
16 #define IAM_MOCK_USER_IDM_SERVICE_H
17 #include <memory>
18 
19 #include <gmock/gmock.h>
20 
21 #include "user_idm_stub.h"
22 
23 namespace OHOS {
24 namespace UserIam {
25 namespace UserAuth {
26 class MockUserIdmService final : public UserIdmStub {
27 public:
28     MOCK_METHOD2(OpenSession, int32_t(int32_t userId, std::vector<uint8_t> &challenge));
29     MOCK_METHOD1(CloseSession, void(int32_t userId));
30     MOCK_METHOD3(GetCredentialInfo, int32_t(int32_t userId, AuthType authType,
31                                         const sptr<IdmGetCredInfoCallbackInterface> &callback));
32     MOCK_METHOD2(GetSecInfo, int32_t(int32_t userId, const sptr<IdmGetSecureUserInfoCallbackInterface> &callback));
33     MOCK_METHOD4(AddCredential, void(int32_t userId, const CredentialPara &credPara,
34         const sptr<IdmCallbackInterface> &callback, bool isUpdate));
35     MOCK_METHOD3(UpdateCredential, void(int32_t userId, const CredentialPara &credPara,
36         const sptr<IdmCallbackInterface> &callback));
37     MOCK_METHOD1(Cancel, int32_t(int32_t userId));
38     MOCK_METHOD2(EnforceDelUser, int32_t(int32_t userId, const sptr<IdmCallbackInterface> &callback));
39     MOCK_METHOD3(DelUser, void(int32_t userId, const std::vector<uint8_t> authToken,
40                               const sptr<IdmCallbackInterface> &callback));
41     MOCK_METHOD4(DelCredential, void(int32_t userId, uint64_t credentialId,
42                                     const std::vector<uint8_t> &authToken, const sptr<IdmCallbackInterface> &callback));
43     MOCK_METHOD1(ClearRedundancyCredential, void(const sptr<IdmCallbackInterface> &callback));
44 };
45 } // namespace UserAuth
46 } // namespace UserIam
47 } // namespace OHOS
48 #endif // IAM_MOCK_USER_IDM_SERVICE_H