DMS上报应用信息补充测试用例

Signed-off-by: du-zhihai <duzhihai@huawei.com>
Change-Id: Iabc2bc7707735c38d62fbf3d001ed96e6c9ee400
This commit is contained in:
du-zhihai 2022-09-15 19:36:59 +08:00
parent 289dd8dc99
commit ca64031006
6 changed files with 63 additions and 35 deletions

View File

@ -22,7 +22,8 @@
"dmsfwk_feature_coverage = false", "dmsfwk_feature_coverage = false",
"dmsfwk_standard_form_share", "dmsfwk_standard_form_share",
"dmsfwk_mission_manager", "dmsfwk_mission_manager",
"dmsfwk_report_distributedcomponent_memmgr" "dmsfwk_report_memmgr",
"dmsfwk_report_memmgr_plugins"
], ],
"hisysevent_config": [ "hisysevent_config": [
"//foundation/ability/dmsfwk/hisysevent.yaml" "//foundation/ability/dmsfwk/hisysevent.yaml"

View File

@ -13,21 +13,22 @@
declare_args() { declare_args() {
dmsfwk_standard_form_share = true dmsfwk_standard_form_share = true
dmsfwk_mission_manager = true dmsfwk_mission_manager = false
efficiency_manager_service_enable = true efficiency_manager_service_enable = false
dmsfwk_report_distributedcomponent_memmgr = true dmsfwk_report_memmgr = false
if (defined(global_parts_info) && dmsfwk_report_memmgr_plugins = false
!defined(global_parts_info.multimedia_multimedia_image_standard)) { if (defined(global_parts_info) ) {
dmsfwk_mission_manager = false if (defined(global_parts_info.multimedia_multimedia_image_standard)) {
} dmsfwk_mission_manager = true
}
if (defined(global_parts_info) && if (defined(global_parts_info.resourceschedule_efficiency_manager)) {
!defined(global_parts_info.resourceschedule_efficiency_manager)) { efficiency_manager_service_enable = true
efficiency_manager_service_enable = false }
} if (defined(global_parts_info.resourceschedule_memmgr)) {
if (defined(global_parts_info) && dmsfwk_report_memmgr = true
!defined(global_parts_info.resourceschedule_memmgr) && }
!defined(global_parts_info.resourceschedule_plugins_memmgr)) { if (defined(global_parts_info.resourceschedule_plugins_memmgr)) {
dmsfwk_report_distributedcomponent_memmgr = false dmsfwk_report_memmgr_plugins = true
}
} }
} }

View File

@ -26,7 +26,7 @@ config("distributed_sched_config") {
if (dmsfwk_mission_manager) { if (dmsfwk_mission_manager) {
defines = [ "SUPPORT_DISTRIBUTED_MISSION_MANAGER" ] defines = [ "SUPPORT_DISTRIBUTED_MISSION_MANAGER" ]
} }
if (dmsfwk_report_distributedcomponent_memmgr) { if (dmsfwk_report_memmgr || dmsfwk_report_memmgr_plugins) {
defines += [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ] defines += [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ]
} }
if (dmsfwk_standard_form_share) { if (dmsfwk_standard_form_share) {
@ -113,13 +113,12 @@ ohos_shared_library("distributedschedsvr") {
external_deps += [ "multimedia_image_standard:image_native" ] external_deps += [ "multimedia_image_standard:image_native" ]
} }
if (dmsfwk_report_distributedcomponent_memmgr && defined(global_parts_info)) { if (dmsfwk_report_memmgr) {
if (defined(global_parts_info.resourceschedule_memmgr)) { external_deps += [ "memmgr:memmgrclient" ]
external_deps += [ "memmgr:memmgrclient" ] }
}
if (defined(global_parts_info.resourceschedule_plugins_memmgr)) { if (dmsfwk_report_memmgr_plugins) {
external_deps += [ "plugins/memmgr:memmgrclient" ] external_deps += [ "plugins/memmgr:memmgrclient" ]
}
} }
install_images = [ system_base_dir ] install_images = [ system_base_dir ]

View File

@ -1186,9 +1186,12 @@ void DistributedSchedService::ReportDistributedComponentChange(const CallerInfo&
changeType == DISTRIBUTED_COMPONENT_ADD); changeType == DISTRIBUTED_COMPONENT_ADD);
#endif #endif
}; };
if (componentChangeHandler_ == nullptr || !componentChangeHandler_->PostTask(func)) { if (componentChangeHandler_ == nullptr) {
HILOGE("HandleDistributedComponentChange handler postTask failed"); HILOGE("HandleDistributedComponentChange handler postTask failed");
} }
else {
componentChangeHandler_->PostTask(func);
}
#endif #endif
} }
@ -1208,9 +1211,12 @@ void DistributedSchedService::ReportDistributedComponentChange(const ConnectInfo
SuspendManager::SuspendManagerClient::GetInstance().ReportStateChangeEvent( SuspendManager::SuspendManagerClient::GetInstance().ReportStateChangeEvent(
SuspendManager::ReportEventType::DIS_COMP_CHANGE, componentInfo); SuspendManager::ReportEventType::DIS_COMP_CHANGE, componentInfo);
}; };
if (componentChangeHandler_ == nullptr || !componentChangeHandler_->PostTask(func)) { if (componentChangeHandler_ == nullptr) {
HILOGE("HandleDistributedComponentChange handler postTask failed"); HILOGE("HandleDistributedComponentChange handler postTask failed");
} }
else {
componentChangeHandler_->PostTask(func);
}
#endif #endif
} }

View File

@ -55,13 +55,12 @@ dsched_external_deps = [
"samgr:samgr_proxy", "samgr:samgr_proxy",
] ]
if (dmsfwk_report_distributedcomponent_memmgr && defined(global_parts_info)) { if (dmsfwk_report_memmgr) {
if (defined(global_parts_info.resourceschedule_memmgr)) { dsched_external_deps += [ "memmgr:memmgrclient" ]
dsched_external_deps += [ "memmgr:memmgrclient" ] }
}
if (defined(global_parts_info.resourceschedule_plugins_memmgr)) { if (dmsfwk_report_memmgr_plugins) {
dsched_external_deps += [ "plugins/memmgr:memmgrclient" ] dsched_external_deps += [ "plugins/memmgr:memmgrclient" ]
}
} }
if (dmsfwk_standard_form_share) { if (dmsfwk_standard_form_share) {
@ -143,7 +142,7 @@ ohos_unittest("distributedschedsvrtest") {
public_deps = dsched_public_deps public_deps = dsched_public_deps
} }
if (dmsfwk_report_distributedcomponent_memmgr) { if (dmsfwk_report_memmgr || dmsfwk_report_memmgr_plugins) {
defines = [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ] defines = [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ]
} }

View File

@ -989,6 +989,7 @@ HWTEST_F(DistributedSchedServiceTest, ContinueMission_002, TestSize.Level1)
* @tc.name: StartContinuation_001 * @tc.name: StartContinuation_001
* @tc.desc: call StartContinuation * @tc.desc: call StartContinuation
* @tc.type: FUNC * @tc.type: FUNC
* @tc.require: I5NOA1
*/ */
HWTEST_F(DistributedSchedServiceTest, StartContinuation_001, TestSize.Level1) HWTEST_F(DistributedSchedServiceTest, StartContinuation_001, TestSize.Level1)
{ {
@ -1004,6 +1005,27 @@ HWTEST_F(DistributedSchedServiceTest, StartContinuation_001, TestSize.Level1)
int32_t ret = DistributedSchedService::GetInstance().StartContinuation( int32_t ret = DistributedSchedService::GetInstance().StartContinuation(
want, missionId, callerUid, status, accessToken); want, missionId, callerUid, status, accessToken);
EXPECT_EQ(static_cast<int>(INVALID_REMOTE_PARAMETERS_ERR), ret); EXPECT_EQ(static_cast<int>(INVALID_REMOTE_PARAMETERS_ERR), ret);
CallerInfo callerInfo;
/**
* @tc.steps: step1. ReportDistributedComponentChange when componentChangeHandler_ is nullptr
*/
DistributedSchedService::GetInstance().componentChangeHandler_ = nullptr;
DistributedSchedService::GetInstance().ReportDistributedComponentChange(callerInfo,
1, IDistributedSched::CALL, IDistributedSched::CALLER);
/**
* @tc.steps: step2. ReportDistributedComponentChange when componentChangeHandler_ is not nullptr
*/
auto runner = AppExecFwk::EventRunner::Create("DmsComponentChange");
DistributedSchedService::GetInstance().componentChangeHandler_ = std::make_shared<AppExecFwk::EventHandler>(runner);
DistributedSchedService::GetInstance().ReportDistributedComponentChange(callerInfo,
1, IDistributedSched::CALL, IDistributedSched::CALLER);
/**
* @tc.steps: step3. ReportDistributedComponentChange when callerInfo.bundleNames is not empty
*/
callerInfo.bundleNames.emplace_back("bundleName");
DistributedSchedService::GetInstance().ReportDistributedComponentChange(callerInfo,
1, IDistributedSched::CALL, IDistributedSched::CALLER);
DTEST_LOG << "DSchedContinuationTest StartContinuation_001 end" << std::endl; DTEST_LOG << "DSchedContinuationTest StartContinuation_001 end" << std::endl;
} }