From 897cbf48bead4e4f70cb671b10216a52d0573e35 Mon Sep 17 00:00:00 2001 From: li-li-wang Date: Tue, 25 Mar 2025 20:54:15 +0800 Subject: [PATCH] =?UTF-8?q?TDD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-li-wang --- .../test/unittest/src/sec_comp_kit_test.cpp | 5 ++-- .../unittest/src/sec_comp_manager_test.cpp | 24 ------------------- .../src/sec_comp_perm_manager_test.cpp | 7 +++++- 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/frameworks/inner_api/security_component/test/unittest/src/sec_comp_kit_test.cpp b/frameworks/inner_api/security_component/test/unittest/src/sec_comp_kit_test.cpp index 85f469e..ef69b65 100644 --- a/frameworks/inner_api/security_component/test/unittest/src/sec_comp_kit_test.cpp +++ b/frameworks/inner_api/security_component/test/unittest/src/sec_comp_kit_test.cpp @@ -120,7 +120,6 @@ HWTEST_F(SecCompKitTest, ExceptCall001, TestSize.Level1) int32_t scId = -1; std::string jsonStr = jsonRes.dump(); ASSERT_NE(SC_OK, SecCompKit::RegisterSecurityComponent(LOCATION_COMPONENT, jsonStr, scId)); - ASSERT_EQ(-1, scId); ASSERT_NE(SC_OK, SecCompKit::UpdateSecurityComponent(scId, jsonStr)); struct SecCompClickEvent touch = { @@ -137,7 +136,7 @@ HWTEST_F(SecCompKitTest, ExceptCall001, TestSize.Level1) } /** - * @tc.name: ExceptCall001 + * @tc.name: TestCallerCheck001 * @tc.desc: test caller check. * @tc.type: FUNC * @tc.require: AR000HO9JS @@ -162,7 +161,7 @@ HWTEST_F(SecCompKitTest, TestCallerCheck001, TestSize.Level1) } /** - * @tc.name: ExceptCall002 + * @tc.name: TestCallerCheck002 * @tc.desc: test invalid caller register. * @tc.type: FUNC * @tc.require: AR000HO9JS diff --git a/services/security_component_service/sa/test/unittest/src/sec_comp_manager_test.cpp b/services/security_component_service/sa/test/unittest/src/sec_comp_manager_test.cpp index e061d8c..845a801 100644 --- a/services/security_component_service/sa/test/unittest/src/sec_comp_manager_test.cpp +++ b/services/security_component_service/sa/test/unittest/src/sec_comp_manager_test.cpp @@ -695,30 +695,6 @@ HWTEST_F(SecCompManagerTest, DumpSecComp001, TestSize.Level1) SecCompManager::GetInstance().DumpSecComp(dumpStr); } -/** - * @tc.name: TransformCallBackResult001 - * @tc.desc: Test check TransformCallBackResult - * @tc.type: FUNC - * @tc.require: AR000HO9J7 - */ -HWTEST_F(SecCompManagerTest, TransformCallBackResult001, TestSize.Level1) -{ - int32_t scId = INVALID_SC_ID; - const std::string scene = "REGISTER"; - int32_t res = SC_ENHANCE_ERROR_NOT_EXIST_ENHANCE; - SecCompManager::GetInstance().SendCheckInfoEnhanceSysEvent(scId, LOCATION_COMPONENT, scene, res); - res = SC_ENHANCE_ERROR_VALUE_INVALID; - SecCompManager::GetInstance().SendCheckInfoEnhanceSysEvent(scId, LOCATION_COMPONENT, scene, res); - res = SC_ENHANCE_ERROR_CALLBACK_OPER_FAIL; - SecCompManager::GetInstance().SendCheckInfoEnhanceSysEvent(scId, LOCATION_COMPONENT, scene, res); - res = SC_SERVICE_ERROR_COMPONENT_INFO_INVALID; - SecCompManager::GetInstance().SendCheckInfoEnhanceSysEvent(scId, LOCATION_COMPONENT, scene, res); - res = SC_ENHANCE_ERROR_CALLBACK_CHECK_FAIL; - SecCompManager::GetInstance().SendCheckInfoEnhanceSysEvent(scId, LOCATION_COMPONENT, scene, res); - res = SC_SERVICE_ERROR_VALUE_INVALID; - SecCompManager::GetInstance().SendCheckInfoEnhanceSysEvent(scId, LOCATION_COMPONENT, scene, res); -} - /** * @tc.name: AddSecurityComponentProcess001 * @tc.desc: Test AddSecurityComponentProcess diff --git a/services/security_component_service/sa/test/unittest/src/sec_comp_perm_manager_test.cpp b/services/security_component_service/sa/test/unittest/src/sec_comp_perm_manager_test.cpp index bf2a052..5efee23 100644 --- a/services/security_component_service/sa/test/unittest/src/sec_comp_perm_manager_test.cpp +++ b/services/security_component_service/sa/test/unittest/src/sec_comp_perm_manager_test.cpp @@ -100,7 +100,12 @@ HWTEST_F(SecCompPermManagerTest, RevokeTempSavePermissionCount001, TestSize.Leve permMgr.applySaveCountMap_[id] = 1; permMgr.RevokeTempSavePermissionCount(static_cast(0)); - ASSERT_EQ(permMgr.applySaveCountMap_[id], 1); + permMgr.saveTaskDequeMap_[id].push_back("test"); + permMgr.RevokeTempSavePermissionCount(static_cast(0)); + + permMgr.secHandler_ = std::make_shared(nullptr); + permMgr.RevokeTempSavePermissionCount(static_cast(0)); + ASSERT_EQ(permMgr.applySaveCountMap_[id], 0); } /** -- Gitee