1# Copyright (c) 2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/test.gni") 15import("../../../../common/config/common.gni") 16 17module_output_path = "enterprise_device_management/enterprise_device_management" 18 19ohos_unittest("EdmInnerApiUnitTest") { 20 module_out_path = module_output_path 21 22 include_dirs = [ 23 "./proxy/mock/include", 24 "../../common/mock/include", 25 ] 26 27 sources = [ 28 "../../common/mock/src/edm_sys_manager_mock.cpp", 29 "./common/domain_account_policy_test.cpp", 30 "./common/ent_info_test.cpp", 31 ] 32 33 configs = [ 34 "../../../../common/config:coverage_flags", 35 "../../../../services/idl:enterprise_device_mgr_idl_gen_config", 36 ] 37 38 deps = [ 39 "../../../../common/native:edm_commom", 40 "../../../../interfaces/inner_api:edmservice_kits", 41 "../../../../services/idl:enterprise_device_mgr_idl_proxy", 42 "../../utils:edm_unittest_utils", 43 ] 44 45 external_deps = [ 46 "ability_base:want", 47 "access_token:libaccesstoken_sdk", 48 "access_token:libnativetoken", 49 "access_token:libtoken_setproc", 50 "bundle_framework:appexecfwk_base", 51 "bundle_framework:appexecfwk_core", 52 "c_utils:utils", 53 "googletest:gmock_main", 54 "hilog:libhilog", 55 "init:libbegetutil", 56 "ipc:ipc_core", 57 "samgr:samgr_proxy", 58 ] 59 60 defines = [] 61 if (os_account_edm_enable && netmanager_base_edm_enable && 62 netmanager_ext_edm_enable) { 63 external_deps += [ 64 "netmanager_base:net_conn_manager_if", 65 "os_account:os_account_innerkits", 66 ] 67 sources += [ 68 "./proxy/account_manager_proxy_test.cpp", 69 "./proxy/bundle_manager_proxy_test.cpp", 70 "./proxy/device_info_proxy_test.cpp", 71 "./proxy/enterprise_device_mgr_proxy_test.cpp", 72 "./proxy/mock/src/enterprise_device_mgr_stub_mock.cpp", 73 "./proxy/network_manager_proxy_test.cpp", 74 "./proxy/security_manager_proxy_test.cpp", 75 "./proxy/system_manager_proxy_test.cpp", 76 "./proxy/update_policy_utils_test.cpp", 77 ] 78 defines += [ 79 "OS_ACCOUNT_EDM_ENABLE", 80 "NETMANAGER_BASE_EDM_ENABLE", 81 ] 82 } 83 84 if (os_account_edm_enable && netmanager_base_edm_enable && 85 netmanager_ext_edm_enable && ability_runtime_edm_enable) { 86 sources += [ "./proxy/application_manager_proxy_test.cpp" ] 87 } 88 89 if (os_account_edm_enable && netmanager_base_edm_enable && 90 netmanager_ext_edm_enable && bluetooth_edm_enable) { 91 sources += [ "./proxy/bluetooth_manager_proxy_test.cpp" ] 92 } 93 94 if (os_account_edm_enable && netmanager_base_edm_enable && 95 netmanager_ext_edm_enable && common_event_service_edm_enable) { 96 sources += [ "./proxy/browser_proxy_test.cpp" ] 97 } 98 99 if (time_service_edm_enable && os_account_edm_enable && 100 netmanager_base_edm_enable && netmanager_ext_edm_enable) { 101 sources += [ "./proxy/datetime_manager_proxy_test.cpp" ] 102 } 103 104 if (os_account_edm_enable && netmanager_base_edm_enable && 105 netmanager_ext_edm_enable && screenlock_mgr_edm_enable && 106 power_manager_edm_enable && update_service_edm_enable) { 107 sources += [ "./proxy/device_control_proxy_test.cpp" ] 108 } 109 110 if (os_account_edm_enable && netmanager_base_edm_enable && 111 netmanager_ext_edm_enable && certificate_manager_edm_enable) { 112 sources += [ "./proxy/device_settings_proxy_test.cpp" ] 113 } 114 115 if (os_account_edm_enable && netmanager_base_edm_enable && 116 netmanager_ext_edm_enable && location_edm_enable) { 117 sources += [ "./proxy/location_manager_proxy_test.cpp" ] 118 } 119 120 if (os_account_edm_enable && netmanager_base_edm_enable && 121 netmanager_ext_edm_enable && audio_framework_edm_enable) { 122 sources += [ "./proxy/restrictions_proxy_test.cpp" ] 123 } 124 125 if (os_account_edm_enable && netmanager_base_edm_enable && 126 netmanager_ext_edm_enable && drivers_interface_usb_edm_enable && 127 usb_manager_edm_enable && storage_service_edm_enable) { 128 external_deps += [ "usb_manager:usbsrv_client" ] 129 sources += [ "./proxy/usb_manager_proxy_test.cpp" ] 130 defines += [ "USB_EDM_ENABLE" ] 131 } 132 133 if (os_account_edm_enable && netmanager_base_edm_enable && 134 netmanager_ext_edm_enable && wifi_edm_enable) { 135 external_deps += [ "wifi:wifi_sdk" ] 136 sources += [ "./proxy/wifi_manager_proxy_test.cpp" ] 137 defines += [ "WIFI_EDM_ENABLE" ] 138 } 139 140 if (os_account_edm_enable && netmanager_base_edm_enable && 141 netmanager_ext_edm_enable && cellular_data_edm_enable) { 142 sources += [ "./proxy/telephony_manager_proxy_test.cpp" ] 143 defines += [ "TELEPHONY_EDM_ENABLE" ] 144 } 145 146 sanitize = { 147 boundary_sanitize = true 148 cfi = true 149 cfi_cross_dso = true 150 debug = false 151 integer_overflow = true 152 ubsan = true 153 blocklist = "../../cfi_blocklist.txt" 154 } 155 branch_protector_ret = "pac_ret" 156 subsystem_name = "customization" 157 part_name = "enterprise_device_management" 158} 159 160group("unittest") { 161 testonly = true 162 163 deps = [ 164 # deps file 165 ":EdmInnerApiUnitTest", 166 ] 167} 168