新增TDD接口覆盖率

Signed-off-by: geng-wenguang <gengwenguang@huawei.com>
This commit is contained in:
geng-wenguang 2023-08-15 15:27:56 +08:00
parent 900d047b53
commit 356dd8742d
2 changed files with 42 additions and 0 deletions

View File

@ -294,6 +294,18 @@ HWTEST_F(BmsExtensionDataMgrTest, BmsExtensionDataMgr_0009, Function | SmallTest
#endif
}
/**
* @tc.number: BmsExtensionDataMgr_0010
* @tc.name: Uninstall
* @tc.desc: Uninstall
*/
HWTEST_F(BmsExtensionDataMgrTest, BmsExtensionDataMgr_0010, Function | SmallTest | Level0)
{
BundleMgrExtTest bundleMgrExtTest;
ErrCode res = bundleMgrExtTest.Uninstall("");
EXPECT_EQ(res, ERR_BUNDLE_MANAGER_INSTALL_FAILED_BUNDLE_EXTENSION_NOT_EXISTED);
}
/**
* @tc.number: BmsExtensionProfile_0001
* @tc.name: TransformTo

View File

@ -152,6 +152,7 @@ public:
static sptr<IBundleMgr> GetBundleMgrProxy();
static sptr<IBundleInstaller> GetInstallerProxy();
void ClearJsonFile() const;
bool UpdateBundleForSelf(const std::vector<std::string> &bundleFilePaths) const;
};
sptr<IBundleMgr> BmsInstallSystemTest::GetBundleMgrProxy()
@ -287,6 +288,23 @@ void BmsInstallSystemTest::UninstallBundle(
uninstallMsg = statusReceiver->GetResultMsg();
}
bool BmsInstallSystemTest::UpdateBundleForSelf(const std::vector<std::string> &bundleFilePaths) const
{
sptr<IBundleInstaller> installerProxy = GetInstallerProxy();
if (!installerProxy) {
APP_LOGE("get bundle installer Failure.");
return false;
}
sptr<StatusReceiverImpl> statusReceiver(new (std::nothrow) StatusReceiverImpl());
EXPECT_NE(statusReceiver, nullptr);
InstallParam installParam;
installParam.userId = USERID;
bool result = installerProxy->UpdateBundleForSelf(bundleFilePaths, installParam, statusReceiver);
return result;
}
int32_t BmsInstallSystemTest::ExcuteMaintainCmd(const std::string &cmd, std::vector<std::string> &cmdRes)
{
CommonTool commonTool;
@ -1858,5 +1876,17 @@ HWTEST_F(BmsInstallSystemTest, BMS_DFX_0400, Function | MediumTest | Level2)
EXPECT_EQ(uninstallMsg, "Success") << "uninstall fail!" << bundleFilePath;
std::cout << "END BMS_DFX_0400" << std::endl;
}
/**
* @tc.number: BMS_UpdateBundleForSelf_0100
* @tc.name: test the UpdateBundleForSelf
* @tc.desc: 1.test the UpdateBundleForSelf
*/
HWTEST_F(BmsInstallSystemTest, BMS_UpdateBundleForSelf_0100, Function | MediumTest | Level1)
{
std::vector<std::string> bundleFilePaths;
bool res = UpdateBundleForSelf(bundleFilePaths);
EXPECT_EQ(res, true);
}
} // namespace AppExecFwk
} // namespace OHOS