Merge pull request !771 from liuziwei/master
This commit is contained in:
openharmony_ci 2024-03-19 11:00:22 +00:00 committed by Gitee
commit 2085d5b463
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 19 additions and 7 deletions

View File

@ -134,26 +134,32 @@ HWTEST_F(AuthWidgetHelperTest, AuthWidgetHelperTestCheckReuseUnlockResult002, Te
EXPECT_CALL(*mockHdi, CheckReuseUnlockResult(_, _)).Times(3);
ON_CALL(*mockHdi, CheckReuseUnlockResult)
.WillByDefault(
[](const HdiReuseUnlockInfo &info, std::vector<uint8_t> &token) {
[](const HdiReuseUnlockInfo &info, std::vector<uint8_t> &reuseResult) {
return HDF_FAILURE;
}
);
EXPECT_EQ(AuthWidgetHelper::CheckReuseUnlockResult(para, authParam, extraInfo), HDF_FAILURE);
ON_CALL(*mockHdi, CheckReuseUnlockResult)
.WillByDefault(
[](const HdiReuseUnlockInfo &info, std::vector<uint8_t> &token) {
[](const HdiReuseUnlockInfo &info, std::vector<uint8_t> &reuseResult) {
return HDF_SUCCESS;
}
);
EXPECT_EQ(AuthWidgetHelper::CheckReuseUnlockResult(para, authParam, extraInfo), GENERAL_ERROR);
ON_CALL(*mockHdi, CheckReuseUnlockResult)
.WillByDefault(
[](const HdiReuseUnlockInfo &info, std::vector<uint8_t> &token) {
token.push_back(1);
[](const HdiReuseUnlockInfo &info, std::vector<uint8_t> &reuseResult) {
static const uint32_t USER_AUTH_TOKEN_LEN = 148;
struct ReuseUnlockResultHdi {
uint32_t authType;
uint8_t authToken[USER_AUTH_TOKEN_LEN];
EnrolledState enrolledState;
};
reuseResult.resize(sizeof(ReuseUnlockResultHdi));
return HDF_SUCCESS;
}
);
EXPECT_EQ(AuthWidgetHelper::CheckReuseUnlockResult(para, authParam, extraInfo), SUCCESS);
EXPECT_EQ(AuthWidgetHelper::CheckReuseUnlockResult(para, authParam, extraInfo), HDF_SUCCESS);
}
} // namespace UserAuth
} // namespace UserIam

View File

@ -1548,8 +1548,14 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceAuthWidget_023, TestSize.Level0)
EXPECT_CALL(*mockHdi, CheckReuseUnlockResult(_, _)).Times(1);
ON_CALL(*mockHdi, CheckReuseUnlockResult)
.WillByDefault(
[](const HdiReuseUnlockInfo &info, std::vector<uint8_t> &token) {
token.push_back(1);
[](const HdiReuseUnlockInfo &info, std::vector<uint8_t> &reuseResult) {
static const uint32_t USER_AUTH_TOKEN_LEN = 148;
struct ReuseUnlockResultHdi {
uint32_t authType;
uint8_t authToken[USER_AUTH_TOKEN_LEN];
EnrolledState enrolledState;
};
reuseResult.resize(sizeof(ReuseUnlockResultHdi));
return HDF_SUCCESS;
}
);