Merge pull request !1532 from ningjingyou/master
This commit is contained in:
openharmony_ci 2024-11-20 03:29:52 +00:00 committed by Gitee
commit 4ec4fa7bcb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -340,7 +340,7 @@ HWTEST_F(KeyManagerTest, KeyManager_ActiveCeSceSeceUserKey_002, TestSize.Level1)
EXPECT_CALL(*fscryptControlMock_, KeyCtrlHasFscryptSyspara()).WillOnce(Return(true));
EXPECT_CALL(*fscryptControlMock_, GetFscryptVersionFromPolicy()).WillOnce(Return(FSCRYPT_V2));
EXPECT_CALL(*keyControlMock_, KeyCtrlGetFscryptVersion(_)).WillOnce(Return(FSCRYPT_V2));
EXPECT_CALL(*fscryptKeyMock_, DecryptClassE(_, _, _, _, _)).WillOnce(Return(true));
EXPECT_CALL(*fscryptKeyMock_, DecryptClassE(_, _, _, _, _)).WillOnce(Return(false));
EXPECT_EQ(KeyManager::GetInstance()->ActiveCeSceSeceUserKey(user, EL5_KEY, token, secret), -EFAULT);
EXPECT_CALL(*fscryptControlMock_, KeyCtrlHasFscryptSyspara()).WillOnce(Return(true));
@ -1226,10 +1226,9 @@ HWTEST_F(KeyManagerTest, KeyManager_InActiveUserKey_002, TestSize.Level1)
KeyManager::GetInstance()->userEl2Key_[user] = elKey;
KeyManager::GetInstance()->userEl3Key_[user] = elKey;
KeyManager::GetInstance()->userEl4Key_[user] = elKey;
KeyManager::GetInstance()->userEl5Key_[user] = elKey;
KeyManager::GetInstance()->userLockScreenTask_[user] = std::make_shared<DelayHandler>(user);
EXPECT_CALL(*fscryptKeyMock_, InactiveKey(_, _)).WillOnce(Return(true)).WillOnce(Return(true))
.WillOnce(Return(true)).WillOnce(Return(true));
.WillOnce(Return(true));
EXPECT_CALL(*fscryptControlMock_, KeyCtrlHasFscryptSyspara()).WillOnce(Return(true));
EXPECT_EQ(KeyManager::GetInstance()->InActiveUserKey(user), -ENOENT);
EXPECT_TRUE(KeyManager::GetInstance()->userEl2Key_.find(user) == KeyManager::GetInstance()->userEl2Key_.end());
@ -1241,9 +1240,8 @@ HWTEST_F(KeyManagerTest, KeyManager_InActiveUserKey_002, TestSize.Level1)
KeyManager::GetInstance()->userEl2Key_[user] = elKey;
KeyManager::GetInstance()->userEl3Key_[user] = elKey;
KeyManager::GetInstance()->userEl4Key_[user] = elKey;
KeyManager::GetInstance()->userEl5Key_[user] = elKey;
EXPECT_CALL(*fscryptKeyMock_, InactiveKey(_, _)).WillOnce(Return(true)).WillOnce(Return(true))
.WillOnce(Return(true)).WillOnce(Return(true));
.WillOnce(Return(true));
EXPECT_CALL(*fscryptControlMock_, KeyCtrlHasFscryptSyspara()).WillOnce(Return(true));
EXPECT_EQ(KeyManager::GetInstance()->InActiveUserKey(user), -ENOENT);
EXPECT_TRUE(KeyManager::GetInstance()->userEl2Key_.find(user) == KeyManager::GetInstance()->userEl2Key_.end());