1# Copyright (c) 2021-2023 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("//base/notification/distributed_notification_service/notification.gni") 15import("//build/ohos.gni") 16import("//build/test.gni") 17 18module_output_path = "${component_name}/moduletest" 19 20config("public_ans_config") { 21 include_dirs = [ 22 "${core_path}/common/include", 23 "${services_path}/ans/include", 24 "${core_path}/include", 25 ] 26} 27 28ohos_moduletest("ans_fw_module_test") { 29 module_out_path = module_output_path 30 include_dirs = [ 31 "include", 32 "${core_path}/include", 33 "${inner_api_path}", 34 "${core_path}/common/include", 35 "${core_path}/include", 36 "${component_path}/services/ans/include", 37 "//third_party/json/include", 38 "${inner_api_path}", 39 "${core_path}/common/include", 40 "${core_path}/include", 41 "${inner_api_path}", 42 "${frameworks_path}/test/moduletest/mock/include", 43 "${ffrt_path}/interfaces/kits", 44 ] 45 46 sources = [ 47 "ans_fw_module_test.cpp", 48 "mock/blob.cpp", 49 "mock/distributed_kv_data_manager.cpp", 50 "mock/mock_accesstoken_kit.cpp", 51 "mock/mock_bundle_manager.cpp", 52 "mock/mock_bundle_manager_helper.cpp", 53 "mock/mock_bundle_mgr_proxy.cpp", 54 "mock/mock_change_notification.cpp", 55 "mock/mock_common_event_data.cpp", 56 "mock/mock_common_event_manager.cpp", 57 "mock/mock_ipc.cpp", 58 "mock/mock_single_kv_store.cpp", 59 ] 60 61 deps = [ 62 "${frameworks_module_ans_path}:ans_innerkits", 63 "${services_path}/ans:libans", 64 "//third_party/googletest:gtest_main", 65 ] 66 67 defines = [] 68 if (distributed_notification_supported) { 69 defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] 70 deps += [ "${services_path}/distributed:libans_distributed" ] 71 } 72 73 external_deps = [ 74 "ability_base:want", 75 "ability_base:zuri", 76 "ability_runtime:wantagent_innerkits", 77 "access_token:libaccesstoken_sdk", 78 "bundle_framework:appexecfwk_base", 79 "bundle_framework:appexecfwk_core", 80 "c_utils:utils", 81 "common_event_service:cesfwk_innerkits", 82 "eventhandler:libeventhandler", 83 "ffrt:libffrt", 84 "hilog:libhilog", 85 "image_framework:image_native", 86 "ipc:ipc_core", 87 "kv_store:distributeddata_inner", 88 "relational_store:native_rdb", 89 "safwk:system_ability_fwk", 90 "samgr:samgr_proxy", 91 ] 92 93 subsystem_name = "${subsystem_name}" 94 part_name = "${component_name}" 95} 96 97ohos_moduletest("ans_innerkits_module_publish_test") { 98 sanitize = { 99 integer_overflow = true 100 ubsan = true 101 boundary_sanitize = true 102 cfi = true 103 cfi_cross_dso = true 104 debug = false 105 } 106 107 module_out_path = module_output_path 108 include_dirs = [ 109 "include", 110 "${core_path}/include", 111 "${inner_api_path}", 112 "${core_path}/common/include", 113 "${core_path}/include", 114 "${component_path}/services/ans/include", 115 "//third_party/json/include", 116 "${inner_api_path}", 117 "${core_path}/common/include", 118 "${core_path}/include", 119 "${inner_api_path}", 120 "${frameworks_path}/test/moduletest/mock/include", 121 "${ffrt_path}/interfaces/kits", 122 ] 123 124 sources = [ 125 "${test_path}/mock/mock_tokenid_kit.cpp", 126 "ans_innerkits_module_publish_test.cpp", 127 "mock/mock_accesstoken_kit.cpp", 128 "mock/mock_bundle_manager.cpp", 129 "mock/mock_bundle_manager_helper.cpp", 130 "mock/mock_ipc.cpp", 131 "mock/remote_native_token.cpp", 132 ] 133 134 deps = [ 135 "${ability_runtime_path}/frameworks/native/appkit:app_context", 136 "${frameworks_module_ans_path}:ans_innerkits", 137 "${services_path}/ans:libans", 138 "//third_party/googletest:gtest_main", 139 ] 140 141 defines = [] 142 if (distributed_notification_supported) { 143 defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] 144 deps += [ "${services_path}/distributed:libans_distributed" ] 145 } 146 147 external_deps = [ 148 "ability_base:base", 149 "ability_base:want", 150 "ability_base:zuri", 151 "ability_runtime:wantagent_innerkits", 152 "access_token:libaccesstoken_sdk", 153 "access_token:libnativetoken", 154 "access_token:libtoken_setproc", 155 "bundle_framework:appexecfwk_base", 156 "bundle_framework:appexecfwk_core", 157 "c_utils:utils", 158 "common_event_service:cesfwk_innerkits", 159 "eventhandler:libeventhandler", 160 "ffrt:libffrt", 161 "hilog:libhilog", 162 "image_framework:image_native", 163 "ipc:ipc_core", 164 "kv_store:distributeddata_inner", 165 "relational_store:native_rdb", 166 "safwk:system_ability_fwk", 167 "samgr:samgr_proxy", 168 ] 169 170 subsystem_name = "${subsystem_name}" 171 part_name = "${component_name}" 172} 173 174ohos_moduletest("ans_innerkits_module_slot_test") { 175 module_out_path = module_output_path 176 include_dirs = [ 177 "include", 178 "${core_path}/include", 179 "${inner_api_path}", 180 "${frameworks_path}/ans/core/common/include", 181 "${frameworks_path}/ans/core/include", 182 "${component_path}/services/ans/include", 183 "//third_party/json/include", 184 "${inner_api_path}", 185 "${core_path}/common/include", 186 "${core_path}/include", 187 "${inner_api_path}", 188 "${frameworks_path}/test/moduletest/mock/include", 189 "${ffrt_path}/interfaces/kits", 190 ] 191 192 sources = [ 193 "${test_path}/mock/mock_tokenid_kit.cpp", 194 "ans_innerkits_module_slot_test.cpp", 195 "mock/distributed_kv_data_manager.cpp", 196 "mock/mock_accesstoken_kit.cpp", 197 "mock/mock_bundle_manager.cpp", 198 "mock/mock_bundle_manager_helper.cpp", 199 "mock/mock_ipc.cpp", 200 "mock/mock_single_kv_store.cpp", 201 "mock/remote_native_token.cpp", 202 ] 203 204 deps = [ 205 "${frameworks_module_ans_path}:ans_innerkits", 206 "${services_path}/ans:libans", 207 "//third_party/googletest:gtest_main", 208 ] 209 210 defines = [] 211 if (distributed_notification_supported) { 212 defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] 213 deps += [ "${services_path}/distributed:libans_distributed" ] 214 } 215 216 external_deps = [ 217 "ability_base:want", 218 "ability_base:zuri", 219 "ability_runtime:wantagent_innerkits", 220 "access_token:libaccesstoken_sdk", 221 "access_token:libnativetoken", 222 "access_token:libtoken_setproc", 223 "bundle_framework:appexecfwk_base", 224 "bundle_framework:appexecfwk_core", 225 "c_utils:utils", 226 "common_event_service:cesfwk_innerkits", 227 "eventhandler:libeventhandler", 228 "ffrt:libffrt", 229 "hilog:libhilog", 230 "image_framework:image_native", 231 "ipc:ipc_core", 232 "kv_store:distributeddata_inner", 233 "relational_store:native_rdb", 234 "safwk:system_ability_fwk", 235 "samgr:samgr_proxy", 236 ] 237 238 subsystem_name = "${subsystem_name}" 239 part_name = "${component_name}" 240} 241 242ohos_moduletest("ans_innerkits_module_setting_test") { 243 sanitize = { 244 integer_overflow = true 245 ubsan = true 246 boundary_sanitize = true 247 cfi = true 248 cfi_cross_dso = true 249 debug = false 250 } 251 252 module_out_path = module_output_path 253 include_dirs = [ 254 "include", 255 "${core_path}/include", 256 "${inner_api_path}", 257 "${frameworks_path}/ans/core/common/include", 258 "${frameworks_path}/ans/core/include", 259 "${component_path}/services/ans/include", 260 "//third_party/json/include", 261 "${inner_api_path}", 262 "${core_path}/common/include", 263 "${core_path}/include", 264 "${inner_api_path}", 265 "${frameworks_path}/test/moduletest/mock/include", 266 "${ffrt_path}/interfaces/kits", 267 ] 268 269 sources = [ 270 "ans_innerkits_module_setting_test.cpp", 271 "mock/distributed_kv_data_manager.cpp", 272 "mock/mock_bundle_manager_helper.cpp", 273 "mock/mock_ipc.cpp", 274 "mock/mock_single_kv_store.cpp", 275 "mock/remote_native_token.cpp", 276 ] 277 278 deps = [ 279 "${frameworks_module_ans_path}:ans_innerkits", 280 "${services_path}/ans:libans", 281 "//third_party/googletest:gtest_main", 282 ] 283 284 defines = [] 285 if (distributed_notification_supported) { 286 defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] 287 deps += [ "${services_path}/distributed:libans_distributed" ] 288 } 289 290 external_deps = [ 291 "ability_base:want", 292 "ability_base:zuri", 293 "ability_runtime:wantagent_innerkits", 294 "access_token:libaccesstoken_sdk", 295 "access_token:libnativetoken", 296 "access_token:libtoken_setproc", 297 "bundle_framework:appexecfwk_base", 298 "bundle_framework:appexecfwk_core", 299 "c_utils:utils", 300 "common_event_service:cesfwk_innerkits", 301 "eventhandler:libeventhandler", 302 "ffrt:libffrt", 303 "hilog:libhilog", 304 "image_framework:image_native", 305 "ipc:ipc_core", 306 "kv_store:distributeddata_inner", 307 "relational_store:native_rdb", 308 "safwk:system_ability_fwk", 309 "samgr:samgr_proxy", 310 ] 311 312 subsystem_name = "${subsystem_name}" 313 part_name = "${component_name}" 314} 315 316ohos_js_unittest("ReminderAgentJsTest") { 317 module_out_path = module_output_path 318 319 hap_profile = "./config.json" 320 certificate_profile = 321 "//test/testfwk/developer_test/signature/openharmony_sx.p7b" 322} 323 324group("moduletest") { 325 testonly = true 326 deps = [] 327 328 deps += [ 329 # ":ReminderAgentJsTest", 330 331 # ":ans_fw_module_test", 332 ":ans_innerkits_module_publish_test", 333 ":ans_innerkits_module_setting_test", 334 ":ans_innerkits_module_slot_test", 335 ] 336} 337