1# Copyright (c) 2021-2022 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 "//commonlibrary/c_utils/base/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 "//commonlibrary/c_utils/base/include", 38 "//utils/system/safwk/native/include", 39 "${component_path}/services/ans/include", 40 "//third_party/json/include", 41 "${inner_api_path}", 42 "${core_path}/common/include", 43 "${core_path}/include", 44 "${inner_api_path}", 45 "//commonlibrary/c_utils/base/include", 46 "${frameworks_path}/test/moduletest/mock/include", 47 ] 48 49 sources = [ 50 "ans_fw_module_test.cpp", 51 "mock/blob.cpp", 52 "mock/distributed_kv_data_manager.cpp", 53 "mock/mock_accesstoken_kit.cpp", 54 "mock/mock_bundle_manager.cpp", 55 "mock/mock_bundle_manager_helper.cpp", 56 "mock/mock_bundle_mgr_proxy.cpp", 57 "mock/mock_change_notification.cpp", 58 "mock/mock_common_event_data.cpp", 59 "mock/mock_common_event_manager.cpp", 60 "mock/mock_ipc.cpp", 61 "mock/mock_single_kv_store.cpp", 62 ] 63 64 configs = [ "//commonlibrary/c_utils/base:utils_config" ] 65 66 deps = [ 67 "${core_path}:ans_core", 68 "${frameworks_module_ans_path}:ans_innerkits", 69 "${services_path}/ans:libans", 70 "//third_party/googletest:gtest_main", 71 ] 72 73 defines = [] 74 if (distributed_notification_supported) { 75 defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] 76 deps += [ "${services_path}/distributed:libans_distributed" ] 77 } 78 79 external_deps = [ 80 "ability_base:want", 81 "ability_base:zuri", 82 "ability_runtime:wantagent_innerkits", 83 "access_token:libaccesstoken_sdk", 84 "bundle_framework:appexecfwk_base", 85 "bundle_framework:appexecfwk_core", 86 "c_utils:utils", 87 "common_event_service:cesfwk_innerkits", 88 "eventhandler:libeventhandler", 89 "hiviewdfx_hilog_native:libhilog", 90 "ipc:ipc_core", 91 "kv_store:distributeddata_inner", 92 "multimedia_image_framework:image_native", 93 "relational_store:native_rdb", 94 "safwk:system_ability_fwk", 95 "samgr:samgr_proxy", 96 ] 97 98 subsystem_name = "${subsystem_name}" 99 part_name = "${component_name}" 100} 101 102ohos_moduletest("ans_innerkits_module_publish_test") { 103 module_out_path = module_output_path 104 include_dirs = [ 105 "include", 106 "${core_path}/include", 107 "${inner_api_path}", 108 "${core_path}/common/include", 109 "${core_path}/include", 110 "//commonlibrary/c_utils/base/include", 111 "//utils/system/safwk/native/include", 112 "${component_path}/services/ans/include", 113 "//third_party/json/include", 114 "${inner_api_path}", 115 "${core_path}/common/include", 116 "${core_path}/include", 117 "${inner_api_path}", 118 "//commonlibrary/c_utils/base/include", 119 "${frameworks_path}/test/moduletest/mock/include", 120 ] 121 122 sources = [ 123 "ans_innerkits_module_publish_test.cpp", 124 "mock/mock_accesstoken_kit.cpp", 125 "mock/mock_bundle_manager_helper.cpp", 126 "mock/mock_ipc.cpp", 127 "mock/remote_native_token.cpp", 128 ] 129 130 configs = [ "//commonlibrary/c_utils/base:utils_config" ] 131 132 deps = [ 133 "${ability_runtime_path}/frameworks/native/appkit:app_context", 134 "${core_path}:ans_core", 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 "hiviewdfx_hilog_native:libhilog", 160 "ipc:ipc_core", 161 "kv_store:distributeddata_inner", 162 "multimedia_image_framework:image_native", 163 "relational_store:native_rdb", 164 "safwk:system_ability_fwk", 165 "samgr:samgr_proxy", 166 ] 167 168 subsystem_name = "${subsystem_name}" 169 part_name = "${component_name}" 170} 171 172ohos_moduletest("ans_innerkits_module_slot_test") { 173 module_out_path = module_output_path 174 include_dirs = [ 175 "include", 176 "${core_path}/include", 177 "${inner_api_path}", 178 "${frameworks_path}/ans/core/common/include", 179 "${frameworks_path}/ans/core/include", 180 "//commonlibrary/c_utils/base/include", 181 "//utils/system/safwk/native/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 "//commonlibrary/c_utils/base/include", 189 "${frameworks_path}/test/moduletest/mock/include", 190 ] 191 192 sources = [ 193 "ans_innerkits_module_slot_test.cpp", 194 "mock/distributed_kv_data_manager.cpp", 195 "mock/mock_bundle_manager_helper.cpp", 196 "mock/mock_ipc.cpp", 197 "mock/mock_single_kv_store.cpp", 198 "mock/remote_native_token.cpp", 199 ] 200 201 configs = [ "//commonlibrary/c_utils/base:utils_config" ] 202 203 deps = [ 204 "${core_path}:ans_core", 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 "hiviewdfx_hilog_native:libhilog", 229 "ipc:ipc_core", 230 "kv_store:distributeddata_inner", 231 "multimedia_image_framework:image_native", 232 "relational_store:native_rdb", 233 "safwk:system_ability_fwk", 234 "samgr:samgr_proxy", 235 ] 236 237 subsystem_name = "${subsystem_name}" 238 part_name = "${component_name}" 239} 240 241ohos_moduletest("ans_innerkits_module_setting_test") { 242 module_out_path = module_output_path 243 include_dirs = [ 244 "include", 245 "${core_path}/include", 246 "${inner_api_path}", 247 "${frameworks_path}/ans/core/common/include", 248 "${frameworks_path}/ans/core/include", 249 "//commonlibrary/c_utils/base/include", 250 "//utils/system/safwk/native/include", 251 "${component_path}/services/ans/include", 252 "//third_party/json/include", 253 "${inner_api_path}", 254 "${core_path}/common/include", 255 "${core_path}/include", 256 "${inner_api_path}", 257 "//commonlibrary/c_utils/base/include", 258 "${frameworks_path}/test/moduletest/mock/include", 259 ] 260 261 sources = [ 262 "ans_innerkits_module_setting_test.cpp", 263 "mock/distributed_kv_data_manager.cpp", 264 "mock/mock_bundle_manager_helper.cpp", 265 "mock/mock_ipc.cpp", 266 "mock/mock_single_kv_store.cpp", 267 "mock/remote_native_token.cpp", 268 ] 269 270 configs = [ "//commonlibrary/c_utils/base:utils_config" ] 271 272 deps = [ 273 "${core_path}:ans_core", 274 "${frameworks_module_ans_path}:ans_innerkits", 275 "${services_path}/ans:libans", 276 "//third_party/googletest:gtest_main", 277 ] 278 279 defines = [] 280 if (distributed_notification_supported) { 281 defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] 282 deps += [ "${services_path}/distributed:libans_distributed" ] 283 } 284 285 external_deps = [ 286 "ability_base:want", 287 "ability_base:zuri", 288 "ability_runtime:wantagent_innerkits", 289 "access_token:libaccesstoken_sdk", 290 "access_token:libnativetoken", 291 "access_token:libtoken_setproc", 292 "bundle_framework:appexecfwk_base", 293 "bundle_framework:appexecfwk_core", 294 "c_utils:utils", 295 "common_event_service:cesfwk_innerkits", 296 "eventhandler:libeventhandler", 297 "hiviewdfx_hilog_native:libhilog", 298 "ipc:ipc_core", 299 "kv_store:distributeddata_inner", 300 "multimedia_image_framework:image_native", 301 "relational_store:native_rdb", 302 "safwk:system_ability_fwk", 303 "samgr:samgr_proxy", 304 ] 305 306 subsystem_name = "${subsystem_name}" 307 part_name = "${component_name}" 308} 309 310ohos_js_unittest("ReminderAgentJsTest") { 311 module_out_path = module_output_path 312 313 hap_profile = "./config.json" 314 certificate_profile = 315 "//test/testfwk/developer_test/signature/openharmony_sx.p7b" 316} 317 318group("moduletest") { 319 testonly = true 320 deps = [] 321 322 deps += [ 323 ":ReminderAgentJsTest", 324 325 # ":ans_fw_module_test", 326 ":ans_innerkits_module_publish_test", 327 ":ans_innerkits_module_setting_test", 328 ":ans_innerkits_module_slot_test", 329 ] 330} 331