# 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 # # 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("//build/test.gni") import("../../../../common/config/common.gni") module_output_path = "enterprise_device_management/enterprise_device_management" config("module_private_config") { visibility = [ ":*" ] } ohos_unittest("EdmPluginTest") { module_out_path = module_output_path include_dirs = [ "../../common/mock/include", "../../external_mock/include", "../../../../common/native/include/plugin_kits", "../../../../services/edm_plugin/include", "../../../../services/edm_plugin/include/utils", "../../../../services/edm_plugin/include/network", "../../../../services/edm_plugin/include/network/executer", "../../../../services/edm_plugin/include/network/rule", "./include", "./include/network", "./include/network/executer", "./include/utils", ] sources = [ "../../common/mock/src/edm_data_ability_utils_mock.cpp", "./src/bundle_install_plugin_test.cpp", "./src/device_info_plugin_test.cpp", "./src/disallow_modify_datetime_plugin_test.cpp", "./src/get_device_encryption_status_plugin_test.cpp", "./src/get_security_patch_tag_plugin_test.cpp", "./src/install_plugin_test.cpp", "./src/network/executer/executer_utils_mock.cpp", "./src/ntp_server_plugin_test.cpp", "./src/password_policy_plugin_test.cpp", "./src/power_policy_plugin_test.cpp", "./src/screen_off_time_plugin_test.cpp", "./src/uninstall_plugin_test.cpp", "./src/utils/password_policy_serializer_test.cpp", ] configs = [ ":module_private_config", "../../../../common/config:coverage_flags", ] deps = [ ":edm_all_plugin_static", "../../../../common/external:edm_external_adapters", "../../../../common/native:edm_commom", "../../../../interfaces/inner_api:edmservice_kits", "../../../../interfaces/inner_api/plugin_kits:plugin_kits", "../../test_bundle/ohos_test:copy_ohos_test", "../../test_bundle/right_hap:right", "../../utils:edm_unittest_utils", "//third_party/googletest:gmock_main", ] external_deps = [ "ability_base:want", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "cJSON:cjson", "c_utils:utils", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] defines = [] if (os_account_edm_enable) { external_deps += [ "ability_runtime:app_manager", "os_account:libaccountkits", "os_account:os_account_innerkits", ] sources += [ "./src/add_os_account_plugin_test.cpp", "./src/disallow_add_local_account_plugin_test.cpp", "./src/disallow_add_os_account_by_user_plugin_test.cpp", "./src/operate_device_plugin_test.cpp", ] defines += [ "OS_ACCOUNT_EDM_ENABLE" ] } if (ability_runtime_edm_enable) { sources += [ "./src/disallowed_running_bundles_plugin_test.cpp", "./src/manage_auto_start_apps_plugin_test.cpp", ] } if (screenlock_mgr_edm_enable) { external_deps += [ "screenlock_mgr:screenlock_client" ] } if (os_account_edm_enable && screenlock_mgr_edm_enable) { sources += [ "./src/lock_screen_plugin_test.cpp" ] } if (power_manager_edm_enable && screenlock_mgr_edm_enable) { external_deps += [ "power_manager:powermgr_client" ] sources += [ "./src/reboot_plugin_test.cpp", "./src/shutdown_plugin_test.cpp", ] } if (wifi_edm_enable) { external_deps += [ "wifi:wifi_sdk" ] sources += [ "./src/is_wifi_active_plugin_test.cpp", "./src/message_parcel_utils_test.cpp", "./src/set_wifi_disabled_plugin_test.cpp", "./src/set_wifi_profile_plugin_test.cpp", ] defines += [ "WIFI_EDM_ENABLE" ] } if (netmanager_base_edm_enable && netmanager_ext_edm_enable) { external_deps += [ "netmanager_base:net_conn_manager_if" ] sources += [ "./src/domain_filter_rule_plugin_test.cpp", "./src/firewall_rule_plugin_test.cpp", "./src/global_proxy_plugin_test.cpp", "./src/iptables_rule_plugin_test.cpp", "./src/network/executer/domain_executer_test.cpp", "./src/network/executer/executer_factory_test.cpp", "./src/network/executer/executer_utils_test.cpp", "./src/network/executer/firewall_executer_test.cpp", "./src/network/executer/iexecuter_test.cpp", "./src/network/iptables_manager_test.cpp", "./src/network/rule/chain_rule_test.cpp", "./src/network/rule/domain_chain_rule_test.cpp", "./src/network/rule/firewall_chain_rule_test.cpp", "./src/network_manager_plugin_test.cpp", ] } if (certificate_manager_edm_enable) { external_deps += [ "certificate_manager:cert_manager_sdk" ] sources += [ "./src/user_cert_plugin_test.cpp" ] } if (drivers_interface_usb_edm_enable && usb_manager_edm_enable) { external_deps += [ "usb_manager:usbsrv_client" ] sources += [ "./src/allowed_usb_devices_plugin_test.cpp", "./src/disable_usb_plugin_test.cpp", "./src/disallowed_usb_devices_plugin_test.cpp", "./src/utils/array_usb_device_id_serializer_test.cpp", ] } if (drivers_interface_usb_edm_enable && storage_service_edm_enable && usb_manager_edm_enable) { external_deps += [ "storage_service:storage_manager_sa_proxy" ] sources += [ "./src/usb_read_only_plugin_test.cpp" ] } if (audio_framework_edm_enable) { external_deps += [ "audio_framework:audio_client" ] sources += [ "./src/disable_hdc_plugin_test.cpp", "./src/disable_microphone_plugin_test.cpp", "./src/disable_printer_plugin_test.cpp", ] } if (common_event_service_edm_enable) { external_deps += [ "common_event_service:cesfwk_innerkits" ] sources += [ "./src/set_browser_policies_plugin_test.cpp" ] } if (bluetooth_edm_enable) { external_deps += [ "bluetooth:btframework" ] sources += [ "./src/allowed_bluetooth_devices_plugin_test.cpp", "./src/disable_bluetooth_plugin_test.cpp", "./src/get_bluetooth_info_plugin_test.cpp", ] } if (location_edm_enable) { sources += [ "./src/location_policy_plugin_test.cpp" ] } if (update_service_edm_enable) { external_deps += [ "update_service:updateservicekits" ] } if (pasteboard_edm_enable) { sources += [ "./src/clipboard_policy_plugin_test.cpp", "./src/utils/clipboard_policy_serializer_test.cpp", "./src/utils/clipboard_utils_test.cpp", ] } if (camera_framework_edm_enable) { sources += [ "./src/disable_camera_plugin_test.cpp" ] } sanitize = { boundary_sanitize = true cfi = true cfi_cross_dso = true debug = false integer_overflow = true ubsan = true blocklist = "../../cfi_blocklist.txt" } branch_protector_ret = "pac_ret" subsystem_name = "customization" part_name = "enterprise_device_management" } ohos_unittest("EdmFingerPrintPluginTest") { module_out_path = module_output_path include_dirs = [ "../../../../services/edm_plugin/include" ] sources = [ "./src/fingerprint_auth_plugin_test.cpp" ] configs = [ ":module_private_config", "../../../../common/config:coverage_flags", ] deps = [ ":edm_all_plugin_static", "../../../../common/native:edm_commom", "../../../../interfaces/inner_api:edmservice_kits", "../../../../interfaces/inner_api/plugin_kits:plugin_kits", "../../utils:edm_unittest_utils", "//third_party/googletest:gmock_main", ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "c_utils:utils", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", ] sanitize = { boundary_sanitize = true cfi = true cfi_cross_dso = true debug = false integer_overflow = true ubsan = true blocklist = "../../cfi_blocklist.txt" } branch_protector_ret = "pac_ret" subsystem_name = "customization" part_name = "enterprise_device_management" } ohos_static_library("edm_all_plugin_static") { visibility = [ ":*" ] testonly = true sources = [ "../../../../services/edm/src/permission_manager.cpp", "../../../../services/edm/src/plugin_manager.cpp", "../../../../services/edm/src/strategy/enhance_execute_strategy.cpp", "../../../../services/edm/src/strategy/replace_execute_strategy.cpp", "../../../../services/edm/src/strategy/single_execute_strategy.cpp", "../../../../services/edm_plugin/src/allowed_install_bundles_plugin.cpp", "../../../../services/edm_plugin/src/bundle_install_plugin.cpp", "../../../../services/edm_plugin/src/disallow_modify_datetime_plugin.cpp", "../../../../services/edm_plugin/src/disallowed_install_bundles_plugin.cpp", "../../../../services/edm_plugin/src/disallowed_uninstall_bundles_plugin.cpp", "../../../../services/edm_plugin/src/get_device_encryption_status_plugin.cpp", "../../../../services/edm_plugin/src/get_device_info_plugin.cpp", "../../../../services/edm_plugin/src/get_display_version_plugin.cpp", "../../../../services/edm_plugin/src/get_security_patch_tag_plugin.cpp", "../../../../services/edm_plugin/src/install_plugin.cpp", "../../../../services/edm_plugin/src/ntp_server_plugin.cpp", "../../../../services/edm_plugin/src/operate_device_plugin.cpp", "../../../../services/edm_plugin/src/password_policy_plugin.cpp", "../../../../services/edm_plugin/src/power_policy_plugin.cpp", "../../../../services/edm_plugin/src/screen_off_time_plugin.cpp", "../../../../services/edm_plugin/src/uninstall_plugin.cpp", "../../../../services/edm_plugin/src/utils/install_param_serializer.cpp", "../../../../services/edm_plugin/src/utils/installer_callback.cpp", "../../../../services/edm_plugin/src/utils/operate_device_param_serializer.cpp", "../../../../services/edm_plugin/src/utils/password_policy_serializer.cpp", "../../../../services/edm_plugin/src/utils/uninstall_param_serializer.cpp", ] configs = [ "../../../../common/config:coverage_flags" ] include_dirs = [ "../../../../services/edm/include", "../../../../services/edm/include/strategy", "../../../../services/edm_plugin/include", "../../../../services/edm_plugin/include/utils", "../../../../services/edm_plugin/include/network", "../../../../services/edm_plugin/include/network/executer", "../../../../services/edm_plugin/include/network/rule", ] deps = [ "../../../../common/external:edm_external_adapters", "../../../../common/native:edm_commom", "../../../../interfaces/inner_api:edmservice_kits", "../../../../interfaces/inner_api/plugin_kits:plugin_kits", ] external_deps = [ "ability_base:want", "ability_runtime:app_manager", "access_token:libaccesstoken_sdk", "bounds_checking_function:libsec_shared", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "cJSON:cjson", "c_utils:utils", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "jsoncpp:jsoncpp", "samgr:samgr_proxy", "user_auth_framework:userauth_client", ] defines = [] if (update_service_edm_enable) { external_deps += [ "update_service:updateservicekits" ] sources += [ "../../../../services/edm_plugin/src/reset_factory_plugin.cpp" ] } if (os_account_edm_enable) { external_deps += [ "os_account:libaccountkits", "os_account:os_account_innerkits", ] sources += [ "../../../../services/edm_plugin/src/add_os_account_plugin.cpp", "../../../../services/edm_plugin/src/disallow_add_local_account_plugin.cpp", "../../../../services/edm_plugin/src/disallow_add_os_account_by_user_plugin.cpp", ] defines += [ "OS_ACCOUNT_EDM_ENABLE" ] } if (screenlock_mgr_edm_enable) { external_deps += [ "screenlock_mgr:screenlock_client" ] sources += [ "../../../../services/edm_plugin/src/lock_screen_plugin.cpp" ] } if (power_manager_edm_enable && screenlock_mgr_edm_enable) { external_deps += [ "power_manager:powermgr_client" ] sources += [ "../../../../services/edm_plugin/src/reboot_plugin.cpp", "../../../../services/edm_plugin/src/shutdown_plugin.cpp", ] } if (wifi_edm_enable) { external_deps += [ "wifi:wifi_sdk" ] sources += [ "../../../../common/native/src/plugin_utils/message_parcel_utils.cpp", "../../../../services/edm_plugin/src/is_wifi_active_plugin.cpp", "../../../../services/edm_plugin/src/set_wifi_disabled_plugin.cpp", "../../../../services/edm_plugin/src/set_wifi_profile_plugin.cpp", "../../../../services/edm_plugin/src/utils/wifi_device_config_serializer.cpp", ] defines += [ "WIFI_EDM_ENABLE" ] } if (netmanager_base_edm_enable && netmanager_ext_edm_enable) { external_deps += [ "netmanager_base:net_conn_manager_if", "netmanager_base:netsys_controller", "netmanager_ext:ethernet_manager_if", ] sources += [ "../../../../services/edm_plugin/src/disabled_network_interface_plugin.cpp", "../../../../services/edm_plugin/src/domain_filter_rule_plugin.cpp", "../../../../services/edm_plugin/src/firewall_rule_plugin.cpp", "../../../../services/edm_plugin/src/get_all_network_interfaces_plugin.cpp", "../../../../services/edm_plugin/src/get_ip_address_plugin.cpp", "../../../../services/edm_plugin/src/get_mac_plugin.cpp", "../../../../services/edm_plugin/src/global_proxy_plugin.cpp", "../../../../services/edm_plugin/src/iptables_rule_plugin.cpp", "../../../../services/edm_plugin/src/network/executer/domain_executer.cpp", "../../../../services/edm_plugin/src/network/executer/executer_factory.cpp", "../../../../services/edm_plugin/src/network/executer/executer_utils.cpp", "../../../../services/edm_plugin/src/network/executer/firewall_executer.cpp", "../../../../services/edm_plugin/src/network/executer/iexecuter.cpp", "../../../../services/edm_plugin/src/network/iptables_manager.cpp", "../../../../services/edm_plugin/src/network/rule/chain_rule.cpp", "../../../../services/edm_plugin/src/network/rule/domain_chain_rule.cpp", "../../../../services/edm_plugin/src/network/rule/firewall_chain_rule.cpp", "../../../../services/edm_plugin/src/network/rule/rule_utils.cpp", "../../../../services/edm_plugin/src/utils/domain_filter_rule_serializer.cpp", "../../../../services/edm_plugin/src/utils/firewall_rule_serializer.cpp", "../../../../services/edm_plugin/src/utils/http_proxy_serializer.cpp", ] } if (ability_runtime_edm_enable) { external_deps += [ "ability_runtime:ability_manager" ] sources += [ "../../../../services/edm_plugin/src/disallowed_running_bundles_plugin.cpp", "../../../../services/edm_plugin/src/manage_auto_start_apps_plugin.cpp", ] } if (certificate_manager_edm_enable) { external_deps += [ "certificate_manager:cert_manager_sdk" ] sources += [ "../../../../services/edm_plugin/src/user_cert_plugin.cpp" ] } if (drivers_interface_usb_edm_enable && usb_manager_edm_enable) { external_deps += [ "usb_manager:usbsrv_client" ] sources += [ "../../../../services/edm_plugin/src/allowed_usb_devices_plugin.cpp", "../../../../services/edm_plugin/src/disable_usb_plugin.cpp", "../../../../services/edm_plugin/src/disallowed_usb_devices_plugin.cpp", "../../../../services/edm_plugin/src/utils/array_usb_device_id_serializer.cpp", "../../../../services/edm_plugin/src/utils/array_usb_device_type_serializer.cpp", "../../../../services/edm_plugin/src/utils/usb_policy_utils.cpp", ] } if (drivers_interface_usb_edm_enable && storage_service_edm_enable && usb_manager_edm_enable) { external_deps += [ "storage_service:storage_manager_sa_proxy" ] sources += [ "../../../../services/edm_plugin/src/usb_read_only_plugin.cpp" ] } if (audio_framework_edm_enable) { external_deps += [ "audio_framework:audio_client" ] sources += [ "../../../../services/edm_plugin/src/disable_hdc_plugin.cpp", "../../../../services/edm_plugin/src/disable_microphone_plugin.cpp", "../../../../services/edm_plugin/src/disable_printer_plugin.cpp", "../../../../services/edm_plugin/src/fingerprint_auth_plugin.cpp", ] } if (common_event_service_edm_enable) { external_deps += [ "common_event_service:cesfwk_innerkits" ] sources += [ "../../../../services/edm_plugin/src/set_browser_policies_plugin.cpp", ] } if (bluetooth_edm_enable) { external_deps += [ "bluetooth:btframework" ] sources += [ "../../../../services/edm_plugin/src/allowed_bluetooth_devices_plugin.cpp", "../../../../services/edm_plugin/src/disable_bluetooth_plugin.cpp", "../../../../services/edm_plugin/src/get_bluetooth_info_plugin.cpp", ] } if (location_edm_enable) { external_deps += [ "location:locator_sdk" ] sources += [ "../../../../services/edm_plugin/src/location_policy_plugin.cpp" ] } if (telephony_core_edm_enable) { external_deps += [ "core_service:tel_core_service_api" ] defines += [ "TELEPHONY_CORE_EDM_ENABLE_TEST" ] } if (pasteboard_edm_enable) { external_deps += [ "pasteboard:pasteboard_client" ] sources += [ "../../../../services/edm_plugin/src/clipboard_policy_plugin.cpp", "../../../../services/edm_plugin/src/utils/clipboard_policy_serializer.cpp", "../../../../services/edm_plugin/src/utils/clipboard_utils.cpp", ] } if (camera_framework_edm_enable) { external_deps += [ "camera_framework:camera_framework" ] sources += [ "../../../../services/edm_plugin/src/disable_camera_plugin.cpp" ] } sanitize = { boundary_sanitize = true cfi = true cfi_cross_dso = true debug = false integer_overflow = true ubsan = true } branch_protector_ret = "pac_ret" subsystem_name = "customization" part_name = "enterprise_device_management" } group("unittest") { testonly = true deps = [ # deps file ":EdmFingerPrintPluginTest", ":EdmPluginTest", ] }