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 = 19 "${component_name}/distributed_notification_service/moduletest" 20 21config("public_ans_config") { 22 include_dirs = [ 23 "${core_path}/common/include", 24 "${services_path}/ans/include", 25 "${core_path}/include", 26 ] 27} 28 29ohos_moduletest("ans_fw_module_test") { 30 module_out_path = module_output_path 31 include_dirs = [ 32 "include", 33 "${core_path}/include", 34 "${inner_api_path}", 35 "${core_path}/common/include", 36 "${core_path}/include", 37 "${component_path}/services/ans/include", 38 "//third_party/json/include", 39 "${inner_api_path}", 40 "${core_path}/common/include", 41 "${core_path}/include", 42 "${inner_api_path}", 43 "${frameworks_path}/test/moduletest/mock/include", 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 ] 122 123 sources = [ 124 "${test_path}/mock/mock_tokenid_kit.cpp", 125 "ans_innerkits_module_publish_test.cpp", 126 "mock/mock_accesstoken_kit.cpp", 127 "mock/mock_bundle_manager.cpp", 128 "mock/mock_bundle_manager_helper.cpp", 129 "mock/mock_ipc.cpp", 130 "mock/remote_native_token.cpp", 131 ] 132 133 deps = [ 134 "${ability_runtime_path}/frameworks/native/appkit:app_context", 135 "${frameworks_module_ans_path}:ans_innerkits", 136 "${services_path}/ans:libans", 137 "//third_party/googletest:gtest_main", 138 ] 139 140 defines = [] 141 if (distributed_notification_supported) { 142 defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] 143 deps += [ "${services_path}/distributed:libans_distributed" ] 144 } 145 146 external_deps = [ 147 "ability_base:base", 148 "ability_base:want", 149 "ability_base:zuri", 150 "ability_runtime:wantagent_innerkits", 151 "access_token:libaccesstoken_sdk", 152 "access_token:libnativetoken", 153 "access_token:libtoken_setproc", 154 "bundle_framework:appexecfwk_base", 155 "bundle_framework:appexecfwk_core", 156 "c_utils:utils", 157 "common_event_service:cesfwk_innerkits", 158 "eventhandler:libeventhandler", 159 "ffrt:libffrt", 160 "hilog:libhilog", 161 "image_framework:image_native", 162 "ipc:ipc_core", 163 "kv_store:distributeddata_inner", 164 "relational_store:native_rdb", 165 "safwk:system_ability_fwk", 166 "samgr:samgr_proxy", 167 ] 168 169 subsystem_name = "${subsystem_name}" 170 part_name = "${component_name}" 171} 172 173ohos_moduletest("ans_innerkits_module_slot_test") { 174 module_out_path = module_output_path 175 include_dirs = [ 176 "include", 177 "${core_path}/include", 178 "${inner_api_path}", 179 "${frameworks_path}/ans/core/common/include", 180 "${frameworks_path}/ans/core/include", 181 "${component_path}/services/ans/include", 182 "//third_party/json/include", 183 "${inner_api_path}", 184 "${core_path}/common/include", 185 "${core_path}/include", 186 "${inner_api_path}", 187 "${frameworks_path}/test/moduletest/mock/include", 188 ] 189 190 sources = [ 191 "${test_path}/mock/mock_tokenid_kit.cpp", 192 "ans_innerkits_module_slot_test.cpp", 193 "mock/distributed_kv_data_manager.cpp", 194 "mock/mock_accesstoken_kit.cpp", 195 "mock/mock_bundle_manager.cpp", 196 "mock/mock_bundle_manager_helper.cpp", 197 "mock/mock_ipc.cpp", 198 "mock/mock_single_kv_store.cpp", 199 "mock/remote_native_token.cpp", 200 ] 201 202 deps = [ 203 "${frameworks_module_ans_path}:ans_innerkits", 204 "${services_path}/ans:libans", 205 "//third_party/googletest:gtest_main", 206 ] 207 208 defines = [] 209 if (distributed_notification_supported) { 210 defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] 211 deps += [ "${services_path}/distributed:libans_distributed" ] 212 } 213 214 external_deps = [ 215 "ability_base:want", 216 "ability_base:zuri", 217 "ability_runtime:wantagent_innerkits", 218 "access_token:libaccesstoken_sdk", 219 "access_token:libnativetoken", 220 "access_token:libtoken_setproc", 221 "bundle_framework:appexecfwk_base", 222 "bundle_framework:appexecfwk_core", 223 "c_utils:utils", 224 "common_event_service:cesfwk_innerkits", 225 "eventhandler:libeventhandler", 226 "ffrt:libffrt", 227 "hilog:libhilog", 228 "image_framework:image_native", 229 "ipc:ipc_core", 230 "kv_store:distributeddata_inner", 231 "relational_store:native_rdb", 232 "safwk:system_ability_fwk", 233 "samgr:samgr_proxy", 234 ] 235 236 subsystem_name = "${subsystem_name}" 237 part_name = "${component_name}" 238} 239 240ohos_moduletest("ans_innerkits_module_setting_test") { 241 sanitize = { 242 integer_overflow = true 243 ubsan = true 244 boundary_sanitize = true 245 cfi = true 246 cfi_cross_dso = true 247 debug = false 248 } 249 250 module_out_path = module_output_path 251 include_dirs = [ 252 "include", 253 "${core_path}/include", 254 "${inner_api_path}", 255 "${frameworks_path}/ans/core/common/include", 256 "${frameworks_path}/ans/core/include", 257 "${component_path}/services/ans/include", 258 "//third_party/json/include", 259 "${inner_api_path}", 260 "${core_path}/common/include", 261 "${core_path}/include", 262 "${inner_api_path}", 263 "${frameworks_path}/test/moduletest/mock/include", 264 ] 265 266 sources = [ 267 "ans_innerkits_module_setting_test.cpp", 268 "mock/distributed_kv_data_manager.cpp", 269 "mock/mock_bundle_manager_helper.cpp", 270 "mock/mock_ipc.cpp", 271 "mock/mock_single_kv_store.cpp", 272 "mock/remote_native_token.cpp", 273 ] 274 275 deps = [ 276 "${frameworks_module_ans_path}:ans_innerkits", 277 "${services_path}/ans:libans", 278 "//third_party/googletest:gtest_main", 279 ] 280 281 defines = [] 282 if (distributed_notification_supported) { 283 defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] 284 deps += [ "${services_path}/distributed:libans_distributed" ] 285 } 286 287 external_deps = [ 288 "ability_base:want", 289 "ability_base:zuri", 290 "ability_runtime:wantagent_innerkits", 291 "access_token:libaccesstoken_sdk", 292 "access_token:libnativetoken", 293 "access_token:libtoken_setproc", 294 "bundle_framework:appexecfwk_base", 295 "bundle_framework:appexecfwk_core", 296 "c_utils:utils", 297 "common_event_service:cesfwk_innerkits", 298 "eventhandler:libeventhandler", 299 "ffrt:libffrt", 300 "hilog:libhilog", 301 "image_framework:image_native", 302 "ipc:ipc_core", 303 "kv_store:distributeddata_inner", 304 "relational_store:native_rdb", 305 "safwk:system_ability_fwk", 306 "samgr:samgr_proxy", 307 ] 308 309 subsystem_name = "${subsystem_name}" 310 part_name = "${component_name}" 311} 312 313ohos_js_unittest("ReminderAgentJsTest") { 314 module_out_path = module_output_path 315 316 hap_profile = "./config.json" 317 certificate_profile = 318 "//test/testfwk/developer_test/signature/openharmony_sx.p7b" 319} 320 321group("moduletest") { 322 testonly = true 323 deps = [] 324 325 deps += [ 326 # ":ReminderAgentJsTest", 327 328 # ":ans_fw_module_test", 329 ":ans_innerkits_module_publish_test", 330 ":ans_innerkits_module_setting_test", 331 ":ans_innerkits_module_slot_test", 332 ] 333} 334