# Copyright (c) 2021-2022 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//base/security/access_token/access_token.gni") import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") import("//foundation/ability/dmsfwk/dmsfwk.gni") module_output_path = "dmsfwk/distributedschedsvrtest" distributed_service = "//foundation/ability/dmsfwk/services" dsched_configs = [ "${distributed_service}/dtbschedmgr:distributed_sched_config" ] config("test_config") { visibility = [ ":*" ] include_dirs = [ "//foundation/ability/dmsfwk/utils/native/include", "//foundation/ability/dmsfwk/services/dtbschedmgr/test/unittest", ] } dsched_external_deps = [ "ability_base:want", "ability_runtime:ability_manager", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "device_auth:deviceauth_sdk", "device_manager:devicemanagersdk", "dmsfwk:continuation_manager", "eventhandler:libeventhandler", "hitrace_native:hitrace_meter", "hitrace_native:libhitracechain", "hiviewdfx_hilog_native:libhilog", "init:libbegetutil", "ipc:ipc_core", "kv_store:distributeddata_inner", "os_account:os_account_innerkits", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (dmsfwk_report_memmgr) { dsched_external_deps += [ "memmgr:memmgrclient" ] } if (dmsfwk_report_memmgr_plugins) { dsched_external_deps += [ "memmgr_plugin:memmgrclient" ] } if (dmsfwk_standard_form_share) { dsched_external_deps += [ "form_fwk:form_manager" ] } if (dmsfwk_mission_manager) { dsched_external_deps += [ "multimedia_image_framework:image_native" ] } if (efficiency_manager_service_enable) { dsched_external_deps += [ "efficiency_manager:suspend_manager_client" ] } dsched_public_deps = [ "//foundation/ability/dmsfwk/services/base:dmsbaseinner", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/libxml2:libxml2", ] dtbschedmgr_sources = [ "${distributed_service}/dtbschedmgr/src/ability_connection_wrapper_proxy.cpp", "${distributed_service}/dtbschedmgr/src/ability_connection_wrapper_stub.cpp", "${distributed_service}/dtbschedmgr/src/app_connection_stub.cpp", "${distributed_service}/dtbschedmgr/src/bundle/bundle_manager_callback_stub.cpp", "${distributed_service}/dtbschedmgr/src/bundle/bundle_manager_internal.cpp", "${distributed_service}/dtbschedmgr/src/connect_death_recipient.cpp", "${distributed_service}/dtbschedmgr/src/distributed_sched_adapter.cpp", "${distributed_service}/dtbschedmgr/src/distributed_sched_continuation.cpp", "${distributed_service}/dtbschedmgr/src/distributed_sched_dumper.cpp", "${distributed_service}/dtbschedmgr/src/distributed_sched_permission.cpp", "${distributed_service}/dtbschedmgr/src/distributed_sched_proxy.cpp", "${distributed_service}/dtbschedmgr/src/distributed_sched_service.cpp", "${distributed_service}/dtbschedmgr/src/distributed_sched_stub.cpp", "${distributed_service}/dtbschedmgr/src/dms_callback_task.cpp", "${distributed_service}/dtbschedmgr/src/dms_free_install_callback.cpp", "${distributed_service}/dtbschedmgr/src/dms_free_install_callback_proxy.cpp", "${distributed_service}/dtbschedmgr/src/dms_free_install_callback_stub.cpp", "${distributed_service}/dtbschedmgr/src/dms_token_callback.cpp", "unittest/distributed_sched_util.cpp", ] if (dmsfwk_mission_manager) { dtbschedmgr_sources += [ "${distributed_service}/dtbschedmgr/src/mission/distributed_data_change_listener.cpp", "${distributed_service}/dtbschedmgr/src/mission/distributed_data_storage.cpp", "${distributed_service}/dtbschedmgr/src/mission/distributed_mission_change_listener.cpp", "${distributed_service}/dtbschedmgr/src/mission/distributed_mission_info.cpp", "${distributed_service}/dtbschedmgr/src/mission/distributed_sched_mission_manager.cpp", "${distributed_service}/dtbschedmgr/src/mission/kvstore_death_recipient.cpp", "${distributed_service}/dtbschedmgr/src/mission/mission_changed_notify.cpp", "${distributed_service}/dtbschedmgr/src/mission/mission_info_converter.cpp", "${distributed_service}/dtbschedmgr/src/mission/snapshot.cpp", "${distributed_service}/dtbschedmgr/src/mission/snapshot_converter.cpp", ] } if (dmsfwk_standard_form_share) { dtbschedmgr_sources += [ "${distributed_service}/dtbschedmgr/src/form_mgr_death_recipient.cpp" ] } ohos_unittest("distributedschedsvrtest") { module_out_path = module_output_path sources = [ "unittest/distributed_sched_adapter_test.cpp", "unittest/distributed_sched_dumper_test.cpp", "unittest/distributed_sched_service_test.cpp", "unittest/distributed_sched_stub_test.cpp", "unittest/dms_callback_task_test.cpp", "unittest/dms_token_callback_test.cpp", "unittest/mock_distributed_sched.cpp", "unittest/mock_remote_stub.cpp", ] sources += dtbschedmgr_sources configs = [ ":test_config", "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } if (dmsfwk_report_memmgr || dmsfwk_report_memmgr_plugins) { defines = [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ] } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("distributedcalltest") { module_out_path = module_output_path sources = [ "unittest/distributed_sched_call_test.cpp" ] sources += dtbschedmgr_sources configs = [ ":test_config", "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dmsfreeinstallcbtest") { module_out_path = module_output_path sources = [ "unittest/dms_free_install_callback_test.cpp", "unittest/mock_remote_stub.cpp", ] sources += dtbschedmgr_sources configs = [ ":test_config", "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dschedcontinuetest") { module_out_path = module_output_path sources = [ "unittest/distributed_sched_continuation_test.cpp", "unittest/dms_version_manager_test.cpp", "unittest/mock_distributed_sched.cpp", "unittest/mock_remote_stub.cpp", ] sources += dtbschedmgr_sources configs = [ ":test_config", "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } if (dmsfwk_mission_manager) { defines = [ "SUPPORT_DISTRIBUTED_MISSION_MANAGER" ] } if (dmsfwk_standard_form_share) { defines += [ "SUPPORT_DISTRIBUTED_FORM_SHARE" ] } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dschedconnecttest") { module_out_path = module_output_path sources = [ "unittest/app_connection_stub_test.cpp", "unittest/distributed_sched_connect_test.cpp", "unittest/mock_remote_stub.cpp", ] sources += dtbschedmgr_sources configs = [ ":test_config", "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dschedpermissiontest") { module_out_path = module_output_path sources = [ "unittest/distributed_sched_permission_test.cpp" ] sources += dtbschedmgr_sources configs = [ ":test_config", "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } if (token_sync_enable) { cflags_cc = [ "-DTOKEN_SYNC_ENABLE" ] } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dschedmissionmanagertest") { module_out_path = module_output_path sources = [ "unittest/mission/distributed_data_storage_test.cpp", "unittest/mission/distributed_mission_info_test.cpp", "unittest/mission/dms_mission_manager_test.cpp", "unittest/mission/mission_info_converter_test.cpp", "unittest/mission/snapshot_test.cpp", "unittest/mock_remote_stub.cpp", ] sources += dtbschedmgr_sources configs = [ ":test_config", "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs deps = [ "${distributed_service}/dtbschedmgr:distributedschedsvr" ] if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("bundlemanagerinternaltest") { module_out_path = module_output_path sources = [ "unittest/bundle_manager_internal_test.cpp" ] sources += dtbschedmgr_sources configs = [ ":test_config", "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs deps = [ "${distributed_service}/dtbschedmgr:distributedschedsvr" ] if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("hisyseventreporttest") { module_out_path = module_output_path sources = [ "unittest/dms_hisysevent_report_test.cpp" ] sources += dtbschedmgr_sources configs = [ ":test_config", "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs deps = [ "${distributed_service}/dtbschedmgr:distributedschedsvr" ] if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("distributeduidtest") { module_out_path = module_output_path sources = [ "unittest/distributed_sched_uid_test.cpp" ] sources += dtbschedmgr_sources configs = [ ":test_config", "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } group("unittest") { testonly = true deps = [ ":bundlemanagerinternaltest", ":distributedcalltest", ":distributedschedsvrtest", ":distributeduidtest", ":dmsfreeinstallcbtest", ":dschedconnecttest", ":dschedcontinuetest", ] if (dmsfwk_mission_manager) { deps += [ ":dschedmissionmanagertest", ":dschedpermissiontest", ] } }