mirror of
https://gitee.com/openharmony/useriam_user_auth_framework
synced 2024-11-23 07:39:51 +00:00
commit
2085d5b463
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user