19762338dSopenharmony_ci/* 29762338dSopenharmony_ci * Copyright (c) 2023-2024 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 "pin_auth_hdi_test.h" 179762338dSopenharmony_ci#include "iam_hat_test.h" 189762338dSopenharmony_ci 199762338dSopenharmony_ciusing namespace std; 209762338dSopenharmony_ciusing namespace testing::ext; 219762338dSopenharmony_ciusing namespace OHOS::UserIam::Common; 229762338dSopenharmony_ciusing namespace OHOS::HDI::PinAuth; 239762338dSopenharmony_ciusing namespace OHOS::HDI::PinAuth::V2_0; 249762338dSopenharmony_ciusing Property = OHOS::HDI::PinAuth::V2_0::Property; 259762338dSopenharmony_ci 269762338dSopenharmony_cistatic AllInOneImpl g_executorImpl(make_shared<OHOS::UserIam::PinAuth::PinAuth>()); 279762338dSopenharmony_cistatic OHOS::Parcel parcel; 289762338dSopenharmony_ciint32_t Expectedvalue = 0; 299762338dSopenharmony_cibool g_onResultFlag = false; 309762338dSopenharmony_cibool g_onGetDataFlag = false; 319762338dSopenharmony_cibool g_onGetDataV11Flag = false; 329762338dSopenharmony_ci 339762338dSopenharmony_civoid UserIamPinAuthTestAdditional::SetUpTestCase() {} 349762338dSopenharmony_ci 359762338dSopenharmony_civoid UserIamPinAuthTestAdditional::TearDownTestCase() {} 369762338dSopenharmony_ci 379762338dSopenharmony_civoid UserIamPinAuthTestAdditional::SetUp() {} 389762338dSopenharmony_ci 399762338dSopenharmony_civoid UserIamPinAuthTestAdditional::TearDown() {} 409762338dSopenharmony_ci 419762338dSopenharmony_ciclass DummyIExecutorCallback : public IExecutorCallback { 429762338dSopenharmony_cipublic: 439762338dSopenharmony_ci DummyIExecutorCallback(int32_t onResultResult, int32_t onGetDataResult, int32_t onGetDataV1Result, 449762338dSopenharmony_ci int32_t onTipResult, int32_t onMessageResult) 459762338dSopenharmony_ci : onResultResult_(onResultResult), onGetDataResult_(onGetDataResult), onTipResult_(onTipResult), 469762338dSopenharmony_ci onMessageResult_(onMessageResult) 479762338dSopenharmony_ci { 489762338dSopenharmony_ci } 499762338dSopenharmony_ci 509762338dSopenharmony_ci int32_t OnResult(int32_t result, const std::vector<uint8_t> &extraInfo) override 519762338dSopenharmony_ci { 529762338dSopenharmony_ci cout << "result is " << result << " extraInfo len is " << extraInfo.size() << endl; 539762338dSopenharmony_ci g_onResultFlag = true; 549762338dSopenharmony_ci return onResultResult_; 559762338dSopenharmony_ci } 569762338dSopenharmony_ci 579762338dSopenharmony_ci int32_t OnGetData(const std::vector<uint8_t>& algoParameter, uint64_t authSubType, uint32_t algoVersion, 589762338dSopenharmony_ci const std::vector<uint8_t>& challenge, const std::string &complexityReg) override 599762338dSopenharmony_ci { 609762338dSopenharmony_ci cout << "algoVersion is " << algoVersion << endl; 619762338dSopenharmony_ci cout << " algoParameter len is " << algoParameter.size() << endl; 629762338dSopenharmony_ci cout << " authSubType is " << authSubType << endl; 639762338dSopenharmony_ci return onGetDataResult_; 649762338dSopenharmony_ci } 659762338dSopenharmony_ci 669762338dSopenharmony_ci int32_t OnTip(int32_t tip, const std::vector<uint8_t>& extraInfo) override 679762338dSopenharmony_ci { 689762338dSopenharmony_ci return onTipResult_; 699762338dSopenharmony_ci } 709762338dSopenharmony_ci 719762338dSopenharmony_ci int32_t OnMessage(int32_t destRole, const std::vector<uint8_t>& msg) override 729762338dSopenharmony_ci { 739762338dSopenharmony_ci return onMessageResult_; 749762338dSopenharmony_ci } 759762338dSopenharmony_ci 769762338dSopenharmony_ciprivate: 779762338dSopenharmony_ci int32_t onResultResult_; 789762338dSopenharmony_ci int32_t onGetDataResult_; 799762338dSopenharmony_ci int32_t onTipResult_; 809762338dSopenharmony_ci int32_t onMessageResult_; 819762338dSopenharmony_ci}; 829762338dSopenharmony_ci 839762338dSopenharmony_cistatic void FillTestIExecutorCallback(Parcel &parcel, sptr<IExecutorCallback> &callbackObj) 849762338dSopenharmony_ci{ 859762338dSopenharmony_ci bool isNull = parcel.ReadBool(); 869762338dSopenharmony_ci if (isNull) { 879762338dSopenharmony_ci callbackObj = nullptr; 889762338dSopenharmony_ci } else { 899762338dSopenharmony_ci callbackObj = 909762338dSopenharmony_ci new (std::nothrow) DummyIExecutorCallback(parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadInt32(), 919762338dSopenharmony_ci parcel.ReadInt32(), parcel.ReadInt32()); 929762338dSopenharmony_ci if (callbackObj == nullptr) { 939762338dSopenharmony_ci cout << "callbackObj construct fail" << endl; 949762338dSopenharmony_ci } 959762338dSopenharmony_ci } 969762338dSopenharmony_ci} 979762338dSopenharmony_ci 989762338dSopenharmony_civoid FillTestGetPropertyTypeVector(Parcel &parcel, std::vector<HdiGetPropertyType> &types) 999762338dSopenharmony_ci{ 1009762338dSopenharmony_ci std::vector<uint32_t> propertyTypeUint32; 1019762338dSopenharmony_ci FillTestUint32Vector(parcel, propertyTypeUint32); 1029762338dSopenharmony_ci for (const auto &val : propertyTypeUint32) { 1039762338dSopenharmony_ci types.push_back(static_cast<HdiGetPropertyType>(val)); 1049762338dSopenharmony_ci } 1059762338dSopenharmony_ci 1069762338dSopenharmony_ci cout << "success" << endl; 1079762338dSopenharmony_ci} 1089762338dSopenharmony_ci/** 1099762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_GetExecutorInfo_0200 1109762338dSopenharmony_ci * @tc.name testPinAuthTestGetExecutorInfo001 1119762338dSopenharmony_ci * @tc.desc test GetExecutorInfo executorInfo not empty 1129762338dSopenharmony_ci */ 1139762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestGetExecutorInfo001, Function | MediumTest | Level2) 1149762338dSopenharmony_ci{ 1159762338dSopenharmony_ci cout << "start test testPinAuthTestGetExecutorInfo001" << endl; 1169762338dSopenharmony_ci ExecutorInfo executorInfo; 1179762338dSopenharmony_ci int32_t ret = g_executorImpl.GetExecutorInfo(executorInfo); 1189762338dSopenharmony_ci cout << "ret is" << ret << endl; 1199762338dSopenharmony_ci EXPECT_NE(ret, 0); 1209762338dSopenharmony_ci} 1219762338dSopenharmony_ci/** 1229762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_GetExecutorInfo_0300 1239762338dSopenharmony_ci * @tc.name testPinAuthTestGetExecutorInfo002 1249762338dSopenharmony_ci * @tc.desc test GetExecutorInfo 1000 times 1259762338dSopenharmony_ci */ 1269762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestGetExecutorInfo002, Function | MediumTest | Level2) 1279762338dSopenharmony_ci{ 1289762338dSopenharmony_ci cout << "start test testPinAuthTestGetExecutorInfo002" << endl; 1299762338dSopenharmony_ci ExecutorInfo executorInfo; 1309762338dSopenharmony_ci int32_t ret = 0; 1319762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 1329762338dSopenharmony_ci ret = g_executorImpl.GetExecutorInfo(executorInfo); 1339762338dSopenharmony_ci cout << "ret" << i << "is" << ret << endl; 1349762338dSopenharmony_ci EXPECT_NE(ret, 0); 1359762338dSopenharmony_ci } 1369762338dSopenharmony_ci} 1379762338dSopenharmony_ci 1389762338dSopenharmony_ci/** 1399762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_OnRegisterFinish_0200 1409762338dSopenharmony_ci * @tc.name testPinAuthTestOnRegisterFinish001 1419762338dSopenharmony_ci * @tc.desc test OnRegisterFinish empty 1429762338dSopenharmony_ci */ 1439762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestOnRegisterFinish001, Function | MediumTest | Level1) 1449762338dSopenharmony_ci{ 1459762338dSopenharmony_ci cout << "start test testPinAuthTestOnRegisterFinish001" << endl; 1469762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 1479762338dSopenharmony_ci std::vector<uint8_t> frameworkPublicKey(32); 1489762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 1499762338dSopenharmony_ci int32_t ret = g_executorImpl.OnRegisterFinish(templateIdList, frameworkPublicKey, extraInfo); 1509762338dSopenharmony_ci cout << "ret is" << ret << endl; 1519762338dSopenharmony_ci EXPECT_EQ(ret, 0); 1529762338dSopenharmony_ci FillTestUint64Vector(parcel, templateIdList); 1539762338dSopenharmony_ci ret = g_executorImpl.OnRegisterFinish(templateIdList, frameworkPublicKey, extraInfo); 1549762338dSopenharmony_ci cout << "ret is " << ret << endl; 1559762338dSopenharmony_ci EXPECT_EQ(ret, 0); 1569762338dSopenharmony_ci FillTestUint8Vector(parcel, frameworkPublicKey); 1579762338dSopenharmony_ci frameworkPublicKey.resize(32); 1589762338dSopenharmony_ci ret = g_executorImpl.OnRegisterFinish(templateIdList, frameworkPublicKey, extraInfo); 1599762338dSopenharmony_ci cout << "ret is " << ret << endl; 1609762338dSopenharmony_ci EXPECT_EQ(ret, 0); 1619762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 1629762338dSopenharmony_ci frameworkPublicKey.resize(32); 1639762338dSopenharmony_ci ret = g_executorImpl.OnRegisterFinish(templateIdList, frameworkPublicKey, extraInfo); 1649762338dSopenharmony_ci cout << "ret is " << ret << endl; 1659762338dSopenharmony_ci EXPECT_EQ(ret, 0); 1669762338dSopenharmony_ci} 1679762338dSopenharmony_ci/** 1689762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_OnRegisterFinish_0900 1699762338dSopenharmony_ci * @tc.name testPinAuthTestOnRegisterFinish008 1709762338dSopenharmony_ci * @tc.desc test OnRegisterFinish 1000 times 1719762338dSopenharmony_ci */ 1729762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestOnRegisterFinish008, Function | MediumTest | Level1) 1739762338dSopenharmony_ci{ 1749762338dSopenharmony_ci cout << "start test testPinAuthTestOnRegisterFinish008" << endl; 1759762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 1769762338dSopenharmony_ci FillTestUint64Vector(parcel, templateIdList); 1779762338dSopenharmony_ci std::vector<uint8_t> frameworkPublicKey; 1789762338dSopenharmony_ci FillTestUint8Vector(parcel, frameworkPublicKey); 1799762338dSopenharmony_ci frameworkPublicKey.resize(32); 1809762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 1819762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 1829762338dSopenharmony_ci int32_t ret = 0; 1839762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 1849762338dSopenharmony_ci ret = g_executorImpl.OnRegisterFinish(templateIdList, frameworkPublicKey, extraInfo); 1859762338dSopenharmony_ci cout << "ret" << i << "is" << ret << endl; 1869762338dSopenharmony_ci EXPECT_EQ(ret, 0); 1879762338dSopenharmony_ci } 1889762338dSopenharmony_ci} 1899762338dSopenharmony_ci/** 1909762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_OnSetData_0200 1919762338dSopenharmony_ci * @tc.name testPinAuthTestOnSetData001 1929762338dSopenharmony_ci * @tc.desc test OnSetData scheduleId 1939762338dSopenharmony_ci */ 1949762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestOnSetData001, Function | MediumTest | Level2) 1959762338dSopenharmony_ci{ 1969762338dSopenharmony_ci cout << "start SetData" << endl; 1979762338dSopenharmony_ci uint64_t scheduleId = 0; 1989762338dSopenharmony_ci uint64_t authSubType = parcel.ReadUint64(); 1999762338dSopenharmony_ci std::vector<uint8_t> data; 2009762338dSopenharmony_ci FillTestUint8Vector(parcel, data); 2019762338dSopenharmony_ci int32_t resultCode = 0; 2029762338dSopenharmony_ci int32_t ret = g_executorImpl.SetData(scheduleId, authSubType, data, resultCode); 2039762338dSopenharmony_ci cout << "ret is" << ret << endl; 2049762338dSopenharmony_ci EXPECT_NE(ret, 0); 2059762338dSopenharmony_ci scheduleId = 0x7FFFFFFFFFFFFFFF; 2069762338dSopenharmony_ci ret = g_executorImpl.SetData(scheduleId, authSubType, data, resultCode); 2079762338dSopenharmony_ci cout << "ret is" << ret << endl; 2089762338dSopenharmony_ci EXPECT_NE(ret, 0); 2099762338dSopenharmony_ci scheduleId = 0xFFFFFFFFFFFFFFFF; 2109762338dSopenharmony_ci 2119762338dSopenharmony_ci ret = g_executorImpl.SetData(scheduleId, authSubType, data, resultCode); 2129762338dSopenharmony_ci cout << "ret is" << ret << endl; 2139762338dSopenharmony_ci EXPECT_NE(ret, 0); 2149762338dSopenharmony_ci} 2159762338dSopenharmony_ci/** 2169762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_OnSetData_0500 2179762338dSopenharmony_ci * @tc.name testPinAuthTestOnSetData004 2189762338dSopenharmony_ci * @tc.desc test OnSetData authSubType 2199762338dSopenharmony_ci */ 2209762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestOnSetData004, Function | MediumTest | Level2) 2219762338dSopenharmony_ci{ 2229762338dSopenharmony_ci cout << "start SetData" << endl; 2239762338dSopenharmony_ci uint64_t scheduleId = parcel.ReadUint64(); 2249762338dSopenharmony_ci uint64_t authSubType = 0; 2259762338dSopenharmony_ci std::vector<uint8_t> data; 2269762338dSopenharmony_ci FillTestUint8Vector(parcel, data); 2279762338dSopenharmony_ci int32_t resultCode = 0; 2289762338dSopenharmony_ci int32_t ret = g_executorImpl.SetData(scheduleId, authSubType, data, resultCode); 2299762338dSopenharmony_ci cout << "ret is" << ret << endl; 2309762338dSopenharmony_ci EXPECT_NE(ret, 0); 2319762338dSopenharmony_ci authSubType = 0x7FFFFFFFFFFFFFFF; 2329762338dSopenharmony_ci ret = g_executorImpl.SetData(scheduleId, authSubType, data, resultCode); 2339762338dSopenharmony_ci cout << "ret is" << ret << endl; 2349762338dSopenharmony_ci EXPECT_NE(ret, 0); 2359762338dSopenharmony_ci authSubType = 0xFFFFFFFFFFFFFFFF; 2369762338dSopenharmony_ci ret = g_executorImpl.SetData(scheduleId, authSubType, data, resultCode); 2379762338dSopenharmony_ci cout << "ret is" << ret << endl; 2389762338dSopenharmony_ci EXPECT_NE(ret, 0); 2399762338dSopenharmony_ci} 2409762338dSopenharmony_ci/** 2419762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_OnSetData_0800 2429762338dSopenharmony_ci * @tc.name testPinAuthTestOnSetData007 2439762338dSopenharmony_ci * @tc.desc test OnSetData data 2449762338dSopenharmony_ci */ 2459762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestOnSetData007, Function | MediumTest | Level2) 2469762338dSopenharmony_ci{ 2479762338dSopenharmony_ci cout << "start SetData" << endl; 2489762338dSopenharmony_ci uint64_t scheduleId = parcel.ReadUint64(); 2499762338dSopenharmony_ci uint64_t authSubType = parcel.ReadUint64(); 2509762338dSopenharmony_ci std::vector<uint8_t> data; 2519762338dSopenharmony_ci int32_t resultCode = 0; 2529762338dSopenharmony_ci int32_t ret = g_executorImpl.SetData(scheduleId, authSubType, data, resultCode); 2539762338dSopenharmony_ci cout << "ret is" << ret << endl; 2549762338dSopenharmony_ci EXPECT_NE(ret, 0); 2559762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 2569762338dSopenharmony_ci data.push_back(i); 2579762338dSopenharmony_ci } 2589762338dSopenharmony_ci ret = g_executorImpl.SetData(scheduleId, authSubType, data, resultCode); 2599762338dSopenharmony_ci cout << "ret is" << ret << endl; 2609762338dSopenharmony_ci EXPECT_NE(ret, 0); 2619762338dSopenharmony_ci} 2629762338dSopenharmony_ci/** 2639762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_OnSetData_1000 2649762338dSopenharmony_ci * @tc.name testPinAuthTestOnSetData009 2659762338dSopenharmony_ci * @tc.desc test OnSetData 1000 times 2669762338dSopenharmony_ci */ 2679762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestOnSetData009, Function | MediumTest | Level2) 2689762338dSopenharmony_ci{ 2699762338dSopenharmony_ci cout << "start SetData" << endl; 2709762338dSopenharmony_ci uint64_t scheduleId = parcel.ReadUint64(); 2719762338dSopenharmony_ci uint64_t authSubType = parcel.ReadUint64(); 2729762338dSopenharmony_ci std::vector<uint8_t> data; 2739762338dSopenharmony_ci FillTestUint8Vector(parcel, data); 2749762338dSopenharmony_ci int32_t ret = 0; 2759762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 2769762338dSopenharmony_ci int32_t resultCode = 0; 2779762338dSopenharmony_ci ret = g_executorImpl.SetData(scheduleId, authSubType, data, resultCode); 2789762338dSopenharmony_ci cout << "ret is" << ret << endl; 2799762338dSopenharmony_ci EXPECT_NE(ret, 0); 2809762338dSopenharmony_ci } 2819762338dSopenharmony_ci} 2829762338dSopenharmony_ci 2839762338dSopenharmony_ci/** 2849762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_Enroll_0200 2859762338dSopenharmony_ci * @tc.name testPinAuthTestEnroll001 2869762338dSopenharmony_ci * @tc.desc test Enroll scheduleId 2879762338dSopenharmony_ci */ 2889762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestEnroll001, Function | MediumTest | Level1) 2899762338dSopenharmony_ci{ 2909762338dSopenharmony_ci cout << "start test testPinAuthTestEnroll001" << endl; 2919762338dSopenharmony_ci uint64_t scheduleId = 0; 2929762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 2939762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 2949762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 2959762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 2969762338dSopenharmony_ci int32_t ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj); 2979762338dSopenharmony_ci cout << "ret is" << ret << endl; 2989762338dSopenharmony_ci EXPECT_EQ(ret, 0); 2999762338dSopenharmony_ci scheduleId = 0x7FFFFFFFFFFFFFFF; 3009762338dSopenharmony_ci ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj); 3019762338dSopenharmony_ci cout << "ret is " << ret << endl; 3029762338dSopenharmony_ci EXPECT_EQ(ret, 0); 3039762338dSopenharmony_ci scheduleId = 0xFFFFFFFFFFFFFFFF; 3049762338dSopenharmony_ci ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj); 3059762338dSopenharmony_ci cout << "ret is " << ret << endl; 3069762338dSopenharmony_ci EXPECT_EQ(ret, 0); 3079762338dSopenharmony_ci} 3089762338dSopenharmony_ci/** 3099762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_Enroll_0500 3109762338dSopenharmony_ci * @tc.name testPinAuthTestEnroll004 3119762338dSopenharmony_ci * @tc.desc test Enroll extraInfo empty 3129762338dSopenharmony_ci */ 3139762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestEnroll004, Function | MediumTest | Level1) 3149762338dSopenharmony_ci{ 3159762338dSopenharmony_ci cout << "start test testPinAuthTestEnroll004" << endl; 3169762338dSopenharmony_ci uint64_t scheduleId = 0x7FFFFFFFFFFFFFFF; 3179762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 3189762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 3199762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 3209762338dSopenharmony_ci int32_t ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj); 3219762338dSopenharmony_ci cout << "ret is" << ret << endl; 3229762338dSopenharmony_ci EXPECT_EQ(ret, 0); 3239762338dSopenharmony_ci ret = g_executorImpl.Enroll(scheduleId, extraInfo, nullptr); 3249762338dSopenharmony_ci cout << "ret is " << ret << endl; 3259762338dSopenharmony_ci EXPECT_NE(ret, 0); 3269762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 3279762338dSopenharmony_ci ret = g_executorImpl.Enroll(scheduleId, extraInfo, nullptr); 3289762338dSopenharmony_ci cout << "ret is " << ret << endl; 3299762338dSopenharmony_ci EXPECT_NE(ret, 0); 3309762338dSopenharmony_ci} 3319762338dSopenharmony_ci/** 3329762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_Enroll_0800 3339762338dSopenharmony_ci * @tc.name testPinAuthTestEnroll007 3349762338dSopenharmony_ci * @tc.desc test Enroll 1000 times 3359762338dSopenharmony_ci */ 3369762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestEnroll007, Function | MediumTest | Level1) 3379762338dSopenharmony_ci{ 3389762338dSopenharmony_ci cout << "start test testPinAuthTestEnroll007" << endl; 3399762338dSopenharmony_ci uint64_t scheduleId = 0x7FFFFFFFFFFFFFFF; 3409762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 3419762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 3429762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 3439762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 3449762338dSopenharmony_ci int32_t ret = 0; 3459762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 3469762338dSopenharmony_ci ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj); 3479762338dSopenharmony_ci cout << "ret" << i << "is" << ret << endl; 3489762338dSopenharmony_ci EXPECT_EQ(ret, 0); 3499762338dSopenharmony_ci } 3509762338dSopenharmony_ci} 3519762338dSopenharmony_ci/** 3529762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_Authenticate_0200 3539762338dSopenharmony_ci * @tc.name testPinAuthTestAuthenticate001 3549762338dSopenharmony_ci * @tc.desc test Authenticate scheduleId 3559762338dSopenharmony_ci */ 3569762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestAuthenticate001, Function | MediumTest | Level1) 3579762338dSopenharmony_ci{ 3589762338dSopenharmony_ci cout << "start testPinAuthTestAuthenticate001" << endl; 3599762338dSopenharmony_ci uint64_t scheduleId = 0; 3609762338dSopenharmony_ci uint64_t templateId = parcel.ReadUint64(); 3619762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 3629762338dSopenharmony_ci templateIdList.push_back(templateId); 3639762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 3649762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 3659762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 3669762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 3679762338dSopenharmony_ci int32_t ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 3689762338dSopenharmony_ci cout << "ret is" << ret << endl; 3699762338dSopenharmony_ci EXPECT_EQ(ret, 0); 3709762338dSopenharmony_ci scheduleId = 0xFFFFFFFFFFFFFFFF; 3719762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 3729762338dSopenharmony_ci cout << "ret is " << ret << endl; 3739762338dSopenharmony_ci EXPECT_EQ(ret, 0); 3749762338dSopenharmony_ci scheduleId = 0x7FFFFFFFFFFFFFFF; 3759762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 3769762338dSopenharmony_ci cout << "ret is " << ret << endl; 3779762338dSopenharmony_ci EXPECT_EQ(ret, 0); 3789762338dSopenharmony_ci} 3799762338dSopenharmony_ci/** 3809762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_Authenticate_0500 3819762338dSopenharmony_ci * @tc.name testPinAuthTestAuthenticate004 3829762338dSopenharmony_ci * @tc.desc test Authenticate templateId 3839762338dSopenharmony_ci */ 3849762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestAuthenticate004, Function | MediumTest | Level1) 3859762338dSopenharmony_ci{ 3869762338dSopenharmony_ci cout << "start testPinAuthTestAuthenticate004" << endl; 3879762338dSopenharmony_ci uint64_t scheduleId = parcel.ReadUint64(); 3889762338dSopenharmony_ci uint64_t templateId = parcel.ReadUint64(); 3899762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 3909762338dSopenharmony_ci templateIdList.push_back(templateId); 3919762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 3929762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 3939762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 3949762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 3959762338dSopenharmony_ci int32_t ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 3969762338dSopenharmony_ci cout << "ret is" << ret << endl; 3979762338dSopenharmony_ci EXPECT_EQ(ret, 0); 3989762338dSopenharmony_ci templateIdList.resize(0); 3999762338dSopenharmony_ci templateIdList.push_back(0xFFFFFFFFFFFFFFFF); 4009762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 4019762338dSopenharmony_ci cout << "ret is" << ret << endl; 4029762338dSopenharmony_ci EXPECT_EQ(ret, 0); 4039762338dSopenharmony_ci templateIdList.resize(0); 4049762338dSopenharmony_ci templateIdList.push_back(0x7FFFFFFFFFFFFFFF); 4059762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 4069762338dSopenharmony_ci cout << "ret is" << ret << endl; 4079762338dSopenharmony_ci EXPECT_EQ(ret, 0); 4089762338dSopenharmony_ci} 4099762338dSopenharmony_ci/** 4109762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_Authenticate_0800 4119762338dSopenharmony_ci * @tc.name testPinAuthTestAuthenticate007 4129762338dSopenharmony_ci * @tc.desc test Authenticate empty 4139762338dSopenharmony_ci */ 4149762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestAuthenticate007, Function | MediumTest | Level1) 4159762338dSopenharmony_ci{ 4169762338dSopenharmony_ci cout << "start testPinAuthTestAuthenticate007" << endl; 4179762338dSopenharmony_ci uint64_t scheduleId = parcel.ReadUint64(); 4189762338dSopenharmony_ci uint64_t templateId = parcel.ReadUint64(); 4199762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 4209762338dSopenharmony_ci templateIdList.push_back(templateId); 4219762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 4229762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 4239762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 4249762338dSopenharmony_ci int32_t ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 4259762338dSopenharmony_ci cout << "ret is" << ret << endl; 4269762338dSopenharmony_ci EXPECT_EQ(ret, 0); 4279762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, nullptr); 4289762338dSopenharmony_ci cout << "ret is" << ret << endl; 4299762338dSopenharmony_ci EXPECT_NE(ret, 0); 4309762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 4319762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 4329762338dSopenharmony_ci cout << "ret is" << ret << endl; 4339762338dSopenharmony_ci EXPECT_EQ(ret, 0); 4349762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, nullptr); 4359762338dSopenharmony_ci cout << "ret is" << ret << endl; 4369762338dSopenharmony_ci EXPECT_NE(ret, 0); 4379762338dSopenharmony_ci} 4389762338dSopenharmony_ci/** 4399762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_Authenticate_1100 4409762338dSopenharmony_ci * @tc.name testPinAuthTestAuthenticate010 4419762338dSopenharmony_ci * @tc.desc test Authenticate 1000 times 4429762338dSopenharmony_ci */ 4439762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestAuthenticate010, Function | MediumTest | Level1) 4449762338dSopenharmony_ci{ 4459762338dSopenharmony_ci cout << "start testPinAuthTestAuthenticate010" << endl; 4469762338dSopenharmony_ci uint64_t scheduleId = parcel.ReadUint64(); 4479762338dSopenharmony_ci uint64_t templateId = parcel.ReadUint64(); 4489762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 4499762338dSopenharmony_ci templateIdList.push_back(templateId); 4509762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 4519762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 4529762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 4539762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 4549762338dSopenharmony_ci int32_t ret = 0; 4559762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 4569762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 4579762338dSopenharmony_ci cout << "ret is" << ret << endl; 4589762338dSopenharmony_ci EXPECT_EQ(ret, 0); 4599762338dSopenharmony_ci } 4609762338dSopenharmony_ci} 4619762338dSopenharmony_ci/** 4629762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_Delete_0200 4639762338dSopenharmony_ci * @tc.name testPinAuthTestDelete001 4649762338dSopenharmony_ci * @tc.desc test Delete templateId 0 4659762338dSopenharmony_ci */ 4669762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestDelete001, Function | MediumTest | Level2) 4679762338dSopenharmony_ci{ 4689762338dSopenharmony_ci cout << "start Delete" << endl; 4699762338dSopenharmony_ci uint64_t templateId = 0; 4709762338dSopenharmony_ci int32_t ret = g_executorImpl.Delete(templateId); 4719762338dSopenharmony_ci cout << "ret is " << ret << endl; 4729762338dSopenharmony_ci EXPECT_NE(ret, 0); 4739762338dSopenharmony_ci templateId = 0x7FFFFFFFFFFFFFFF; 4749762338dSopenharmony_ci ret = g_executorImpl.Delete(templateId); 4759762338dSopenharmony_ci cout << "ret is " << ret << endl; 4769762338dSopenharmony_ci EXPECT_NE(ret, 0); 4779762338dSopenharmony_ci templateId = 0xFFFFFFFFFFFFFFFF; 4789762338dSopenharmony_ci ret = g_executorImpl.Delete(templateId); 4799762338dSopenharmony_ci cout << "ret is " << ret << endl; 4809762338dSopenharmony_ci EXPECT_NE(ret, 0); 4819762338dSopenharmony_ci templateId = 0; 4829762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 4839762338dSopenharmony_ci ret = g_executorImpl.Delete(templateId); 4849762338dSopenharmony_ci cout << "ret is " << ret << endl; 4859762338dSopenharmony_ci EXPECT_NE(ret, 0); 4869762338dSopenharmony_ci } 4879762338dSopenharmony_ci} 4889762338dSopenharmony_ci/** 4899762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_Cancel_0200 4909762338dSopenharmony_ci * @tc.name testPinAuthTestCancel001 4919762338dSopenharmony_ci * @tc.desc test Cancel scheduleId 4929762338dSopenharmony_ci */ 4939762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestCancel001, Function | MediumTest | Level1) 4949762338dSopenharmony_ci{ 4959762338dSopenharmony_ci cout << "start Cancel" << endl; 4969762338dSopenharmony_ci uint64_t scheduleId = 0; 4979762338dSopenharmony_ci int32_t ret = g_executorImpl.Cancel(scheduleId); 4989762338dSopenharmony_ci cout << "ret is " << ret << endl; 4999762338dSopenharmony_ci EXPECT_EQ(ret, 0); 5009762338dSopenharmony_ci scheduleId = 0x7FFFFFFFFFFFFFFF; 5019762338dSopenharmony_ci ret = g_executorImpl.Cancel(scheduleId); 5029762338dSopenharmony_ci cout << "ret is " << ret << endl; 5039762338dSopenharmony_ci EXPECT_EQ(ret, 0); 5049762338dSopenharmony_ci scheduleId = 0xFFFFFFFFFFFFFFFF; 5059762338dSopenharmony_ci ret = g_executorImpl.Cancel(scheduleId); 5069762338dSopenharmony_ci cout << "ret is " << ret << endl; 5079762338dSopenharmony_ci EXPECT_EQ(ret, 0); 5089762338dSopenharmony_ci} 5099762338dSopenharmony_ci/** 5109762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_Cancel_0500 5119762338dSopenharmony_ci * @tc.name testPinAuthTestCancel004 5129762338dSopenharmony_ci * @tc.desc test Cancel 1000 times 5139762338dSopenharmony_ci */ 5149762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestCancel004, Function | MediumTest | Level1) 5159762338dSopenharmony_ci{ 5169762338dSopenharmony_ci cout << "start Cancel" << endl; 5179762338dSopenharmony_ci uint64_t scheduleId = parcel.ReadUint64(); 5189762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 5199762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 5209762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 5219762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 5229762338dSopenharmony_ci 5239762338dSopenharmony_ci int32_t ret = 0; 5249762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 5259762338dSopenharmony_ci ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj); 5269762338dSopenharmony_ci ret = g_executorImpl.Cancel(scheduleId); 5279762338dSopenharmony_ci cout << "ret is " << ret << endl; 5289762338dSopenharmony_ci EXPECT_EQ(ret, 0); 5299762338dSopenharmony_ci } 5309762338dSopenharmony_ci} 5319762338dSopenharmony_ci 5329762338dSopenharmony_ci/** 5339762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_GetProperty_0200 5349762338dSopenharmony_ci * @tc.name testPinAuthTestGetProperty001 5359762338dSopenharmony_ci * @tc.desc test GetProperty 5369762338dSopenharmony_ci */ 5379762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestGetProperty001, Function | MediumTest | Level2) 5389762338dSopenharmony_ci{ 5399762338dSopenharmony_ci cout << "start GetProperty" << endl; 5409762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 5419762338dSopenharmony_ci std::vector<int32_t> propertyTypes; 5429762338dSopenharmony_ci Property property; 5439762338dSopenharmony_ci int32_t ret = g_executorImpl.GetProperty(templateIdList, propertyTypes, property); 5449762338dSopenharmony_ci cout << "ret is " << ret << endl; 5459762338dSopenharmony_ci EXPECT_NE(ret, 0); 5469762338dSopenharmony_ci FillTestUint64Vector(parcel, templateIdList); 5479762338dSopenharmony_ci ret = g_executorImpl.GetProperty(templateIdList, propertyTypes, property); 5489762338dSopenharmony_ci cout << "ret is " << ret << endl; 5499762338dSopenharmony_ci EXPECT_NE(ret, 0); 5509762338dSopenharmony_ci propertyTypes.push_back(OHOS::HDI::PinAuth::V2_0::AUTH_SUB_TYPE); 5519762338dSopenharmony_ci propertyTypes.push_back(OHOS::HDI::PinAuth::V2_0::LOCKOUT_DURATION); 5529762338dSopenharmony_ci propertyTypes.push_back(OHOS::HDI::PinAuth::V2_0::REMAIN_ATTEMPTS); 5539762338dSopenharmony_ci ret = g_executorImpl.GetProperty(templateIdList, propertyTypes, property); 5549762338dSopenharmony_ci cout << "ret is " << ret << endl; 5559762338dSopenharmony_ci EXPECT_NE(ret, 0); 5569762338dSopenharmony_ci} 5579762338dSopenharmony_ci/** 5589762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_GetProperty_0700 5599762338dSopenharmony_ci * @tc.name testPinAuthTestGetProperty006 5609762338dSopenharmony_ci * @tc.desc test GetProperty 1000 times 5619762338dSopenharmony_ci */ 5629762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestGetProperty006, Function | MediumTest | Level2) 5639762338dSopenharmony_ci{ 5649762338dSopenharmony_ci cout << "start GetProperty" << endl; 5659762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 5669762338dSopenharmony_ci FillTestUint64Vector(parcel, templateIdList); 5679762338dSopenharmony_ci std::vector<int32_t> propertyTypes; 5689762338dSopenharmony_ci propertyTypes.push_back(OHOS::HDI::PinAuth::V2_0::AUTH_SUB_TYPE); 5699762338dSopenharmony_ci Property property; 5709762338dSopenharmony_ci 5719762338dSopenharmony_ci int32_t ret = 0; 5729762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 5739762338dSopenharmony_ci ret = g_executorImpl.GetProperty(templateIdList, propertyTypes, property); 5749762338dSopenharmony_ci 5759762338dSopenharmony_ci cout << "ret is " << ret << endl; 5769762338dSopenharmony_ci EXPECT_NE(ret, 0); 5779762338dSopenharmony_ci } 5789762338dSopenharmony_ci} 5799762338dSopenharmony_ci/** 5809762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_EnrollV1_1_0100 5819762338dSopenharmony_ci * @tc.name testPinAuthTestEnrollV1_1001 5829762338dSopenharmony_ci * @tc.desc test EnrollV1_1 scheduleId 5839762338dSopenharmony_ci */ 5849762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestEnroll_001, Function | MediumTest | Level1) 5859762338dSopenharmony_ci{ 5869762338dSopenharmony_ci cout << "start test EnrollV1_1" << endl; 5879762338dSopenharmony_ci uint64_t scheduleId = 0; 5889762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 5899762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 5909762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 5919762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 5929762338dSopenharmony_ci int32_t ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj); 5939762338dSopenharmony_ci cout << "ret is" << ret << endl; 5949762338dSopenharmony_ci EXPECT_EQ(ret, 0); 5959762338dSopenharmony_ci scheduleId = 0x7FFFFFFFFFFFFFFF; 5969762338dSopenharmony_ci ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj); 5979762338dSopenharmony_ci cout << "ret is" << ret << endl; 5989762338dSopenharmony_ci EXPECT_EQ(ret, 0); 5999762338dSopenharmony_ci scheduleId = 0xFFFFFFFFFFFFFFFF; 6009762338dSopenharmony_ci ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj); 6019762338dSopenharmony_ci cout << "ret is" << ret << endl; 6029762338dSopenharmony_ci EXPECT_EQ(ret, 0); 6039762338dSopenharmony_ci} 6049762338dSopenharmony_ci/** 6059762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_EnrollV1_1_0400 6069762338dSopenharmony_ci * @tc.name testPinAuthTestEnrollV1_1004 6079762338dSopenharmony_ci * @tc.desc test EnrollV1_1 empty 6089762338dSopenharmony_ci */ 6099762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestEnroll_004, Function | MediumTest | Level1) 6109762338dSopenharmony_ci{ 6119762338dSopenharmony_ci cout << "start test EnrollV1_1" << endl; 6129762338dSopenharmony_ci uint64_t scheduleId = 0; 6139762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 6149762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 6159762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 6169762338dSopenharmony_ci int32_t ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj); 6179762338dSopenharmony_ci cout << "ret is" << ret << endl; 6189762338dSopenharmony_ci EXPECT_EQ(ret, 0); 6199762338dSopenharmony_ci ret = g_executorImpl.Enroll(scheduleId, extraInfo, nullptr); 6209762338dSopenharmony_ci cout << "ret is" << ret << endl; 6219762338dSopenharmony_ci EXPECT_NE(ret, 0); 6229762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 6239762338dSopenharmony_ci ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj); 6249762338dSopenharmony_ci cout << "ret is" << ret << endl; 6259762338dSopenharmony_ci EXPECT_EQ(ret, 0); 6269762338dSopenharmony_ci ret = g_executorImpl.Enroll(scheduleId, extraInfo, nullptr); 6279762338dSopenharmony_ci cout << "ret is" << ret << endl; 6289762338dSopenharmony_ci EXPECT_NE(ret, 0); 6299762338dSopenharmony_ci} 6309762338dSopenharmony_ci/** 6319762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_EnrollV1_1_0700 6329762338dSopenharmony_ci * @tc.name testPinAuthTestEnrollV1_1007 6339762338dSopenharmony_ci * @tc.desc test EnrollV1_1 1000 times 6349762338dSopenharmony_ci */ 6359762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestEnroll_007, Function | MediumTest | Level1) 6369762338dSopenharmony_ci{ 6379762338dSopenharmony_ci cout << "start test EnrollV1_1" << endl; 6389762338dSopenharmony_ci uint64_t scheduleId = 0; 6399762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 6409762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 6419762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 6429762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 6439762338dSopenharmony_ci int32_t ret = 0; 6449762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 6459762338dSopenharmony_ci ret = g_executorImpl.Enroll(scheduleId, extraInfo, callbackObj); 6469762338dSopenharmony_ci cout << "ret is" << ret << endl; 6479762338dSopenharmony_ci EXPECT_EQ(ret, 0); 6489762338dSopenharmony_ci } 6499762338dSopenharmony_ci} 6509762338dSopenharmony_ci/** 6519762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_AuthenticateV1_1_0100 6529762338dSopenharmony_ci * @tc.name testPinAuthTestAuthenticateV1_1001 6539762338dSopenharmony_ci * @tc.desc test AuthenticateV1_1 scheduleId 0 6549762338dSopenharmony_ci */ 6559762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestAuthenticate_001, Function | MediumTest | Level2) 6569762338dSopenharmony_ci{ 6579762338dSopenharmony_ci cout << "start AuthenticateV1_1" << endl; 6589762338dSopenharmony_ci 6599762338dSopenharmony_ci uint64_t scheduleId = 0; 6609762338dSopenharmony_ci uint64_t templateId = parcel.ReadUint64(); 6619762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 6629762338dSopenharmony_ci templateIdList.push_back(templateId); 6639762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 6649762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 6659762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 6669762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 6679762338dSopenharmony_ci int32_t ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 6689762338dSopenharmony_ci cout << "ret is " << ret << endl; 6699762338dSopenharmony_ci EXPECT_EQ(ret, 0); 6709762338dSopenharmony_ci scheduleId = 0xFFFFFFFFFFFFFFFF; 6719762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 6729762338dSopenharmony_ci cout << "ret is " << ret << endl; 6739762338dSopenharmony_ci EXPECT_EQ(ret, 0); 6749762338dSopenharmony_ci scheduleId = 0x7FFFFFFFFFFFFFFF; 6759762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 6769762338dSopenharmony_ci cout << "ret is " << ret << endl; 6779762338dSopenharmony_ci EXPECT_EQ(ret, 0); 6789762338dSopenharmony_ci} 6799762338dSopenharmony_ci/** 6809762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_AuthenticateV1_1_0400 6819762338dSopenharmony_ci * @tc.name testPinAuthTestAuthenticateV1_1004 6829762338dSopenharmony_ci * @tc.desc test AuthenticateV1_1 templateId 0 6839762338dSopenharmony_ci */ 6849762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestAuthenticate_004, Function | MediumTest | Level2) 6859762338dSopenharmony_ci{ 6869762338dSopenharmony_ci cout << "start AuthenticateV1_1" << endl; 6879762338dSopenharmony_ci 6889762338dSopenharmony_ci uint64_t scheduleId = parcel.ReadUint64(); 6899762338dSopenharmony_ci uint64_t templateId = parcel.ReadUint64(); 6909762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 6919762338dSopenharmony_ci templateIdList.push_back(templateId); 6929762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 6939762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 6949762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 6959762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 6969762338dSopenharmony_ci int32_t ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 6979762338dSopenharmony_ci cout << "ret is " << ret << endl; 6989762338dSopenharmony_ci EXPECT_EQ(ret, 0); 6999762338dSopenharmony_ci templateIdList.resize(0); 7009762338dSopenharmony_ci templateIdList.push_back(0xFFFFFFFFFFFFFFFF); 7019762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 7029762338dSopenharmony_ci cout << "ret is " << ret << endl; 7039762338dSopenharmony_ci EXPECT_EQ(ret, 0); 7049762338dSopenharmony_ci templateIdList.resize(0); 7059762338dSopenharmony_ci templateIdList.push_back(0x7FFFFFFFFFFFFFFF); 7069762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 7079762338dSopenharmony_ci cout << "ret is " << ret << endl; 7089762338dSopenharmony_ci EXPECT_EQ(ret, 0); 7099762338dSopenharmony_ci} 7109762338dSopenharmony_ci/** 7119762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_AuthenticateV1_1_0700 7129762338dSopenharmony_ci * @tc.name testPinAuthTestAuthenticateV1_1007 7139762338dSopenharmony_ci * @tc.desc test AuthenticateV1_1 extraInfo empty 7149762338dSopenharmony_ci */ 7159762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestAuthenticate_007, Function | MediumTest | Level2) 7169762338dSopenharmony_ci{ 7179762338dSopenharmony_ci cout << "start AuthenticateV1_1" << endl; 7189762338dSopenharmony_ci 7199762338dSopenharmony_ci uint64_t scheduleId = parcel.ReadUint64(); 7209762338dSopenharmony_ci uint64_t templateId = parcel.ReadUint64(); 7219762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 7229762338dSopenharmony_ci templateIdList.push_back(templateId); 7239762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 7249762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 7259762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 7269762338dSopenharmony_ci int32_t ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 7279762338dSopenharmony_ci cout << "ret is " << ret << endl; 7289762338dSopenharmony_ci EXPECT_EQ(ret, 0); 7299762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, nullptr); 7309762338dSopenharmony_ci cout << "ret is " << ret << endl; 7319762338dSopenharmony_ci EXPECT_NE(ret, 0); 7329762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 7339762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 7349762338dSopenharmony_ci cout << "ret is " << ret << endl; 7359762338dSopenharmony_ci EXPECT_EQ(ret, 0); 7369762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, nullptr); 7379762338dSopenharmony_ci cout << "ret is " << ret << endl; 7389762338dSopenharmony_ci EXPECT_NE(ret, 0); 7399762338dSopenharmony_ci} 7409762338dSopenharmony_ci/** 7419762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_AuthenticateV1_1_1000 7429762338dSopenharmony_ci * @tc.name testPinAuthTestAuthenticateV1_1010 7439762338dSopenharmony_ci * @tc.desc test AuthenticateV1_1 1000 times 7449762338dSopenharmony_ci */ 7459762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestAuthenticate_010, Function | MediumTest | Level2) 7469762338dSopenharmony_ci{ 7479762338dSopenharmony_ci cout << "start AuthenticateV1_1" << endl; 7489762338dSopenharmony_ci 7499762338dSopenharmony_ci uint64_t scheduleId = parcel.ReadUint64(); 7509762338dSopenharmony_ci uint64_t templateId = parcel.ReadUint64(); 7519762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 7529762338dSopenharmony_ci templateIdList.push_back(templateId); 7539762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 7549762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 7559762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 7569762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 7579762338dSopenharmony_ci int32_t ret = 0; 7589762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 7599762338dSopenharmony_ci ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 7609762338dSopenharmony_ci 7619762338dSopenharmony_ci cout << "ret is " << ret << endl; 7629762338dSopenharmony_ci EXPECT_EQ(ret, 0); 7639762338dSopenharmony_ci } 7649762338dSopenharmony_ci} 7659762338dSopenharmony_ci/** 7669762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_GetExecutorList_0200 7679762338dSopenharmony_ci * @tc.name testPinAuthTestGetExecutorList001 7689762338dSopenharmony_ci * @tc.desc test GetExecutorList 1000 times 7699762338dSopenharmony_ci */ 7709762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestGetExecutorList001, Function | MediumTest | Level1) 7719762338dSopenharmony_ci{ 7729762338dSopenharmony_ci cout << "start GetExecutorList" << endl; 7739762338dSopenharmony_ci PinAuthInterfaceService g_pinAuthInterFaceService; 7749762338dSopenharmony_ci std::vector<sptr<IAllInOneExecutor>> allInOneExecutors; 7759762338dSopenharmony_ci std::vector<sptr<IVerifier>> verifiers; 7769762338dSopenharmony_ci std::vector<sptr<ICollector>> collectors; 7779762338dSopenharmony_ci int32_t ret = 0; 7789762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 7799762338dSopenharmony_ci ret = g_pinAuthInterFaceService.GetExecutorList(allInOneExecutors, verifiers, collectors); 7809762338dSopenharmony_ci cout << "ret is " << ret << endl; 7819762338dSopenharmony_ci EXPECT_EQ(ret, 0); 7829762338dSopenharmony_ci } 7839762338dSopenharmony_ci} 7849762338dSopenharmony_ci/** 7859762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_GetExecutorListV1_1_0200 7869762338dSopenharmony_ci * @tc.name testPinAuthTestGetExecutorListV1_1001 7879762338dSopenharmony_ci * @tc.desc test GetExecutorListV1_1 1000 times 7889762338dSopenharmony_ci */ 7899762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestGetExecutorList_001, Function | MediumTest | Level1) 7909762338dSopenharmony_ci{ 7919762338dSopenharmony_ci cout << "start GetExecutorList" << endl; 7929762338dSopenharmony_ci std::vector<sptr<IAllInOneExecutor>> allInOneExecutors; 7939762338dSopenharmony_ci std::vector<sptr<IVerifier>> verifiers; 7949762338dSopenharmony_ci std::vector<sptr<ICollector>> collectors; 7959762338dSopenharmony_ci PinAuthInterfaceService pin_Interface; 7969762338dSopenharmony_ci 7979762338dSopenharmony_ci int32_t ret = 0; 7989762338dSopenharmony_ci for (int32_t i = 0; i < 1000; i++) { 7999762338dSopenharmony_ci ret = pin_Interface.GetExecutorList(allInOneExecutors, verifiers, collectors); 8009762338dSopenharmony_ci 8019762338dSopenharmony_ci cout << "ret is " << ret << endl; 8029762338dSopenharmony_ci EXPECT_EQ(ret, 0); 8039762338dSopenharmony_ci } 8049762338dSopenharmony_ci} 8059762338dSopenharmony_ci 8069762338dSopenharmony_ci/** 8079762338dSopenharmony_ci * @tc.number SUB_Security_Iam_PinAuth_HDI_OnGetData_0100 8089762338dSopenharmony_ci * @tc.name testPinAuthTestOnGetData001 8099762338dSopenharmony_ci * @tc.desc test OnGetData 8109762338dSopenharmony_ci */ 8119762338dSopenharmony_ciHWTEST_F(UserIamPinAuthTestAdditional, testPinAuthTestOnGetData_001, Function | MediumTest | Level1) 8129762338dSopenharmony_ci{ 8139762338dSopenharmony_ci cout << "start Authenticate" << endl; 8149762338dSopenharmony_ci uint64_t scheduleId = parcel.ReadUint64(); 8159762338dSopenharmony_ci uint64_t templateId = parcel.ReadUint64(); 8169762338dSopenharmony_ci std::vector<uint64_t> templateIdList; 8179762338dSopenharmony_ci templateIdList.push_back(templateId); 8189762338dSopenharmony_ci std::vector<uint8_t> extraInfo; 8199762338dSopenharmony_ci FillTestUint8Vector(parcel, extraInfo); 8209762338dSopenharmony_ci sptr<IExecutorCallback> callbackObj; 8219762338dSopenharmony_ci FillTestIExecutorCallback(parcel, callbackObj); 8229762338dSopenharmony_ci int32_t ret = g_executorImpl.Authenticate(scheduleId, templateIdList, extraInfo, callbackObj); 8239762338dSopenharmony_ci cout << "ret is " << ret << endl; 8249762338dSopenharmony_ci EXPECT_EQ(g_onGetDataFlag, false); 8259762338dSopenharmony_ci} 826