From 0f802065256387e1b40209503ee079947e4f31f1 Mon Sep 17 00:00:00 2001 From: xinking129 Date: Tue, 16 Jan 2024 11:25:45 +0800 Subject: [PATCH 1/5] BmsTddChange Signed-off-by: xinking129 --- .../bms_bundle_get_window_properties_test.cpp | 15 +-- .../bms_bundle_kit_service_test.cpp | 103 ++++++------------ .../bms_bundle_manager_test.cpp | 64 +---------- .../bms_bundle_permission_system_app_test.cpp | 17 +-- ...bms_bundle_quick_fix_boot_scanner_test.cpp | 61 +---------- .../bms_bundle_quick_fix_mgr_rdb_test.cpp | 18 +-- .../bms_bundle_quick_fix_test.cpp | 51 +-------- .../bms_install_daemon_test.cpp | 14 +-- .../bms_patch_parser_test.cpp | 3 +- .../bms_rdb_data_manager_test.cpp | 4 +- 10 files changed, 52 insertions(+), 298 deletions(-) diff --git a/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_get_window_properties_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_get_window_properties_test.cpp index 80dfb2cdf8..41e871a9ed 100755 --- a/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_get_window_properties_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_get_window_properties_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -416,19 +416,6 @@ HWTEST_F(BmsBundleGetWindowPropertiesTest, GetWindowProperties_1400, Function | CheckWindowProperty2(ABILITY_NAME_TEST, vec); } -/** - * @tc.number: GetWindowProperties_1500 - * @tc.name: test can get the window property of orientation - * @tc.desc: 1.install bundle successfully - * 2.get ability info successfully - * 3.supportWindowMode equals to default value - */ -HWTEST_F(BmsBundleGetWindowPropertiesTest, GetWindowProperties_1500, Function | SmallTest | Level1) -{ - std::vector vec {0, 1, 2}; - CheckWindowProperty2(ABILITY_NAME_TEST, vec); -} - /** * @tc.number: GetWindowProperties_1600 * @tc.name: test can get the window property of orientation diff --git a/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp index c4de46fa1f..22f233cbcc 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -1754,9 +1754,12 @@ HWTEST_F(BmsBundleKitServiceTest, GetAbilityLabel_0100, Function | SmallTest | L MockInstallBundle(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST); std::string testRet; ErrCode ret = GetBundleDataMgr()->GetAbilityLabel(BUNDLE_NAME_TEST, EMPTY_STRING, ABILITY_NAME_TEST, testRet); +#ifdef GLOBAL_RESMGR_ENABLE EXPECT_EQ(0, ret); EXPECT_EQ(LABEL, testRet); - +#else + EXPECT_EQ(ERR_BUNDLE_MANAGER_GLOBAL_RES_MGR_ENABLE_DISABLED, ret); +#endif MockUninstallBundle(BUNDLE_NAME_TEST); } @@ -1770,8 +1773,12 @@ HWTEST_F(BmsBundleKitServiceTest, GetAbilityLabel_0200, Function | SmallTest | L { std::string testRet; ErrCode ret = GetBundleDataMgr()->GetAbilityLabel(BUNDLE_NAME_TEST, EMPTY_STRING, ABILITY_NAME_TEST, testRet); +#ifdef GLOBAL_RESMGR_ENABLE EXPECT_NE(0, ret); EXPECT_EQ(EMPTY_STRING, testRet); +#else + EXPECT_EQ(ERR_BUNDLE_MANAGER_GLOBAL_RES_MGR_ENABLE_DISABLED, ret); +#endif } /** @@ -1785,9 +1792,12 @@ HWTEST_F(BmsBundleKitServiceTest, GetAbilityLabel_0300, Function | SmallTest | L MockInstallBundle(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST); std::string testRet; ErrCode ret = GetBundleDataMgr()->GetAbilityLabel(BUNDLE_NAME_DEMO, EMPTY_STRING, ABILITY_NAME_TEST, testRet); +#ifdef GLOBAL_RESMGR_ENABLE EXPECT_NE(0, ret); EXPECT_EQ(EMPTY_STRING, testRet); - +#else + EXPECT_EQ(ERR_BUNDLE_MANAGER_GLOBAL_RES_MGR_ENABLE_DISABLED, ret); +#endif MockUninstallBundle(BUNDLE_NAME_TEST); } @@ -1802,9 +1812,12 @@ HWTEST_F(BmsBundleKitServiceTest, GetAbilityLabel_0400, Function | SmallTest | L MockInstallBundle(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST); std::string testRet; ErrCode ret = GetBundleDataMgr()->GetAbilityLabel(BUNDLE_NAME_TEST, EMPTY_STRING, ABILITY_NAME_DEMO, testRet); +#ifdef GLOBAL_RESMGR_ENABLE#ifdef GLOBAL_RESMGR_ENABLE EXPECT_NE(0, ret); EXPECT_EQ(EMPTY_STRING, testRet); - +#else + EXPECT_EQ(ERR_BUNDLE_MANAGER_GLOBAL_RES_MGR_ENABLE_DISABLED, ret); +#endif MockUninstallBundle(BUNDLE_NAME_TEST); } @@ -1819,9 +1832,12 @@ HWTEST_F(BmsBundleKitServiceTest, GetAbilityLabel_0500, Function | SmallTest | L MockInstallBundle(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST); std::string testRet; ErrCode ret = GetBundleDataMgr()->GetAbilityLabel(BUNDLE_NAME_TEST, MODULE_NAME_TEST_1, ABILITY_NAME_TEST, testRet); +#ifdef GLOBAL_RESMGR_ENABLE EXPECT_NE(0, ret); EXPECT_EQ(EMPTY_STRING, testRet); - +#else + EXPECT_EQ(ERR_BUNDLE_MANAGER_GLOBAL_RES_MGR_ENABLE_DISABLED, ret); +#endif MockUninstallBundle(BUNDLE_NAME_TEST); } @@ -1836,9 +1852,12 @@ HWTEST_F(BmsBundleKitServiceTest, GetAbilityLabel_0600, Function | SmallTest | L MockInstallBundle(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST); std::string testRet; ErrCode ret = GetBundleDataMgr()->GetAbilityLabel(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST, testRet); +#ifdef GLOBAL_RESMGR_ENABLE EXPECT_EQ(0, ret); EXPECT_EQ(LABEL, testRet); - +#else + EXPECT_EQ(ERR_BUNDLE_MANAGER_GLOBAL_RES_MGR_ENABLE_DISABLED, ret); +#endif MockUninstallBundle(BUNDLE_NAME_TEST); } @@ -1853,9 +1872,12 @@ HWTEST_F(BmsBundleKitServiceTest, GetAbilityLabel_0700, Function | SmallTest | L MockInstallBundle(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST); std::string testRet; ErrCode ret = GetBundleDataMgr()->GetAbilityLabel(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_DEMO, testRet); +#ifdef GLOBAL_RESMGR_ENABLE EXPECT_NE(0, ret); EXPECT_EQ(EMPTY_STRING, testRet); - +#else + EXPECT_EQ(ERR_BUNDLE_MANAGER_GLOBAL_RES_MGR_ENABLE_DISABLED, ret); +#endif MockUninstallBundle(BUNDLE_NAME_TEST); } @@ -2415,7 +2437,7 @@ HWTEST_F(BmsBundleKitServiceTest, GetBundleNameForUid_0100, Function | SmallTest std::string testResult; bool testRet = GetBundleDataMgr()->GetBundleNameForUid(TEST_UID, testResult); EXPECT_FALSE(testRet); - + EXPECT_NE(BUNDLE_NAME_TEST, testResult); MockUninstallBundle(BUNDLE_NAME_TEST); } @@ -2484,7 +2506,7 @@ HWTEST_F(BmsBundleKitServiceTest, GetBundleNameForUid_0500, Function | SmallTest BundleInfo bundleInfo; bool testRet = hostImpl->GetBundleInfoForSelf(BundleFlag::GET_BUNDLE_WITH_ABILITIES, bundleInfo); EXPECT_TRUE(testRet); - + EXPECT_EQ(bundleInfo.name, ""); MockUninstallBundle(BUNDLE_NAME_TEST); } @@ -2500,7 +2522,7 @@ HWTEST_F(BmsBundleKitServiceTest, GetBundleNameForUid_0600, Function | SmallTest std::string testResult; bool testRet = GetBundleDataMgr()->GetBundleNameForUid(TEST_UID, testResult); EXPECT_FALSE(testRet); - + EXPECT_NE(testResult, BUNDLE_NAME_TEST); auto hostImpl = std::make_unique(); bool result = hostImpl->VerifyQueryPermission(testResult); EXPECT_TRUE(result); @@ -2884,25 +2906,6 @@ HWTEST_F(BmsBundleKitServiceTest, QueryAbilityInfoByUri_0800, Function | SmallTe MockUninstallBundle(BUNDLE_NAME_TEST); } -/** - * @tc.number: QueryAbilityInfoByUri_0900 - * @tc.name: test can get the ability info by uri - * @tc.desc: 1.system run normally - * 2.get ability info failed by empty ability uri - */ -HWTEST_F(BmsBundleKitServiceTest, QueryAbilityInfoByUri_0900, Function | SmallTest | Level1) -{ - MockInstallBundle(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST); - - AbilityInfo result; - auto hostImpl = std::make_unique(); - bool testRet = hostImpl->QueryAbilityInfoByUri( - ABILITY_URI, DEFAULT_USERID, result); - EXPECT_EQ(true, testRet); - - MockUninstallBundle(BUNDLE_NAME_TEST); -} - /** * @tc.number: QueryAbilityInfosByUri_0100 * @tc.name: test QueryAbilityInfosByUri by BundleMgrHostImpl @@ -3582,26 +3585,6 @@ HWTEST_F(BmsBundleKitServiceTest, CleanBundleDataFiles_0500, Function | SmallTes MockUninstallBundle(BUNDLE_NAME_TEST); } -/** - * @tc.number: CleanBundleDataFiles_0600 - * @tc.name: test can clean the bundle data files by bundle name - * @tc.desc: 1.system run normally - * 2.clean the bundle data files successfully - */ -HWTEST_F(BmsBundleKitServiceTest, CleanBundleDataFiles_0600, Function | SmallTest | Level1) -{ - MockInstallBundle(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST); - CreateFileDir(); - - auto hostImpl = std::make_unique(); - bool testRet = hostImpl->CleanBundleDataFiles(BUNDLE_NAME_TEST, DEFAULT_USERID); - EXPECT_TRUE(testRet); - - CleanFileDir(); - CheckFileNonExist(); - MockUninstallBundle(BUNDLE_NAME_TEST); -} - /** * @tc.number: CleanBundleDataFiles_0700 * @tc.name: test can clean the bundle data files by bundle name @@ -4354,26 +4337,6 @@ HWTEST_F(BmsBundleKitServiceTest, CheckAbilityEnabled_1200, Function | SmallTest MockUninstallBundle(BUNDLE_NAME_TEST); } -/** - * @tc.number: CheckAbilityEnabled_1300 - * @tc.name: test can check ability status is disable by empty AbilityInfo - * @tc.desc: 1.system run normally - * 2.check the ability status failed - */ -HWTEST_F(BmsBundleKitServiceTest, CheckAbilityEnabled_1300, Function | SmallTest | Level1) -{ - MockInstallBundle(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST); - AbilityInfo abilityInfo = MockAbilityInfo(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST); - int32_t testRet = GetBundleDataMgr()->SetAbilityEnabled(abilityInfo, true, Constants::DEFAULT_USERID); - EXPECT_EQ(0, testRet); - AbilityInfo abilityInfoEmpty; - bool isEnable = false; - int32_t testRet1 = GetBundleDataMgr()->IsAbilityEnabled(abilityInfoEmpty, isEnable); - EXPECT_NE(0, testRet1); - - MockUninstallBundle(BUNDLE_NAME_TEST); -} - /** * @tc.number: CheckAbilityEnabled_1400 * @tc.name: test can check ability status is disable by empty AbilityInfo @@ -7967,7 +7930,7 @@ HWTEST_F(BmsBundleKitServiceTest, AnalyzeUserData_0001, Function | SmallTest | L /** * @tc.number: AnalyzeUserData_0002 * @tc.name: test AnalyzeUserData - * @tc.desc: AnalyzeUserData is true + * @tc.desc: AnalyzeUserData is false */ HWTEST_F(BmsBundleKitServiceTest, AnalyzeUserData_0002, Function | SmallTest | Level0) { diff --git a/services/bundlemgr/test/unittest/bms_bundle_manager_test/bms_bundle_manager_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_manager_test/bms_bundle_manager_test.cpp index 92c3cae376..e788c6e2aa 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_manager_test/bms_bundle_manager_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_manager_test/bms_bundle_manager_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -440,21 +440,6 @@ HWTEST_F(BmsBundleManagerTest, BundleStreamInstallerHostImpl_0700, Function | Sm EXPECT_FALSE(ret); } -/** - * @tc.number: BundleStreamInstallerHostImpl_0800 - * @tc.name: test CreateStream - * @tc.desc: 1.system run normally -*/ -HWTEST_F(BmsBundleManagerTest, BundleStreamInstallerHostImpl_0800, Function | SmallTest | Level0) -{ - uint32_t installerId = 1; - int32_t installedUid = 100; - BundleStreamInstallerHostImpl impl(installerId, installedUid); - std::string hapName = BUNDLE_NAME; - auto ret = impl.CreateStream(hapName); - EXPECT_NE(ret, ERR_OK); -} - /** * @tc.number: BundleStreamInstallerHostImpl_0900 * @tc.name: test CreateStream @@ -1483,23 +1468,6 @@ HWTEST_F(BmsBundleManagerTest, bundleInfosFalse_0007, Function | SmallTest | Lev EXPECT_EQ(GetBundleDataMgr()->bundleInfos_.empty(), true); } -/** - * @tc.number: bundleInfosFalse_0008 - * @tc.name: test GetBundleInfosByMetaData - * @tc.desc: 1.system run normally - * 2.bundleInfos is empty -*/ -HWTEST_F(BmsBundleManagerTest, bundleInfosFalse_0008, Function | SmallTest | Level1) -{ - std::vector Info; - std::string metaData = "data/test"; - GetBundleDataMgr()->bundleInfos_.clear(); - bool testRet = GetBundleDataMgr()->GetBundleInfosByMetaData( - metaData, Info); - EXPECT_EQ(testRet, false); - EXPECT_EQ(GetBundleDataMgr()->bundleInfos_.empty(), true); -} - /** * @tc.number: bundleInfosFalse_0009 * @tc.name: test ImplicitQueryAbilityInfosV9 @@ -1747,22 +1715,6 @@ HWTEST_F(BmsBundleManagerTest, bundleInfosFalse_0023, Function | SmallTest | Lev EXPECT_EQ(GetBundleDataMgr()->bundleInfos_.empty(), true); } -/** - * @tc.number: bundleInfosFalse_0024 - * @tc.name: test GetFormsInfoByApp - * @tc.desc: 1.system run normally - * 2.bundleInfos is empty -*/ -HWTEST_F(BmsBundleManagerTest, bundleInfosFalse_0024, Function | SmallTest | Level1) -{ - std::vector formInfos; - GetBundleDataMgr()->bundleInfos_.clear(); - bool testRet = GetBundleDataMgr()->GetFormsInfoByApp( - TEST_BUNDLE_NAME, formInfos); - EXPECT_EQ(testRet, false); - EXPECT_EQ(GetBundleDataMgr()->bundleInfos_.empty(), true); -} - /** * @tc.number: bundleInfosFalse_0025 * @tc.name: test GetInnerBundleUserInfos @@ -3057,18 +3009,6 @@ HWTEST_F(BmsBundleManagerTest, TestMgrByUserId_0008, Function | SmallTest | Leve EXPECT_EQ(res, false); } -/** - * @tc.number: TestMgrByUserId_0009 - * @tc.name: test GetInnerBundleUserInfos - * @tc.desc: 1.system run normally -*/ -HWTEST_F(BmsBundleManagerTest, TestMgrByUserId_0009, Function | SmallTest | Level1) -{ - std::vector innerBundleUserInfos; - bool res = GetBundleDataMgr()->GetInnerBundleUserInfos("", innerBundleUserInfos); - EXPECT_EQ(res, false); -} - /** * @tc.number: TestMgrByUserId_0010 * @tc.name: test ImplicitQueryExtensionInfosV9 @@ -3126,8 +3066,6 @@ HWTEST_F(BmsBundleManagerTest, TestMgrByUserId_0012, Function | SmallTest | Leve InnerBundleInfo innerBundleInfo; bool res = GetBundleDataMgr()->FetchInnerBundleInfo("", innerBundleInfo); EXPECT_EQ(res, false); - res = GetBundleDataMgr()->FetchInnerBundleInfo("", innerBundleInfo); - EXPECT_EQ(res, false); } /** diff --git a/services/bundlemgr/test/unittest/bms_bundle_permission_grant_test/bms_bundle_permission_system_app_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_permission_grant_test/bms_bundle_permission_system_app_test.cpp index 0a1d63ee6c..01306b590a 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_permission_grant_test/bms_bundle_permission_system_app_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_permission_grant_test/bms_bundle_permission_system_app_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -536,21 +536,6 @@ HWTEST_F(BmsBundlePermissionSyetemAppFalseTest, BmsBundleSyetemAppFalseTest_3200 EXPECT_EQ(ret, true); } -/** - * @tc.number: BmsBundleSyetemAppFalseTest_3300 - * @tc.name: test QueryExtensionAbilityInfos of BundleMgrHostImpl - * @tc.desc: 1. system running normally - * 2. QueryExtensionAbilityInfos false by no permission - */ -HWTEST_F(BmsBundlePermissionSyetemAppFalseTest, BmsBundleSyetemAppFalseTest_3300, Function | SmallTest | Level0) -{ - Want want; - std::vector extensionInfos; - bool ret = bundleMgrHostImpl_->QueryExtensionAbilityInfos( - want, ExtensionAbilityType::FORM, FLAGS, USERID, extensionInfos); - EXPECT_EQ(ret, true); -} - /** * @tc.number: BmsBundleSyetemAppFalseTest_3400 * @tc.name: test QueryExtensionAbilityInfos of BundleMgrHostImpl diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_boot_scanner_test/bms_bundle_quick_fix_boot_scanner_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_boot_scanner_test/bms_bundle_quick_fix_boot_scanner_test.cpp index 9534c08e96..fd2b644a2e 100755 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_boot_scanner_test/bms_bundle_quick_fix_boot_scanner_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_boot_scanner_test/bms_bundle_quick_fix_boot_scanner_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -619,26 +619,6 @@ HWTEST_F(BmsBundleQuickFixBootScannerTest, BmsBundleQuickFixBootScannerTest_1005 DeleteInnerAppQuickFix(BUNDLE_NAME); } -/** - * @tc.number: BmsBundleQuickFixBootScannerTest_1006 - * @tc.name: test QuickFixBootScanner - * @tc.desc: 1. quick fix database not empty - * 2. SWITCH_DISABLE_START - * @tc.require: issueI5MZ6Z - */ -HWTEST_F(BmsBundleQuickFixBootScannerTest, BmsBundleQuickFixBootScannerTest_1006, Function | SmallTest | Level0) -{ - InnerAppQuickFix innerAppQuickFix = GenerateAppQuickFixInfo(BUNDLE_NAME, QuickFixStatus::SWITCH_DISABLE_START); - AddInnerAppQuickFix(innerAppQuickFix); - auto scanner = DelayedSingleton::GetInstance(); - EXPECT_FALSE(scanner == nullptr); - if (scanner != nullptr) { - scanner->ProcessQuickFixBootUp(); - EXPECT_EQ(scanner->state_, nullptr); - } - DeleteInnerAppQuickFix(BUNDLE_NAME); -} - /** * @tc.number: BmsBundleQuickFixBootScannerTest_1007 * @tc.name: test QuickFixBootScanner @@ -716,29 +696,6 @@ HWTEST_F(BmsBundleQuickFixBootScannerTest, BmsBundleQuickFixBootScannerTest_1010 DeleteQuickFileDir(); } -/** - * @tc.number: BmsBundleQuickFixBootScannerTest_1011 - * @tc.name: test RestoreQuickFix - * @tc.desc: 1. RestoreQuickFix, file patch exist - * @tc.require: issueI5MZ6Z - */ -HWTEST_F(BmsBundleQuickFixBootScannerTest, BmsBundleQuickFixBootScannerTest_1011, Function | SmallTest | Level0) -{ - auto ret = InstallBundle(BUNDLE_PATH); - EXPECT_EQ(ret, ERR_OK) << "Install bundle failed"; - CreateQuickFileDir(); - - auto scanner = DelayedSingleton::GetInstance(); - EXPECT_FALSE(scanner == nullptr); - if (scanner != nullptr) { - scanner->RestoreQuickFix(); - EXPECT_EQ(scanner->state_, nullptr); - EXPECT_FALSE(scanner->quickFixInfoMap_.empty()); - } - ret = UninstallBundle(BUNDLE_NAME); - EXPECT_EQ(ret, ERR_OK) << "Uninstall bundle com.example.l3jsdemo failed"; -} - /** * @tc.number: BmsBundleQuickFixBootScannerTest_1012 * @tc.name: test RestoreQuickFix @@ -845,22 +802,6 @@ HWTEST_F(BmsBundleQuickFixBootScannerTest, BmsBundleQuickFixBootScannerTest_1016 } } -/** - * @tc.number: BmsBundleQuickFixBootScannerTest_1017 - * @tc.name: test ReprocessQuickFix - * @tc.desc: 1. ReprocessQuickFix, invalid path - * @tc.require: issueI5MZ6Z - */ -HWTEST_F(BmsBundleQuickFixBootScannerTest, BmsBundleQuickFixBootScannerTest_1017, Function | SmallTest | Level0) -{ - auto scanner = DelayedSingleton::GetInstance(); - EXPECT_FALSE(scanner == nullptr); - if (scanner != nullptr) { - auto ret = scanner->ReprocessQuickFix("", ""); - EXPECT_FALSE(ret); - } -} - /** * @tc.number: BmsBundleQuickFixBootScannerTest_1018 * @tc.name: test ReprocessQuickFix diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_mgr_rdb_test/bms_bundle_quick_fix_mgr_rdb_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_mgr_rdb_test/bms_bundle_quick_fix_mgr_rdb_test.cpp index cdab155abc..8d590c6c4a 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_mgr_rdb_test/bms_bundle_quick_fix_mgr_rdb_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_mgr_rdb_test/bms_bundle_quick_fix_mgr_rdb_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -334,22 +334,6 @@ HWTEST_F(BmsBundleQuickFixMgrRdbTest, BmsBundleQuickFixMgrRdbTest_0006, Function EXPECT_FALSE(result); } -/** - * @tc.number: BmsBundleQuickFixMgrRdbTest_0007 - * @tc.name: QueryAllInnerAppQuickFix - * @tc.desc: rdbDataManager_ is nullptr, verify QueryAllInnerAppQuickFix failed. - */ -HWTEST_F(BmsBundleQuickFixMgrRdbTest, BmsBundleQuickFixMgrRdbTest_0007, Function | SmallTest | Level0) -{ - auto rdb = std::make_shared(); - EXPECT_TRUE(rdb->rdbDataManager_ != nullptr); - - rdb->rdbDataManager_ = nullptr; - std::map innerQuickFixInfos; - auto result = rdb->QueryAllInnerAppQuickFix(innerQuickFixInfos); - EXPECT_FALSE(result); -} - /** * @tc.number: BmsBundleQuickFixMgrRdbTest_0008 * @tc.name: QueryInnerAppQuickFix diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp index 68c9b413d9..ec604b8e21 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -672,31 +672,6 @@ HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0012, Function | SmallTest EXPECT_EQ(unInstallResult, ERR_OK); } -/** - * @tc.number: BmsBundleQuickFixTest_0013 - * Function: GetBundleInfo - * @tc.name: test GetBundleInfo - * @tc.require: issueI5N7AD - * @tc.desc: GetBundleInfo - */ -HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0013, Function | SmallTest | Level0) -{ - ErrCode installResult = InstallBundle(HAP_FILE_PATH1); - EXPECT_EQ(installResult, ERR_OK); - - auto deployer = GetQuickFixDeployer(); - EXPECT_FALSE(deployer == nullptr); - if (deployer != nullptr) { - AppQuickFix appQuickFix = CreateAppQuickFix(); - BundleInfo bundleInfo; - ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo); - EXPECT_EQ(ret, ERR_OK); - } - - ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME); - EXPECT_EQ(unInstallResult, ERR_OK); -} - /** * @tc.number: BmsBundleQuickFixTest_0014 * Function: CheckCommonWithInstalledBundle @@ -1877,27 +1852,6 @@ HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0063, Function | SmallTest EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SO_INCOMPATIBLE); } -/** - * @tc.number: BmsBundleQuickFixTest_0064 - * Function: CheckMultiNativeSo - * @tc.name: test CheckMultiNativeSo - * @tc.require: issueI5N7AD - * @tc.desc: nativeLibraryPath - */ -HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0064, Function | SmallTest | Level0) -{ - std::unordered_map infos; - AppQuickFix appQuickFix = CreateAppQuickFix(); - appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH; - infos.emplace("appQuickFix_1", appQuickFix); - appQuickFix.deployingAppqfInfo.nativeLibraryPath = "wrong"; - infos.emplace("appQuickFix_2", appQuickFix); - - QuickFixChecker checker; - auto ret = checker.CheckMultiNativeSo(infos); - EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SO_INCOMPATIBLE); -} - /** * @tc.number: BmsBundleQuickFixTest_0065 * Function: CheckMultiNativeSo @@ -2970,9 +2924,12 @@ HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0200, Function | SmallTest EXPECT_FALSE(deleter == nullptr); if (deleter != nullptr) { AppqfInfo deployedAppqfInfo; + HqfInfo hqfInfo; + deployedAppqfInfo.hqfInfos.emplace_back(hqfInfo); deployedAppqfInfo.type = QuickFixType::UNKNOWN; ErrCode ret = deleter->InnerDeletePatchDir(deployedAppqfInfo, BUNDLE_NAME); EXPECT_EQ(ret, ERR_OK); + EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_UNKNOWN_QUICK_FIX_TYPE); } } diff --git a/services/bundlemgr/test/unittest/bms_install_daemon_test/bms_install_daemon_test.cpp b/services/bundlemgr/test/unittest/bms_install_daemon_test/bms_install_daemon_test.cpp index 19f2f7c089..6f8a785bec 100644 --- a/services/bundlemgr/test/unittest/bms_install_daemon_test/bms_install_daemon_test.cpp +++ b/services/bundlemgr/test/unittest/bms_install_daemon_test/bms_install_daemon_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -460,7 +460,7 @@ HWTEST_F(BmsInstallDaemonTest, BundleDataDir_0500, Function | SmallTest | Level0 } /** - * @tc.number: BundleDataDir_0500 + * @tc.number: BundleDataDir_0600 * @tc.name: test the create and remove bundle data dir function of installd service * @tc.desc: 1. the service is already initialized and the code dir is system dir * 2. the bundle data dir of the system dir can't be created @@ -475,10 +475,10 @@ HWTEST_F(BmsInstallDaemonTest, BundleDataDir_0600, Function | SmallTest | Level0 /** * @tc.number: BundleDataDir_0700 - * @tc.name: test the create and remove bundle data dir function of installd service - * @tc.desc: 1. the service is already initialized and the code dir is illegal - * 2. the bundle data dir of the illegal code dir can't be created -*/ + * @tc.name: test the RemoveBundleDataDir function + * @tc.desc: 1. bundleName is empty + * 2. userid = -1 + */ HWTEST_F(BmsInstallDaemonTest, BundleDataDir_0700, Function | SmallTest | Level0) { int result = CreateBundleDataDir(BUNDLE_NAME13, USERID, UID, GID, APL); @@ -872,7 +872,7 @@ HWTEST_F(BmsInstallDaemonTest, GetBundleStats_0400, Function | SmallTest | Level /** * @tc.number: ExtractFiles_0100 * @tc.name: test the ExtractFiles - * @tc.desc: 1. extract files success + * @tc.desc: 1. extract files fail */ HWTEST_F(BmsInstallDaemonTest, ExtractFiles_0100, Function | SmallTest | Level0) { diff --git a/services/bundlemgr/test/unittest/bms_patch_parser_test/bms_patch_parser_test.cpp b/services/bundlemgr/test/unittest/bms_patch_parser_test/bms_patch_parser_test.cpp index 9eb83020eb..81ccde65c1 100644 --- a/services/bundlemgr/test/unittest/bms_patch_parser_test/bms_patch_parser_test.cpp +++ b/services/bundlemgr/test/unittest/bms_patch_parser_test/bms_patch_parser_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -392,7 +392,6 @@ HWTEST_F(BmsPatchParserTest, TestParse_0017, Function | SmallTest | Level0) * @tc.name: parse patch package by patch.json * @tc.require: issueI5MZ7R * @tc.desc: 1. system running normally - * 2. test parse patch failed when versionName is not a string */ HWTEST_F(BmsPatchParserTest, TestParse_0018, Function | SmallTest | Level0) { diff --git a/services/bundlemgr/test/unittest/bms_rdb_data_manager_test/bms_rdb_data_manager_test.cpp b/services/bundlemgr/test/unittest/bms_rdb_data_manager_test/bms_rdb_data_manager_test.cpp index 0a1a14bcb6..c6df8d80b3 100755 --- a/services/bundlemgr/test/unittest/bms_rdb_data_manager_test/bms_rdb_data_manager_test.cpp +++ b/services/bundlemgr/test/unittest/bms_rdb_data_manager_test/bms_rdb_data_manager_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -354,7 +354,7 @@ HWTEST_F(BmsRdbDataManagerTest, DefaultAppRdb_0400, Function | SmallTest | Level } /** - * @tc.number: DefaultAppRdb_0600 + * @tc.number: DefaultAppRdb_0500 * @tc.name: save get and delete * @tc.desc: 1.SetDefaultApplicationInfo * 2.GetDefaultApplicationInfo -- Gitee From c267e9a34351733703018acdbfef78fafb4d02a6 Mon Sep 17 00:00:00 2001 From: xinking129 Date: Tue, 16 Jan 2024 14:07:45 +0800 Subject: [PATCH 2/5] fix code Signed-off-by: xinking129 --- .../bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp index 22f233cbcc..873d98a99b 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp @@ -1812,7 +1812,7 @@ HWTEST_F(BmsBundleKitServiceTest, GetAbilityLabel_0400, Function | SmallTest | L MockInstallBundle(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST); std::string testRet; ErrCode ret = GetBundleDataMgr()->GetAbilityLabel(BUNDLE_NAME_TEST, EMPTY_STRING, ABILITY_NAME_DEMO, testRet); -#ifdef GLOBAL_RESMGR_ENABLE#ifdef GLOBAL_RESMGR_ENABLE +#ifdef GLOBAL_RESMGR_ENABLE EXPECT_NE(0, ret); EXPECT_EQ(EMPTY_STRING, testRet); #else -- Gitee From 057075a48f783cea11d94c5412b16d63bdab10aa Mon Sep 17 00:00:00 2001 From: xinking129 Date: Tue, 16 Jan 2024 14:17:11 +0800 Subject: [PATCH 3/5] fix code Signed-off-by: xinking129 --- .../bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp index ec604b8e21..37013d8d97 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp @@ -1385,6 +1385,9 @@ HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0041, Function | SmallTest if (deleter != nullptr) { ErrCode ret = deleter->RemoveDeployingInfo(BUNDLE_NAME); EXPECT_EQ(ret, ERR_OK); + ErrCode res = deleter->RemoveDeployingInfo(""); + EXPECT_EQ(res, ERR_OK); + } } @@ -2928,7 +2931,6 @@ HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0200, Function | SmallTest deployedAppqfInfo.hqfInfos.emplace_back(hqfInfo); deployedAppqfInfo.type = QuickFixType::UNKNOWN; ErrCode ret = deleter->InnerDeletePatchDir(deployedAppqfInfo, BUNDLE_NAME); - EXPECT_EQ(ret, ERR_OK); EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_UNKNOWN_QUICK_FIX_TYPE); } } -- Gitee From 26a90917dfc6ea63949e3549ba52321d597619c0 Mon Sep 17 00:00:00 2001 From: xinking129 Date: Sat, 2 Mar 2024 15:13:02 +0800 Subject: [PATCH 4/5] delete fuc Signed-off-by: xinking129 --- .../bms_bundle_kit_service_test.cpp | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp index 9d906f0a8b..009854a6f5 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_kit_service_test/bms_bundle_kit_service_test.cpp @@ -2515,26 +2515,6 @@ HWTEST_F(BmsBundleKitServiceTest, GetBundleNameForUid_0500, Function | SmallTest MockUninstallBundle(BUNDLE_NAME_TEST); } -/** - * @tc.number: GetBundleNameForUid_0600 - * @tc.name: test can get the bundle names with bundle installed - * @tc.desc: 1.system run normally - * 2.get installed bundle names successfully - */ -HWTEST_F(BmsBundleKitServiceTest, GetBundleNameForUid_0600, Function | SmallTest | Level1) -{ - MockInstallBundle(BUNDLE_NAME_TEST, MODULE_NAME_TEST, ABILITY_NAME_TEST); - std::string testResult; - bool testRet = GetBundleDataMgr()->GetBundleNameForUid(TEST_UID, testResult); - EXPECT_FALSE(testRet); - EXPECT_NE(testResult, BUNDLE_NAME_TEST); - auto hostImpl = std::make_unique(); - bool result = hostImpl->VerifyQueryPermission(testResult); - EXPECT_TRUE(result); - - MockUninstallBundle(BUNDLE_NAME_TEST); -} - /** * @tc.number: CheckIsSystemAppByUid_0100 * @tc.name: test can check the installed bundle whether system app or not by uid -- Gitee From cac821510a43dd475860793c324056f1ed54a4c5 Mon Sep 17 00:00:00 2001 From: xinking129 Date: Sat, 2 Mar 2024 15:52:44 +0800 Subject: [PATCH 5/5] code check Signed-off-by: xinking129 --- .../bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp index b6ae35fe68..fbde8329c1 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_quick_fix_test/bms_bundle_quick_fix_test.cpp @@ -1387,7 +1387,6 @@ HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0041, Function | SmallTest EXPECT_EQ(ret, ERR_OK); ErrCode res = deleter->RemoveDeployingInfo(""); EXPECT_EQ(res, ERR_OK); - } } -- Gitee