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 "user_auth_stub.h" 21 22 namespace OHOS { 23 namespace UserIam { 24 namespace UserAuth { 25 class MockUserAuthService final : public UserAuthStub { 26 public: 27 MOCK_METHOD3(GetEnrolledState, int32_t(int32_t apiVersion, AuthType authType, EnrolledState &enrolledState)); 28 29 MOCK_METHOD4(GetAvailableStatus, int32_t(int32_t apiVersion, int32_t userId, AuthType authType, 30 AuthTrustLevel authTrustLevel)); 31 GetAvailableStatus(int32_t apiVersion,AuthType authType,AuthTrustLevel authTrustLevel)32 int32_t GetAvailableStatus(int32_t apiVersion, AuthType authType, AuthTrustLevel authTrustLevel) 33 { 34 return 0; 35 } 36 37 MOCK_METHOD4(GetProperty, 38 void(int32_t userId, AuthType authType, const std::vector<Attributes::AttributeKey> &keys, 39 sptr<GetExecutorPropertyCallbackInterface> &callback)); 40 41 MOCK_METHOD3(GetPropertyById, void(uint64_t credentialId, const std::vector<Attributes::AttributeKey> &keys, 42 sptr<GetExecutorPropertyCallbackInterface> &callback)); 43 44 MOCK_METHOD4(SetProperty, void(int32_t userId, AuthType authType, const Attributes &attributes, 45 sptr<SetExecutorPropertyCallbackInterface> &callback)); 46 47 MOCK_METHOD3(AuthUser, uint64_t(AuthParamInner ¶m, std::optional<RemoteAuthParam> &remoteAuthParam, 48 sptr<UserAuthCallbackInterface> &callback)); 49 50 MOCK_METHOD5(Auth, 51 uint64_t(int32_t apiVersion, const std::vector<uint8_t> &challenge, AuthType authType, 52 AuthTrustLevel authTrustLevel, sptr<UserAuthCallbackInterface> &callback)); 53 54 MOCK_METHOD4(AuthWidget, uint64_t(int32_t apiVersion, const AuthParamInner &authParam, 55 const WidgetParam &widgetParam, sptr<UserAuthCallbackInterface> &callback)); 56 57 MOCK_METHOD3(Identify, 58 uint64_t(const std::vector<uint8_t> &challenge, AuthType authType, sptr<UserAuthCallbackInterface> &callback)); 59 60 MOCK_METHOD1(CancelAuthOrIdentify, int32_t(uint64_t contextId)); 61 MOCK_METHOD1(GetVersion, int32_t(int32_t &version)); 62 MOCK_METHOD2(Notice, int32_t(NoticeType noticeType, const std::string &eventData)); 63 MOCK_METHOD2(RegisterWidgetCallback, int32_t(int32_t version, sptr<WidgetCallbackInterface> &callback)); 64 MOCK_METHOD2(RegistUserAuthSuccessEventListener, int32_t(const std::vector<AuthType> &authType, 65 const sptr<AuthEventListenerInterface> &callback)); 66 MOCK_METHOD1(UnRegistUserAuthSuccessEventListener, int32_t(const sptr<AuthEventListenerInterface> &callback)); 67 MOCK_METHOD1(SetGlobalConfigParam, int32_t(const GlobalConfigParam ¶m)); 68 MOCK_METHOD2(PrepareRemoteAuth, int32_t(const std::string &networkId, sptr<UserAuthCallbackInterface> &callback)); 69 }; 70 } // namespace UserAuth 71 } // namespace UserIam 72 } // namespace OHOS 73 #endif // IAM_MOCK_USER_AUTH_SERVICE_H