From 9a6bd48f1455885ff6a0f4b091115165bf34c134 Mon Sep 17 00:00:00 2001 From: wuminjie Date: Fri, 10 Jan 2025 17:19:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E4=BE=8B=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuminjie --- .../src/system_ability_mgr_new_test.cpp | 63 ++----------------- .../src/system_ability_mgr_util_test.cpp | 32 ++-------- 2 files changed, 11 insertions(+), 84 deletions(-) diff --git a/services/samgr/native/test/unittest/src/system_ability_mgr_new_test.cpp b/services/samgr/native/test/unittest/src/system_ability_mgr_new_test.cpp index 7facca6b..c925ccb4 100644 --- a/services/samgr/native/test/unittest/src/system_ability_mgr_new_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_mgr_new_test.cpp @@ -492,56 +492,19 @@ HWTEST_F(SystemAbilityMgrTest, GetCommonEventExtraIdList001, TestSize.Level3) * @tc.require: I6NKWX */ HWTEST_F(SystemAbilityMgrTest, RemoveWhiteCommonEvent001, TestSize.Level3) -{ - sptr saMgr = new SystemAbilityManager; - InitSaMgr(saMgr); - saMgr->RemoveWhiteCommonEvent(); - EXPECT_TRUE(saMgr->collectManager_ != nullptr); -} - -/** - * @tc.name: CleanFfrt001 - * @tc.desc: test CleanFfrt, workHandler_ true. - * @tc.type: FUNC - * @tc.require: I6NKWX - */ -HWTEST_F(SystemAbilityMgrTest, CleanFfrt001, TestSize.Level3) { sptr saMgr = new SystemAbilityManager; saMgr->workHandler_ = make_shared("workHandler"); - int ret = true; saMgr->CleanFfrt(); - EXPECT_EQ(ret, true); -} - -/** - * @tc.name: CleanFfrt002 - * @tc.desc: test CleanFfrt, collectManager_ true. - * @tc.type: FUNC - * @tc.require: I6NKWX - */ -HWTEST_F(SystemAbilityMgrTest, CleanFfrt002, TestSize.Level3) -{ - sptr saMgr = new SystemAbilityManager; saMgr->collectManager_ = sptr(new DeviceStatusCollectManager()); - int ret = true; saMgr->CleanFfrt(); - EXPECT_EQ(ret, true); -} - -/** - * @tc.name: CleanFfrt003 - * @tc.desc: test CleanFfrt, abilityStateScheduler_ true. - * @tc.type: FUNC - * @tc.require: I6NKWX - */ -HWTEST_F(SystemAbilityMgrTest, CleanFfrt003, TestSize.Level3) -{ - sptr saMgr = new SystemAbilityManager; saMgr->abilityStateScheduler_ = std::make_shared(); - int ret = true; saMgr->CleanFfrt(); - EXPECT_EQ(ret, true); + InitSaMgr(saMgr); + const std::u16string name; + saMgr->NotifyRemoteSaDied(name); + saMgr->RemoveWhiteCommonEvent(); + EXPECT_TRUE(saMgr->collectManager_ != nullptr); } /** @@ -658,22 +621,6 @@ HWTEST_F(SystemAbilityMgrTest, RemoveSystemAbility005, TestSize.Level3) EXPECT_EQ(ret, ERR_INVALID_VALUE); } -/** - * @tc.name: NotifyRemoteSaDied002 - * @tc.desc: test NotifyRemoteSaDied, true. - * @tc.type: FUNC - * @tc.require: I6NKWX - */ -HWTEST_F(SystemAbilityMgrTest, NotifyRemoteSaDied002, TestSize.Level3) -{ - sptr saMgr = new SystemAbilityManager; - InitSaMgr(saMgr); - const std::u16string name; - int ret = true; - saMgr->NotifyRemoteSaDied(name); - EXPECT_EQ(ret, true); -} - /** * @tc.name: AddSystemAbility006 * @tc.desc: add system ability with empty capability. diff --git a/services/samgr/native/test/unittest/src/system_ability_mgr_util_test.cpp b/services/samgr/native/test/unittest/src/system_ability_mgr_util_test.cpp index 4b3c142a..574f77e9 100644 --- a/services/samgr/native/test/unittest/src/system_ability_mgr_util_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_mgr_util_test.cpp @@ -323,32 +323,6 @@ HWTEST_F(SamgrUtilTest, GetCacheCommonEventSa001, TestSize.Level3) EXPECT_EQ(saList.size(), 2); } -/** - * @tc.name: SetModuleUpdateParam001 - * @tc.desc: test SetModuleUpdateParam with key and value is null - * @tc.type: FUNC - * @tc.require: I6V4AX - */ -HWTEST_F(SamgrUtilTest, SetModuleUpdateParam001, TestSize.Level3) -{ - std::string key = ""; - std::string value = ""; - SamgrUtil::SetModuleUpdateParam(key, value); -} - -/** - * @tc.name: SetModuleUpdateParam002 - * @tc.desc: test SetModuleUpdateParam with key and value is not null - * @tc.type: FUNC - * @tc.require: I6V4AX - */ -HWTEST_F(SamgrUtilTest, SetModuleUpdateParam002, TestSize.Level3) -{ - std::string key = "key"; - std::string value = "value"; - SamgrUtil::SetModuleUpdateParam(key, value); -} - /** * @tc.name: SendUpdateSaState001 * @tc.desc: test SendUpdateSaState @@ -357,6 +331,12 @@ HWTEST_F(SamgrUtilTest, SetModuleUpdateParam002, TestSize.Level3) */ HWTEST_F(SamgrUtilTest, SendUpdateSaState001, TestSize.Level3) { + std::string key = ""; + std::string value = ""; + SamgrUtil::SetModuleUpdateParam(key, value); + std::string key_a = "key"; + std::string value_a = "value"; + SamgrUtil::SetModuleUpdateParam(key_a, value_a); sptr saMgr = new SystemAbilityManager; EXPECT_NE(saMgr, nullptr); InitSaMgr(saMgr); -- Gitee