• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2024 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_AUTH_SERVICE_H
16 #define IAM_MOCK_USER_AUTH_SERVICE_H
17 
18 #include <gmock/gmock.h>
19 
20 #include "modal_callback_stub.h"
21 #include "user_auth_stub.h"
22 
23 namespace OHOS {
24 namespace UserIam {
25 namespace UserAuth {
26 class MockUserAuthService final : public UserAuthStub {
27 public:
28     MOCK_METHOD3(GetEnrolledState, int32_t(int32_t apiVersion, AuthType authType, EnrolledState &enrolledState));
29 
30     MOCK_METHOD4(GetAvailableStatus, int32_t(int32_t apiVersion, int32_t userId, AuthType authType,
31         AuthTrustLevel authTrustLevel));
32 
GetAvailableStatus(int32_t apiVersion,AuthType authType,AuthTrustLevel authTrustLevel)33     int32_t GetAvailableStatus(int32_t apiVersion, AuthType authType, AuthTrustLevel authTrustLevel)
34     {
35         return 0;
36     }
37 
38     MOCK_METHOD4(GetProperty,
39         void(int32_t userId, AuthType authType, const std::vector<Attributes::AttributeKey> &keys,
40             sptr<GetExecutorPropertyCallbackInterface> &callback));
41 
42     MOCK_METHOD3(GetPropertyById, void(uint64_t credentialId, const std::vector<Attributes::AttributeKey> &keys,
43             sptr<GetExecutorPropertyCallbackInterface> &callback));
44 
45     MOCK_METHOD4(SetProperty, void(int32_t userId, AuthType authType, const Attributes &attributes,
46                                   sptr<SetExecutorPropertyCallbackInterface> &callback));
47 
48     MOCK_METHOD3(AuthUser, uint64_t(AuthParamInner &param, std::optional<RemoteAuthParam> &remoteAuthParam,
49         sptr<UserAuthCallbackInterface> &callback));
50 
51     MOCK_METHOD5(Auth,
52         uint64_t(int32_t apiVersion, const std::vector<uint8_t> &challenge, AuthType authType,
53             AuthTrustLevel authTrustLevel, sptr<UserAuthCallbackInterface> &callback));
54 
55     MOCK_METHOD5(AuthWidget, uint64_t(int32_t apiVersion, const AuthParamInner &authParam,
56         const WidgetParamInner &widgetParam, sptr<UserAuthCallbackInterface> &callback,
57         sptr<ModalCallbackInterface> &modalCallback));
58 
59     MOCK_METHOD3(Identify,
60         uint64_t(const std::vector<uint8_t> &challenge, AuthType authType, sptr<UserAuthCallbackInterface> &callback));
61 
62     MOCK_METHOD2(CancelAuthOrIdentify, int32_t(uint64_t contextId, int32_t cancelReason));
63     MOCK_METHOD1(GetVersion, int32_t(int32_t &version));
64     MOCK_METHOD2(Notice, int32_t(NoticeType noticeType, const std::string &eventData));
65     MOCK_METHOD2(RegisterWidgetCallback, int32_t(int32_t version, sptr<WidgetCallbackInterface> &callback));
66     MOCK_METHOD2(RegistUserAuthSuccessEventListener, int32_t(const std::vector<AuthType> &authType,
67         const sptr<AuthEventListenerInterface> &callback));
68     MOCK_METHOD1(UnRegistUserAuthSuccessEventListener, int32_t(const sptr<AuthEventListenerInterface> &callback));
69     MOCK_METHOD1(SetGlobalConfigParam, int32_t(const GlobalConfigParam &param));
70     MOCK_METHOD2(PrepareRemoteAuth, int32_t(const std::string &networkId, sptr<UserAuthCallbackInterface> &callback));
71     MOCK_METHOD3(VerifyAuthToken, void(const std::vector<uint8_t> &tokenIn, uint64_t allowableDuration,
72         const sptr<VerifyTokenCallbackInterface> &callback));
73 };
74 } // namespace UserAuth
75 } // namespace UserIam
76 } // namespace OHOS
77 #endif // IAM_MOCK_USER_AUTH_SERVICE_H