!131 TDD测试用例补充

Merge pull request !131 from sunjiakun/tdd_1130
This commit is contained in:
openharmony_ci 2024-12-03 03:07:12 +00:00 committed by Gitee
commit 17d2aaf888
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 135 additions and 0 deletions

View File

@ -423,4 +423,17 @@ HWTEST_F(AppDomainVerifyBeanParcelTest, AppDomainVerifyBeanParcelTest0010, TestS
APP_DOMAIN_VERIFY_HILOGE(APP_DOMAIN_VERIFY_MODULE_COMMON, "AppDomainVerifyBeanParcelTest002 end");
printf("AppDomainVerifyBeanParcelTest001 end\n");
}
/**
* @tc.name: AppDomainVerifyBeanParcelTest0011
* @tc.desc: Dump test.
* @tc.type: FUNC
*/
HWTEST_F(AppDomainVerifyBeanParcelTest, AppDomainVerifyBeanParcelTest0011, TestSize.Level0)
{
VerifyResultInfo verifyResultInfo;
verifyResultInfo.appIdentifier = APP_IDENTIFIER;
std::string result = verifyResultInfo.Dump();
ASSERT_TRUE(result == "appIdentifier:appIdentifier\n");
}
}

View File

@ -66,4 +66,15 @@ bool AppDomainVerifyRdbDataManager::CheckRdbStoreExist(const std::shared_ptr<Nat
{
return false;
}
bool AppDomainVerifyRdbDataManager::QueryDomainByBundleName(
const std::string& bundleName, std::vector<RdbDataItem>& items)
{
return false;
}
bool AppDomainVerifyRdbDataManager::QueryBundleNameByDomain(const std::string& domain, std::vector<RdbDataItem>& items)
{
return false;
}
}

View File

@ -487,4 +487,29 @@ HWTEST_F(MgrDataMgrTest, MgrDataMgrLoadAllFromRdbTest005, TestSize.Level0)
ASSERT_TRUE(appDomainVerifyDataMgr->LoadAllFromRdb());
}
/**
* @tc.name: QueryAssociatedDomainsTest006
* @tc.desc: QueryAssociatedDomains
* @tc.type: FUNC
*/
HWTEST_F(MgrDataMgrTest, QueryAssociatedDomainsTest006, TestSize.Level0)
{
auto appDomainVerifyDataMgr = std::make_shared<AppDomainVerifyDataMgr>();
std::string bundleName;
std::vector<std::string> domains;
ASSERT_FALSE(appDomainVerifyDataMgr->QueryAssociatedDomains(bundleName, domains));
}
/**
* @tc.name: QueryAssociatedBundleNamesTest007
* @tc.desc: QueryAssociatedBundleNames
* @tc.type: FUNC
*/
HWTEST_F(MgrDataMgrTest, QueryAssociatedBundleNamesTest007, TestSize.Level0)
{
auto appDomainVerifyDataMgr = std::make_shared<AppDomainVerifyDataMgr>();
std::string domain;
std::vector<std::string> bundleNames;
ASSERT_FALSE(appDomainVerifyDataMgr->QueryAssociatedBundleNames(domain, bundleNames));
}
}

View File

@ -35,6 +35,7 @@
#include "system_ability_definition.h"
#include "app_domain_verify_parcel_util.h"
#include "mock_convert_callback.h"
#include "permission_manager.h"
namespace OHOS::AppDomainVerify {
using namespace testing;
@ -658,4 +659,89 @@ HWTEST_F(MgrServiceTest, MgrServiceTest034, TestSize.Level0)
bundleName, std::make_tuple(InnerVerifyStatus::STATE_FAIL, std::string(), 0));
EXPECT_FALSE(appDomainVerifyMgrService->SaveDomainVerifyStatus(bundleName, verifyResultInfo));
}
/**
* @tc.name: CheckPermission035
* @tc.desc: CheckPermission
* @tc.type: FUNC
*/
HWTEST_F(MgrServiceTest, CheckPermission035, TestSize.Level0)
{
std::string permission;
EXPECT_FALSE(PermissionManager::CheckPermission(permission));
}
/**
* @tc.name: IsSystemAppCall036
* @tc.desc: IsSystemAppCall
* @tc.type: FUNC
*/
HWTEST_F(MgrServiceTest, IsSystemAppCall036, TestSize.Level0)
{
EXPECT_TRUE(PermissionManager::IsSystemAppCall());
}
/**
* @tc.name: MgrServiceTest037
* @tc.desc: QueryAssociatedDomains
* @tc.type: FUNC
*/
HWTEST_F(MgrServiceTest, MgrServiceTest037, TestSize.Level0)
{
ASSERT_TRUE(appDomainVerifyMgrService);
ASSERT_TRUE(appDomainVerifyMgrService->dataManager_);
std::string bundleName;
std::vector<std::string> domains;
EXPECT_EQ(appDomainVerifyMgrService->QueryAssociatedDomains(bundleName, domains), 201);
}
/**
* @tc.name: MgrServiceTest038
* @tc.desc: QueryAssociatedBundleNames
* @tc.type: FUNC
*/
HWTEST_F(MgrServiceTest, MgrServiceTest038, TestSize.Level0)
{
ASSERT_TRUE(appDomainVerifyMgrService);
ASSERT_TRUE(appDomainVerifyMgrService->dataManager_);
std::string domain;
std::vector<std::string> bundleNames;
EXPECT_EQ(appDomainVerifyMgrService->QueryAssociatedBundleNames(domain, bundleNames), 201);
}
/**
* @tc.name: MgrServiceVerifyDomainTest039
* @tc.desc: OnUpdateWhiteListUrls
* @tc.type: FUNC
*/
HWTEST_F(MgrServiceTest, MgrServiceVerifyDomainTest039, TestSize.Level0)
{
std::string appIdentifier = "appIdentifier";
std::string bundleName = "bundleName";
std::string fingerprint = "fingerprint";
std::vector<SkillUri> skillUris;
SkillUri skillUri;
skillUris.push_back(skillUri);
MessageParcel data;
MessageParcel reply;
MessageOption option;
WRITE_PARCEL_AND_RETURN_IF_FAIL(InterfaceToken, data, std::u16string(u"abc"));
WRITE_PARCEL_AND_RETURN_IF_FAIL(String, data, appIdentifier);
WRITE_PARCEL_AND_RETURN_IF_FAIL(String, data, bundleName);
WRITE_PARCEL_AND_RETURN_IF_FAIL(String, data, fingerprint);
uint32_t size = static_cast<uint32_t>(skillUris.size());
WRITE_PARCEL_AND_RETURN_IF_FAIL(Uint32, data, size);
int32_t error = appDomainVerifyMgrService->OnRemoteRequest(
AppDomainVerifyMgrInterfaceCode::UPDATE_WHITE_LIST_URLS, data, reply, option);
ASSERT_TRUE(error != ERR_OK);
error = appDomainVerifyMgrService->OnRemoteRequest(
AppDomainVerifyMgrInterfaceCode::QUERY_ASSOCIATED_DOMAINS, data, reply, option);
ASSERT_TRUE(error != ERR_OK);
error = appDomainVerifyMgrService->OnRemoteRequest(
AppDomainVerifyMgrInterfaceCode::QUERY_ASSOCIATED_BUNDLE_NAMES, data, reply, option);
ASSERT_TRUE(error != ERR_OK);
}
}