19762338dSopenharmony_ci/*
29762338dSopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
39762338dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
49762338dSopenharmony_ci * you may not use this file except in compliance with the License.
59762338dSopenharmony_ci * You may obtain a copy of the License at
69762338dSopenharmony_ci *
79762338dSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
89762338dSopenharmony_ci *
99762338dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
109762338dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
119762338dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129762338dSopenharmony_ci * See the License for the specific language governing permissions and
139762338dSopenharmony_ci * limitations under the License.
149762338dSopenharmony_ci */
159762338dSopenharmony_ci
169762338dSopenharmony_ci#include "fingerprint_auth_hdi_test.h"
179762338dSopenharmony_ci
189762338dSopenharmony_ci#include <hdf_base.h>
199762338dSopenharmony_ci
209762338dSopenharmony_ci#include "iam_hat_test.h"
219762338dSopenharmony_ci
229762338dSopenharmony_ci#define LOG_LABEL OHOS::UserIam::Common::LABEL_FINGERPRINT_AUTH_IMPL
239762338dSopenharmony_ci
249762338dSopenharmony_ciusing namespace std;
259762338dSopenharmony_ciusing namespace testing::ext;
269762338dSopenharmony_ciusing namespace OHOS;
279762338dSopenharmony_ciusing namespace OHOS::UserIam::Common;
289762338dSopenharmony_ciusing namespace OHOS::HDI::FingerprintAuth;
299762338dSopenharmony_ci
309762338dSopenharmony_cistatic AllInOneExecutorImpl g_executorImpl;
319762338dSopenharmony_cistatic OHOS::Parcel parcel;
329762338dSopenharmony_ci
339762338dSopenharmony_civoid UserIamFingerprintAuthTest::SetUpTestCase()
349762338dSopenharmony_ci{
359762338dSopenharmony_ci}
369762338dSopenharmony_ci
379762338dSopenharmony_civoid UserIamFingerprintAuthTest::TearDownTestCase()
389762338dSopenharmony_ci{
399762338dSopenharmony_ci}
409762338dSopenharmony_ci
419762338dSopenharmony_civoid UserIamFingerprintAuthTest::SetUp()
429762338dSopenharmony_ci{
439762338dSopenharmony_ci}
449762338dSopenharmony_ci
459762338dSopenharmony_civoid UserIamFingerprintAuthTest::TearDown()
469762338dSopenharmony_ci{
479762338dSopenharmony_ci}
489762338dSopenharmony_ci
499762338dSopenharmony_ciclass DummyIExecutorCallback : public IExecutorCallback {
509762338dSopenharmony_cipublic:
519762338dSopenharmony_ci    DummyIExecutorCallback(int32_t result, int32_t tip, int32_t message) : result_(result), tip_(tip), message_(message)
529762338dSopenharmony_ci    {
539762338dSopenharmony_ci    }
549762338dSopenharmony_ci
559762338dSopenharmony_ci    int32_t OnResult(int32_t result, const std::vector<uint8_t> &extraInfo) override
569762338dSopenharmony_ci    {
579762338dSopenharmony_ci        cout << "result is " << result << " extraInfo len is " << extraInfo.size() << endl;
589762338dSopenharmony_ci        return result_;
599762338dSopenharmony_ci    }
609762338dSopenharmony_ci
619762338dSopenharmony_ci    int32_t OnTip(int32_t tip, const std::vector<uint8_t> &extraInfo) override
629762338dSopenharmony_ci    {
639762338dSopenharmony_ci        cout << "tip is " << tip << " extraInfo len is " << extraInfo.size() << endl;
649762338dSopenharmony_ci        return tip_;
659762338dSopenharmony_ci    }
669762338dSopenharmony_ci
679762338dSopenharmony_ci    int32_t OnMessage(int32_t destRole, const std::vector<uint8_t> &msg) override
689762338dSopenharmony_ci    {
699762338dSopenharmony_ci        cout << "destRole is " << destRole << " msg len is " << msg.size() << endl;
709762338dSopenharmony_ci        return message_;
719762338dSopenharmony_ci    }
729762338dSopenharmony_ci
739762338dSopenharmony_ciprivate:
749762338dSopenharmony_ci    int32_t result_;
759762338dSopenharmony_ci    int32_t tip_;
769762338dSopenharmony_ci    int32_t message_;
779762338dSopenharmony_ci};
789762338dSopenharmony_ci
799762338dSopenharmony_ciclass DummyISaCommandCallback : public ISaCommandCallback {
809762338dSopenharmony_cipublic:
819762338dSopenharmony_ci    explicit DummyISaCommandCallback(int32_t result) : result_(result)
829762338dSopenharmony_ci    {
839762338dSopenharmony_ci    }
849762338dSopenharmony_ci
859762338dSopenharmony_ci    int32_t OnSaCommands(const std::vector<SaCommand> &commands) override
869762338dSopenharmony_ci    {
879762338dSopenharmony_ci        return result_;
889762338dSopenharmony_ci    }
899762338dSopenharmony_ci
909762338dSopenharmony_ciprivate:
919762338dSopenharmony_ci    int32_t result_;
929762338dSopenharmony_ci};
939762338dSopenharmony_ci
949762338dSopenharmony_cistatic void FillTestExecutorInfo(Parcel &parcel, ExecutorInfo &executorInfo)
959762338dSopenharmony_ci{
969762338dSopenharmony_ci    executorInfo.sensorId = parcel.ReadUint16();
979762338dSopenharmony_ci    executorInfo.executorMatcher = parcel.ReadUint32();
989762338dSopenharmony_ci    executorInfo.executorRole = static_cast<ExecutorRole>(parcel.ReadInt32());
999762338dSopenharmony_ci    executorInfo.authType = static_cast<AuthType>(parcel.ReadInt32());
1009762338dSopenharmony_ci    executorInfo.esl = static_cast<ExecutorSecureLevel>(parcel.ReadInt32());
1019762338dSopenharmony_ci    executorInfo.maxTemplateAcl = parcel.ReadInt32();
1029762338dSopenharmony_ci    FillTestUint8Vector(parcel, executorInfo.publicKey);
1039762338dSopenharmony_ci    FillTestUint8Vector(parcel, executorInfo.extraInfo);
1049762338dSopenharmony_ci    cout << "success" << endl;
1059762338dSopenharmony_ci}
1069762338dSopenharmony_ci
1079762338dSopenharmony_cistatic void FillTestIExecutorCallback(Parcel &parcel, sptr<IExecutorCallback> &callbackObj)
1089762338dSopenharmony_ci{
1099762338dSopenharmony_ci    bool isNull = parcel.ReadBool();
1109762338dSopenharmony_ci    if (isNull) {
1119762338dSopenharmony_ci        callbackObj = nullptr;
1129762338dSopenharmony_ci    } else {
1139762338dSopenharmony_ci        callbackObj =
1149762338dSopenharmony_ci            new (std::nothrow) DummyIExecutorCallback(parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadInt32());
1159762338dSopenharmony_ci        if (callbackObj == nullptr) {
1169762338dSopenharmony_ci            cout << "callbackObj construct fail" << endl;
1179762338dSopenharmony_ci        }
1189762338dSopenharmony_ci    }
1199762338dSopenharmony_ci    cout << "success" << endl;
1209762338dSopenharmony_ci}
1219762338dSopenharmony_ci
1229762338dSopenharmony_civoid FillTestGetPropertyTypeVector(Parcel &parcel, std::vector<GetPropertyType> &types)
1239762338dSopenharmony_ci{
1249762338dSopenharmony_ci    std::vector<uint32_t> propertyTypeUint32;
1259762338dSopenharmony_ci    FillTestUint32Vector(parcel, propertyTypeUint32);
1269762338dSopenharmony_ci    for (const auto &val : propertyTypeUint32) {
1279762338dSopenharmony_ci        types.push_back(static_cast<GetPropertyType>(val));
1289762338dSopenharmony_ci    }
1299762338dSopenharmony_ci
1309762338dSopenharmony_ci    cout << "success" << endl;
1319762338dSopenharmony_ci}
1329762338dSopenharmony_ci
1339762338dSopenharmony_civoid FillTestProperty(Parcel &parcel, Property &property)
1349762338dSopenharmony_ci{
1359762338dSopenharmony_ci    property.authSubType = parcel.ReadUint64();
1369762338dSopenharmony_ci    property.lockoutDuration = parcel.ReadInt32();
1379762338dSopenharmony_ci    property.remainAttempts = parcel.ReadInt32();
1389762338dSopenharmony_ci    FillTestString(parcel, property.enrollmentProgress);
1399762338dSopenharmony_ci    FillTestString(parcel, property.sensorInfo);
1409762338dSopenharmony_ci
1419762338dSopenharmony_ci    cout << "success" << endl;
1429762338dSopenharmony_ci}
1439762338dSopenharmony_ci
1449762338dSopenharmony_civoid FillTestISaCommandCallback(Parcel &parcel, sptr<ISaCommandCallback> &callbackObj)
1459762338dSopenharmony_ci{
1469762338dSopenharmony_ci    bool isNull = parcel.ReadBool();
1479762338dSopenharmony_ci    if (isNull) {
1489762338dSopenharmony_ci        callbackObj = nullptr;
1499762338dSopenharmony_ci    } else {
1509762338dSopenharmony_ci        callbackObj = new (std::nothrow) DummyISaCommandCallback(parcel.ReadInt32());
1519762338dSopenharmony_ci        if (callbackObj == nullptr) {
1529762338dSopenharmony_ci            cout << "callbackObj construct fail" << endl;
1539762338dSopenharmony_ci        }
1549762338dSopenharmony_ci    }
1559762338dSopenharmony_ci    cout << "success" << endl;
1569762338dSopenharmony_ci}
1579762338dSopenharmony_ci
1589762338dSopenharmony_ci/**
1599762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_FUNC_0101
1609762338dSopenharmony_ci * @tc.name: Test SendCommand
1619762338dSopenharmony_ci * @tc.size: MediumTest
1629762338dSopenharmony_ci * @tc.type: Function
1639762338dSopenharmony_ci * @tc.level: Level1
1649762338dSopenharmony_ci */
1659762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_FUNC_0101, Function | MediumTest | Level1)
1669762338dSopenharmony_ci{
1679762338dSopenharmony_ci    cout << "start test SendCommand" << endl;
1689762338dSopenharmony_ci    uint8_t commandId = parcel.ReadUint8();
1699762338dSopenharmony_ci    cout << "commandId is " << commandId << endl;
1709762338dSopenharmony_ci    std::vector<uint8_t> extraInfo;
1719762338dSopenharmony_ci    FillTestUint8Vector(parcel, extraInfo);
1729762338dSopenharmony_ci    sptr<IExecutorCallback> callbackObj;
1739762338dSopenharmony_ci    FillTestIExecutorCallback(parcel, callbackObj);
1749762338dSopenharmony_ci    int32_t ret = g_executorImpl.SendCommand(commandId, extraInfo, callbackObj);
1759762338dSopenharmony_ci    cout << "ret is " << ret << endl;
1769762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
1779762338dSopenharmony_ci}
1789762338dSopenharmony_ci
1799762338dSopenharmony_ci/**
1809762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_FUNC_0102
1819762338dSopenharmony_ci * @tc.name: Test Cancel
1829762338dSopenharmony_ci * @tc.size: MediumTest
1839762338dSopenharmony_ci * @tc.type: Function
1849762338dSopenharmony_ci * @tc.level: Level1
1859762338dSopenharmony_ci */
1869762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_FUNC_0102, Function | MediumTest | Level1)
1879762338dSopenharmony_ci{
1889762338dSopenharmony_ci    cout << "start test Cancel" << endl;
1899762338dSopenharmony_ci    uint64_t scheduleId = parcel.ReadUint64();
1909762338dSopenharmony_ci    int32_t ret = g_executorImpl.Cancel(scheduleId);
1919762338dSopenharmony_ci    cout << "ret is " << ret << endl;
1929762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
1939762338dSopenharmony_ci}
1949762338dSopenharmony_ci
1959762338dSopenharmony_ci/**
1969762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_FUNC_0103
1979762338dSopenharmony_ci * @tc.name: Test Delete
1989762338dSopenharmony_ci * @tc.size: MediumTest
1999762338dSopenharmony_ci * @tc.type: Function
2009762338dSopenharmony_ci * @tc.level: Level1
2019762338dSopenharmony_ci */
2029762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_FUNC_0103, Function | MediumTest | Level1)
2039762338dSopenharmony_ci{
2049762338dSopenharmony_ci    cout << "start test Delete" << endl;
2059762338dSopenharmony_ci    std::vector<uint64_t> templateIdList;
2069762338dSopenharmony_ci    FillTestUint64Vector(parcel, templateIdList);
2079762338dSopenharmony_ci    int32_t ret = g_executorImpl.Delete(templateIdList);
2089762338dSopenharmony_ci    cout << "ret is " << ret << endl;
2099762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
2109762338dSopenharmony_ci}
2119762338dSopenharmony_ci
2129762338dSopenharmony_ci/**
2139762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_FUNC_0104
2149762338dSopenharmony_ci * @tc.name: Test GetExecutorInfo
2159762338dSopenharmony_ci * @tc.size: MediumTest
2169762338dSopenharmony_ci * @tc.type: Function
2179762338dSopenharmony_ci * @tc.level: Level1
2189762338dSopenharmony_ci */
2199762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_FUNC_0104, Function | MediumTest | Level1)
2209762338dSopenharmony_ci{
2219762338dSopenharmony_ci    cout << "start test GetExecutorInfo" << endl;
2229762338dSopenharmony_ci    ExecutorInfo executorInfo;
2239762338dSopenharmony_ci    FillTestExecutorInfo(parcel, executorInfo);
2249762338dSopenharmony_ci    int32_t ret = g_executorImpl.GetExecutorInfo(executorInfo);
2259762338dSopenharmony_ci    cout << "ret is " << ret << endl;
2269762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
2279762338dSopenharmony_ci}
2289762338dSopenharmony_ci
2299762338dSopenharmony_ci/**
2309762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_FUNC_0106
2319762338dSopenharmony_ci * @tc.name: Test OnRegisterFinish
2329762338dSopenharmony_ci * @tc.size: MediumTest
2339762338dSopenharmony_ci * @tc.type: Function
2349762338dSopenharmony_ci * @tc.level: Level1
2359762338dSopenharmony_ci */
2369762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_FUNC_0106, Function | MediumTest | Level1)
2379762338dSopenharmony_ci{
2389762338dSopenharmony_ci    cout << "start test OnRegisterFinish" << endl;
2399762338dSopenharmony_ci    std::vector<uint64_t> templateIdList;
2409762338dSopenharmony_ci    FillTestUint64Vector(parcel, templateIdList);
2419762338dSopenharmony_ci    std::vector<uint8_t> frameworkPublicKey;
2429762338dSopenharmony_ci    FillTestUint8Vector(parcel, frameworkPublicKey);
2439762338dSopenharmony_ci    std::vector<uint8_t> extraInfo;
2449762338dSopenharmony_ci    FillTestUint8Vector(parcel, extraInfo);
2459762338dSopenharmony_ci    int32_t ret = g_executorImpl.OnRegisterFinish(templateIdList, frameworkPublicKey, extraInfo);
2469762338dSopenharmony_ci    cout << "ret is " << ret << endl;
2479762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
2489762338dSopenharmony_ci}
2499762338dSopenharmony_ci
2509762338dSopenharmony_ci/**
2519762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_FUNC_0107
2529762338dSopenharmony_ci * @tc.name: Test Enroll
2539762338dSopenharmony_ci * @tc.size: MediumTest
2549762338dSopenharmony_ci * @tc.type: Function
2559762338dSopenharmony_ci * @tc.level: Level1
2569762338dSopenharmony_ci */
2579762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_FUNC_0107, Function | MediumTest | Level1)
2589762338dSopenharmony_ci{
2599762338dSopenharmony_ci    cout << "start test Enroll" << endl;
2609762338dSopenharmony_ci    uint64_t scheduleId = parcel.ReadUint64();
2619762338dSopenharmony_ci    std::vector<uint8_t> extraInfo;
2629762338dSopenharmony_ci    FillTestUint8Vector(parcel, extraInfo);
2639762338dSopenharmony_ci    sptr<IExecutorCallback> callbackObj;
2649762338dSopenharmony_ci    FillTestIExecutorCallback(parcel, callbackObj);
2659762338dSopenharmony_ci    int32_t ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj);
2669762338dSopenharmony_ci    cout << "ret is " << ret << endl;
2679762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
2689762338dSopenharmony_ci}
2699762338dSopenharmony_ci
2709762338dSopenharmony_ci/**
2719762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_FUNC_0109
2729762338dSopenharmony_ci * @tc.name: Test Identify
2739762338dSopenharmony_ci * @tc.size: MediumTest
2749762338dSopenharmony_ci * @tc.type: Function
2759762338dSopenharmony_ci * @tc.level: Level1
2769762338dSopenharmony_ci */
2779762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_FUNC_0109, Function | MediumTest | Level1)
2789762338dSopenharmony_ci{
2799762338dSopenharmony_ci    cout << "start test Identify" << endl;
2809762338dSopenharmony_ci    uint64_t scheduleId = parcel.ReadUint64();
2819762338dSopenharmony_ci    std::vector<uint8_t> extraInfo;
2829762338dSopenharmony_ci    FillTestUint8Vector(parcel, extraInfo);
2839762338dSopenharmony_ci    sptr<IExecutorCallback> callbackObj;
2849762338dSopenharmony_ci    FillTestIExecutorCallback(parcel, callbackObj);
2859762338dSopenharmony_ci    int32_t ret = g_executorImpl.Identify(scheduleId, extraInfo, callbackObj);
2869762338dSopenharmony_ci    cout << "ret is " << ret << endl;
2879762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
2889762338dSopenharmony_ci}
2899762338dSopenharmony_ci
2909762338dSopenharmony_ci/**
2919762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_FUNC_0110
2929762338dSopenharmony_ci * @tc.name: Test GetExecutorList
2939762338dSopenharmony_ci * @tc.size: MediumTest
2949762338dSopenharmony_ci * @tc.type: Function
2959762338dSopenharmony_ci * @tc.level: Level1
2969762338dSopenharmony_ci */
2979762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_FUNC_0110, Function | MediumTest | Level1)
2989762338dSopenharmony_ci{
2999762338dSopenharmony_ci    cout << "start test GetExecutorList" << endl;
3009762338dSopenharmony_ci    FingerprintAuthInterfaceService fingerprint_Interface;
3019762338dSopenharmony_ci    std::vector<sptr<IAllInOneExecutor>> executorList;
3029762338dSopenharmony_ci    int32_t ret = fingerprint_Interface.GetExecutorList(executorList);
3039762338dSopenharmony_ci    cout << "ret is " << ret << endl;
3049762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
3059762338dSopenharmony_ci}
3069762338dSopenharmony_ci
3079762338dSopenharmony_ci/**
3089762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_NEW_FUNC_0101
3099762338dSopenharmony_ci * @tc.name: Test GetProperty
3109762338dSopenharmony_ci * @tc.size: MediumTest
3119762338dSopenharmony_ci * @tc.type: Function
3129762338dSopenharmony_ci * @tc.level: Level1
3139762338dSopenharmony_ci */
3149762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_NEW_FUNC_0101, Function | MediumTest | Level1)
3159762338dSopenharmony_ci{
3169762338dSopenharmony_ci    cout << "start test GetProperty" << endl;
3179762338dSopenharmony_ci    std::vector<uint64_t> templateIdList;
3189762338dSopenharmony_ci    FillTestUint64Vector(parcel, templateIdList);
3199762338dSopenharmony_ci    std::vector<int32_t> propertyTypes;
3209762338dSopenharmony_ci    FillTestInt32Vector(parcel, propertyTypes);
3219762338dSopenharmony_ci    Property property;
3229762338dSopenharmony_ci    FillTestProperty(parcel, property);
3239762338dSopenharmony_ci
3249762338dSopenharmony_ci    int32_t ret = g_executorImpl.GetProperty(templateIdList, propertyTypes, property);
3259762338dSopenharmony_ci    cout << "ret is " << ret << endl;
3269762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
3279762338dSopenharmony_ci}
3289762338dSopenharmony_ci
3299762338dSopenharmony_ci/**
3309762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_NEW_FUNC_0102
3319762338dSopenharmony_ci * @tc.name: Test SetCachedTemplates
3329762338dSopenharmony_ci * @tc.size: MediumTest
3339762338dSopenharmony_ci * @tc.type: Function
3349762338dSopenharmony_ci * @tc.level: Level1
3359762338dSopenharmony_ci */
3369762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_NEW_FUNC_0102, Function | MediumTest | Level1)
3379762338dSopenharmony_ci{
3389762338dSopenharmony_ci    cout << "start test SetCachedTemplates" << endl;
3399762338dSopenharmony_ci    std::vector<uint64_t> templateIdList;
3409762338dSopenharmony_ci    FillTestUint64Vector(parcel, templateIdList);
3419762338dSopenharmony_ci
3429762338dSopenharmony_ci    int32_t ret = g_executorImpl.SetCachedTemplates(templateIdList);
3439762338dSopenharmony_ci
3449762338dSopenharmony_ci    cout << "ret is " << ret << endl;
3459762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
3469762338dSopenharmony_ci}
3479762338dSopenharmony_ci
3489762338dSopenharmony_ci/**
3499762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_NEW_FUNC_0103
3509762338dSopenharmony_ci * @tc.name: Test RegisterSaCommandCallback
3519762338dSopenharmony_ci * @tc.size: MediumTest
3529762338dSopenharmony_ci * @tc.type: Function
3539762338dSopenharmony_ci * @tc.level: Level1
3549762338dSopenharmony_ci */
3559762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_NEW_FUNC_0103, Function | MediumTest | Level1)
3569762338dSopenharmony_ci{
3579762338dSopenharmony_ci    cout << "start test RegisterSaCommandCallback" << endl;
3589762338dSopenharmony_ci    sptr<ISaCommandCallback> callbackObj = nullptr;
3599762338dSopenharmony_ci    FillTestISaCommandCallback(parcel, callbackObj);
3609762338dSopenharmony_ci
3619762338dSopenharmony_ci    int32_t ret = g_executorImpl.RegisterSaCommandCallback(callbackObj);
3629762338dSopenharmony_ci
3639762338dSopenharmony_ci    cout << "ret is " << ret << endl;
3649762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
3659762338dSopenharmony_ci}
3669762338dSopenharmony_ci
3679762338dSopenharmony_ci/**
3689762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_NEW_FUNC_0104
3699762338dSopenharmony_ci * @tc.name: Test GetExecutorList
3709762338dSopenharmony_ci * @tc.size: MediumTest
3719762338dSopenharmony_ci * @tc.type: Function
3729762338dSopenharmony_ci * @tc.level: Level1
3739762338dSopenharmony_ci */
3749762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_NEW_FUNC_0104, Function | MediumTest | Level1)
3759762338dSopenharmony_ci{
3769762338dSopenharmony_ci    cout << "start test GetExecutorList" << endl;
3779762338dSopenharmony_ci    std::vector<sptr<IAllInOneExecutor>> executorList;
3789762338dSopenharmony_ci    FingerprintAuthInterfaceService fingerprint_Interface;
3799762338dSopenharmony_ci
3809762338dSopenharmony_ci    int32_t ret = fingerprint_Interface.GetExecutorList(executorList);
3819762338dSopenharmony_ci
3829762338dSopenharmony_ci    cout << "ret is " << ret << endl;
3839762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
3849762338dSopenharmony_ci}
3859762338dSopenharmony_ci
3869762338dSopenharmony_ci/**
3879762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_NEW_FUNC_0105
3889762338dSopenharmony_ci * @tc.name: Test GetExecutorList
3899762338dSopenharmony_ci * @tc.size: MediumTest
3909762338dSopenharmony_ci * @tc.type: Function
3919762338dSopenharmony_ci * @tc.level: Level1
3929762338dSopenharmony_ci */
3939762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_NEW_FUNC_0105, Function | MediumTest | Level1)
3949762338dSopenharmony_ci{
3959762338dSopenharmony_ci    cout << "start test GetExecutorList" << endl;
3969762338dSopenharmony_ci    uint64_t scheduleId = parcel.ReadUint64();
3979762338dSopenharmony_ci    std::vector<uint64_t> templateIdList;
3989762338dSopenharmony_ci    FillTestUint64Vector(parcel, templateIdList);
3999762338dSopenharmony_ci    std::vector<uint8_t> extraInfo;
4009762338dSopenharmony_ci    FillTestUint8Vector(parcel, extraInfo);
4019762338dSopenharmony_ci    sptr<IExecutorCallback> callbackObj;
4029762338dSopenharmony_ci    FillTestIExecutorCallback(parcel, callbackObj);
4039762338dSopenharmony_ci    int32_t ret = g_executorImpl.Authenticate(scheduleId, templateIdList, true, extraInfo, callbackObj);
4049762338dSopenharmony_ci
4059762338dSopenharmony_ci    cout << "ret is " << ret << endl;
4069762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
4079762338dSopenharmony_ci}
4089762338dSopenharmony_ci
4099762338dSopenharmony_ci/**
4109762338dSopenharmony_ci * @tc.number: Security_IAM_Fingerprint_HDI_NEW_FUNC_0106
4119762338dSopenharmony_ci * @tc.name: Test Send Message
4129762338dSopenharmony_ci * @tc.size: MediumTest
4139762338dSopenharmony_ci * @tc.type: Function
4149762338dSopenharmony_ci * @tc.level: Level1
4159762338dSopenharmony_ci */
4169762338dSopenharmony_ciHWTEST_F(UserIamFingerprintAuthTest, Security_IAM_Fingerprint_HDI_NEW_FUNC_0106, Function | MediumTest | Level1)
4179762338dSopenharmony_ci{
4189762338dSopenharmony_ci    cout << "start test RegisterSaCommandCallback" << endl;
4199762338dSopenharmony_ci    sptr<ISaCommandCallback> callbackObj = nullptr;
4209762338dSopenharmony_ci    FillTestISaCommandCallback(parcel, callbackObj);
4219762338dSopenharmony_ci
4229762338dSopenharmony_ci    uint64_t scheduleId = parcel.ReadUint64();
4239762338dSopenharmony_ci    int32_t srcRole = parcel.ReadInt32();
4249762338dSopenharmony_ci    std::vector<uint8_t> msg;
4259762338dSopenharmony_ci    FillTestUint8Vector(parcel, msg);
4269762338dSopenharmony_ci
4279762338dSopenharmony_ci    int32_t ret = g_executorImpl.SendMessage(scheduleId, srcRole, msg);
4289762338dSopenharmony_ci
4299762338dSopenharmony_ci    cout << "ret is " << ret << endl;
4309762338dSopenharmony_ci    EXPECT_EQ(ret, 0);
4319762338dSopenharmony_ci}