modify review suggestion

Change-Id: I65968877cad11544bd71b46a41ea1c63b758657b
Signed-off-by: z00797421 <zhanyongtao@huawei.com>
This commit is contained in:
z00797421
2026-07-14 00:46:16 +08:00
parent 8b2bf84937
commit d1926e4e95
3 changed files with 9 additions and 10 deletions
@@ -938,6 +938,11 @@ enum {
*/
ERR_PRELOAD_NOT_ENTRY_MODULE = 2097368,
/**
* Result (2097369) for sa interceptor not found when unregister.
*/
ERR_SA_INTERCEPTOR_NOT_EXIST = 2097369,
/**
* Result (2097370-2097379) for StartUIAbilities Error.
*/
@@ -87,7 +87,7 @@ int32_t SAInterceptorManager::RemoveSAInterceptor(sptr<IRemoteObject> intercepto
}
}
TAG_LOGE(AAFwkTag::ABILITYMGR, "interceptor not found");
return ERR_OK;
return AAFwk::ERR_SA_INTERCEPTOR_NOT_EXIST;
}
bool SAInterceptorManager::SAInterceptorListIsEmpty()
@@ -87,22 +87,16 @@ HWTEST_F(SAInterceptorManagerTest, AddSAInterceptor_0100, TestSize.Level1)
/*
* @tc.number: RemoveSAInterceptor_0100
* @tc.name: RemoveSAInterceptor
* @tc.desc: Verify RemoveSAInterceptor with null interceptor and non-exist interceptor
* @tc.desc: Verify RemoveSAInterceptor with null interceptor
*/
HWTEST_F(SAInterceptorManagerTest, RemoveSAInterceptor_0100, TestSize.Level1)
{
SAInterceptorManager::GetInstance().saInterceptors_.clear();
int32_t result = SAInterceptorManager::GetInstance().RemoveSAInterceptor(nullptr);
EXPECT_EQ(result, ERR_NULL_SA_INTERCEPTOR_EXECUTER);
sptr<ISAInterceptor> interceptor = new MockSAInterceptor();
result = SAInterceptorManager::GetInstance().RemoveSAInterceptor(interceptor->AsObject());
sptr<IRemoteObject> remoteObj = new MockIRemoteObject();
result = SAInterceptorManager::GetInstance().RemoveSAInterceptor(remoteObj);
EXPECT_EQ(result, ERR_SA_INTERCEPTOR_NOT_EXIST);
result = SAInterceptorManager::GetInstance().AddSAInterceptor(interceptor);
EXPECT_EQ(result, ERR_OK);
EXPECT_EQ(SAInterceptorManager::GetInstance().saInterceptors_.size(), 1);
result = SAInterceptorManager::GetInstance().RemoveSAInterceptor(interceptor->AsObject());
EXPECT_EQ(result, ERR_OK);
EXPECT_EQ(SAInterceptorManager::GetInstance().saInterceptors_.size(), 0);
}
/*