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_CALLBACK_H 16 #define IAM_MOCK_USER_IDM_CALLBACK_H 17 18 #include <memory> 19 20 #include <gmock/gmock.h> 21 #include <iremote_stub.h> 22 23 #include "iiam_callback.h" 24 #include "iidm_get_cred_info_callback.h" 25 #include "iidm_get_secure_user_info_callback.h" 26 27 namespace OHOS { 28 namespace UserIam { 29 namespace UserAuth { 30 class MockIdmGetCredentialInfoCallback final : public IRemoteStub<IIdmGetCredInfoCallback> { 31 public: 32 MOCK_METHOD2(OnCredentialInfos, int32_t(int32_t result, const std::vector<IpcCredentialInfo> &credInfoList)); 33 MOCK_METHOD4(OnRemoteRequest, 34 int32_t(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)); 35 MOCK_METHOD1(CallbackEnter, int32_t(uint32_t code)); 36 MOCK_METHOD2(CallbackExit, int32_t(uint32_t code, int32_t result)); 37 }; 38 39 class MockIdmGetSecureUserInfoCallback final : public IRemoteStub<IIdmGetSecureUserInfoCallback> { 40 public: 41 MOCK_METHOD2(OnSecureUserInfo, int32_t(int32_t resultCodeCode, const IpcSecUserInfo &secUserInfo)); 42 MOCK_METHOD4(OnRemoteRequest, 43 int32_t(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)); 44 MOCK_METHOD1(CallbackEnter, int32_t(uint32_t code)); 45 MOCK_METHOD2(CallbackExit, int32_t(uint32_t code, int32_t result)); 46 }; 47 48 class MockIdmCallback final : public IRemoteStub<IIamCallback> { 49 public: 50 MOCK_METHOD2(OnResult, int32_t(int32_t resultCode, const std::vector<uint8_t> &extraInfo)); 51 MOCK_METHOD3(OnAcquireInfo, int32_t(int32_t module, int32_t acquire, const std::vector<uint8_t> &extraInfo)); 52 MOCK_METHOD4(OnRemoteRequest, 53 int32_t(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)); 54 MOCK_METHOD1(CallbackEnter, int32_t(uint32_t code)); 55 MOCK_METHOD2(CallbackExit, int32_t(uint32_t code, int32_t result)); 56 }; 57 } // namespace UserAuth 58 } // namespace UserIam 59 } // namespace OHOS 60 #endif // IAM_MOCK_USER_IDM_CALLBACK_H