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("//build/test.gni") 15import("//foundation/ability/ability_base/ability_base.gni") 16 17###################################################################### 18base_output_path = "aafwk/base_test" 19 20###################################################################### 21config("base_private_config") { 22 visibility = [ ":*" ] 23} 24 25ohos_unittest("base_object_test") { 26 module_out_path = base_output_path 27 sources = [ "base/base_object_test.cpp" ] 28 29 configs = [ ":base_private_config" ] 30 31 deps = [ "//third_party/googletest:gtest_main" ] 32 33 external_deps = [ 34 "ability_base:base", 35 "c_utils:utils", 36 ] 37} 38 39ohos_unittest("base_test") { 40 module_out_path = base_output_path 41 sources = [ "base/base_test.cpp" ] 42 43 configs = [ ":base_private_config" ] 44 45 deps = [ "//third_party/googletest:gtest_main" ] 46 47 external_deps = [ 48 "ability_base:base", 49 "c_utils:utils", 50 ] 51} 52 53ohos_unittest("bool_wrapper_test") { 54 module_out_path = base_output_path 55 sources = [ "base/bool_wrapper_test.cpp" ] 56 57 configs = [ ":base_private_config" ] 58 59 deps = [ "//third_party/googletest:gtest_main" ] 60 61 external_deps = [ 62 "ability_base:base", 63 "c_utils:utils", 64 ] 65} 66 67ohos_unittest("byte_wrapper_test") { 68 module_out_path = base_output_path 69 sources = [ "base/byte_wrapper_test.cpp" ] 70 71 configs = [ ":base_private_config" ] 72 73 deps = [ "//third_party/googletest:gtest_main" ] 74 75 external_deps = [ 76 "ability_base:base", 77 "c_utils:utils", 78 ] 79} 80 81ohos_unittest("double_wrapper_test") { 82 module_out_path = base_output_path 83 sources = [ "base/double_wrapper_test.cpp" ] 84 85 configs = [ ":base_private_config" ] 86 87 deps = [ "//third_party/googletest:gtest_main" ] 88 89 external_deps = [ 90 "ability_base:base", 91 "c_utils:utils", 92 ] 93} 94 95ohos_unittest("float_wrapper_test") { 96 module_out_path = base_output_path 97 sources = [ "base/float_wrapper_test.cpp" ] 98 99 configs = [ ":base_private_config" ] 100 101 deps = [ "//third_party/googletest:gtest_main" ] 102 103 external_deps = [ 104 "ability_base:base", 105 "c_utils:utils", 106 ] 107} 108 109ohos_unittest("int_wrapper_test") { 110 module_out_path = base_output_path 111 sources = [ "base/int_wrapper_test.cpp" ] 112 113 configs = [ ":base_private_config" ] 114 115 deps = [ "//third_party/googletest:gtest_main" ] 116 117 external_deps = [ 118 "ability_base:base", 119 "c_utils:utils", 120 ] 121} 122 123ohos_unittest("long_wrapper_test") { 124 module_out_path = base_output_path 125 sources = [ "base/long_wrapper_test.cpp" ] 126 127 configs = [ ":base_private_config" ] 128 129 deps = [ "//third_party/googletest:gtest_main" ] 130 131 external_deps = [ 132 "ability_base:base", 133 "c_utils:utils", 134 ] 135} 136 137###################################################################### 138want_output_path = "ability_base/want_test" 139 140###################################################################### 141config("want_private_config") { 142 defines = [ "ABILITYBASE_LOG_TAG = \"WantUnitTest\"" ] 143} 144 145config("module_private_want_param_wrapper_config") { 146 defines = [ "ABILITYBASE_LOG_TAG = \"WantUnitTest\"" ] 147} 148 149ohos_unittest("operation_test") { 150 module_out_path = want_output_path 151 sources = [ "want/operation_test.cpp" ] 152 153 configs = [ 154 ":want_private_config", 155 "${ability_base_path}:want_public_config", 156 ] 157 158 deps = [ "//third_party/googletest:gtest_main" ] 159 160 external_deps = [ 161 "ability_base:base", 162 "ability_base:want", 163 "ability_base:zuri", 164 "bundle_framework:appexecfwk_base", 165 "c_utils:utils", 166 ] 167} 168 169ohos_unittest("patterns_matcher_test") { 170 module_out_path = want_output_path 171 sources = [ "want/patterns_matcher_test.cpp" ] 172 173 configs = [ 174 ":want_private_config", 175 "${ability_base_path}:want_public_config", 176 ] 177 178 deps = [ 179 "${ability_base_path}:base", 180 "//third_party/googletest:gtest_main", 181 ] 182 183 external_deps = [ 184 "ability_base:want", 185 "bundle_framework:appexecfwk_base", 186 "c_utils:utils", 187 "hilog:libhilog", 188 ] 189} 190 191ohos_unittest("skills_test") { 192 module_out_path = want_output_path 193 sources = [ "want/skills_test.cpp" ] 194 195 configs = [ 196 ":want_private_config", 197 "${ability_base_path}:want_public_config", 198 ] 199 200 deps = [ "//third_party/googletest:gtest_main" ] 201 202 external_deps = [ 203 "ability_base:base", 204 "ability_base:want", 205 "ability_base:zuri", 206 "bundle_framework:appexecfwk_base", 207 "c_utils:utils", 208 "hilog:libhilog", 209 ] 210} 211 212ohos_unittest("want_params_test") { 213 module_out_path = want_output_path 214 sources = [ "want/want_params_test.cpp" ] 215 216 configs = [ 217 ":want_private_config", 218 "${ability_base_path}:want_public_config", 219 ] 220 221 deps = [ 222 "${ability_base_path}:base", 223 "${ability_base_path}:want", 224 "//third_party/googletest:gtest_main", 225 ] 226 227 external_deps = [ 228 "bundle_framework:appexecfwk_base", 229 "c_utils:utils", 230 "hilog:libhilog", 231 "ipc:ipc_core", 232 ] 233} 234 235ohos_unittest("want_params_wrapper_test") { 236 module_out_path = want_output_path 237 sources = [ "want/want_params_wrapper_test.cpp" ] 238 239 configs = [ ":module_private_want_param_wrapper_config" ] 240 241 deps = [ "//third_party/googletest:gtest_main" ] 242 243 external_deps = [ 244 "ability_base:base", 245 "ability_base:want", 246 "ability_base:zuri", 247 "bundle_framework:appexecfwk_base", 248 "c_utils:utils", 249 "hilog:libhilog", 250 "ipc:ipc_core", 251 ] 252} 253 254ohos_unittest("want_test") { 255 module_out_path = want_output_path 256 sources = [ "want/want_test.cpp" ] 257 258 configs = [ 259 ":want_private_config", 260 "${ability_base_path}:want_public_config", 261 ] 262 263 deps = [ "//third_party/googletest:gtest_main" ] 264 265 external_deps = [ 266 "ability_base:base", 267 "ability_base:want", 268 "ability_base:zuri", 269 "bundle_framework:appexecfwk_base", 270 "c_utils:utils", 271 "hilog:libhilog", 272 ] 273} 274 275ohos_unittest("uri_test") { 276 module_out_path = want_output_path 277 sources = [ "want/uri_test.cpp" ] 278 279 configs = [ 280 ":want_private_config", 281 "${ability_base_path}:want_public_config", 282 ] 283 284 deps = [ "//third_party/googletest:gtest_main" ] 285 286 external_deps = [ 287 "ability_base:base", 288 "ability_base:want", 289 "ability_base:zuri", 290 "bundle_framework:appexecfwk_base", 291 "c_utils:utils", 292 "hilog:libhilog", 293 ] 294} 295 296ohos_unittest("extra_params_test") { 297 module_out_path = want_output_path 298 sources = [ "want/extra_params_test.cpp" ] 299 300 configs = [ 301 ":want_private_config", 302 "${ability_base_path}:want_public_config", 303 ] 304 305 deps = [ "//third_party/googletest:gtest_main" ] 306 307 external_deps = [ 308 "ability_base:base", 309 "ability_base:want", 310 "ability_base:zuri", 311 "bundle_framework:appexecfwk_base", 312 "c_utils:utils", 313 ] 314} 315 316ohos_unittest("array_wrapper_test") { 317 module_out_path = want_output_path 318 sources = [ "want/array_wrapper_test.cpp" ] 319 320 configs = [ 321 ":want_private_config", 322 "${ability_base_path}:want_public_config", 323 ] 324 325 deps = [ "//third_party/googletest:gtest_main" ] 326 327 external_deps = [ 328 "ability_base:base", 329 "ability_base:want", 330 "ability_base:zuri", 331 "bundle_framework:appexecfwk_base", 332 "c_utils:utils", 333 ] 334} 335 336ohos_unittest("zchar_wrapper_test") { 337 module_out_path = base_output_path 338 sources = [ "base/zchar_wrapper_test.cpp" ] 339 340 configs = [ 341 ":want_private_config", 342 "${ability_base_path}:want_public_config", 343 ] 344 345 deps = [ "//third_party/googletest:gtest_main" ] 346 347 external_deps = [ 348 "ability_base:base", 349 "ability_base:want", 350 "ability_base:zuri", 351 "bundle_framework:appexecfwk_base", 352 "c_utils:utils", 353 ] 354} 355 356ohos_unittest("short_wrapper_test") { 357 module_out_path = base_output_path 358 sources = [ "base/short_wrapper_test.cpp" ] 359 360 configs = [ 361 ":want_private_config", 362 "${ability_base_path}:want_public_config", 363 ] 364 365 deps = [ "//third_party/googletest:gtest_main" ] 366 367 external_deps = [ 368 "ability_base:base", 369 "ability_base:want", 370 "ability_base:zuri", 371 "bundle_framework:appexecfwk_base", 372 "c_utils:utils", 373 ] 374} 375 376ohos_unittest("string_wrapper_test") { 377 module_out_path = base_output_path 378 sources = [ "base/string_wrapper_test.cpp" ] 379 380 configs = [ 381 ":want_private_config", 382 "${ability_base_path}:want_public_config", 383 ] 384 385 deps = [ "//third_party/googletest:gtest_main" ] 386 387 external_deps = [ 388 "ability_base:base", 389 "ability_base:want", 390 "ability_base:zuri", 391 "bundle_framework:appexecfwk_base", 392 "c_utils:utils", 393 ] 394} 395 396ohos_unittest("user_object_wrapper_test") { 397 module_out_path = base_output_path 398 sources = [ "base/user_object_wrapper_test.cpp" ] 399 400 configs = [ 401 ":want_private_config", 402 "${ability_base_path}:want_public_config", 403 ] 404 405 deps = [ "//third_party/googletest:gtest_main" ] 406 407 external_deps = [ 408 "ability_base:base", 409 "ability_base:want", 410 "ability_base:zuri", 411 "bundle_framework:appexecfwk_base", 412 "c_utils:utils", 413 ] 414} 415 416###################################################################### 417extractor_output_path = "ability_base/extractor_test" 418 419###################################################################### 420config("extractor_private_config") { 421 visibility = [ ":*" ] 422 include_dirs = [ 423 "{ability_base_path}/interfaces/kits/native/extractor/include", 424 "//third_party/zlib/contrib/minizip", 425 "//third_party/zlib", 426 ] 427 428 defines = [ "ABILITYBASE_LOG_TAG = \"ExtractorTest\"" ] 429} 430 431ohos_unittest("extractor_test") { 432 module_out_path = extractor_output_path 433 sources = [ "extractor/extractor_test.cpp" ] 434 435 configs = [ ":extractor_private_config" ] 436 437 deps = [ 438 "//third_party/googletest:gtest_main", 439 "//third_party/zlib:shared_libz", 440 ] 441 442 external_deps = [ 443 "ability_base:extractortool", 444 "ability_base:extractresourcemanager", 445 "ability_base:string_utils", 446 "c_utils:utils", 447 "hilog:libhilog", 448 ] 449} 450 451###################################################################### 452viewdata_output_path = "ability_base/view_data_test" 453 454###################################################################### 455config("viewdata_private_config") { 456 visibility = [ ":*" ] 457 include_dirs = [ 458 "{ability_base_path}/interfaces/kits/native/view_data/include", 459 "//third_party/zlib/contrib/minizip", 460 "//third_party/zlib", 461 ] 462 463 defines = [ "ABILITYBASE_LOG_TAG = \"ViewDataTest\"" ] 464} 465 466ohos_unittest("view_data_test") { 467 module_out_path = viewdata_output_path 468 sources = [ "viewdata/view_data_test.cpp" ] 469 470 configs = [ ":viewdata_private_config" ] 471 472 deps = [ 473 "//third_party/googletest:gtest_main", 474 "//third_party/zlib:shared_libz", 475 ] 476 477 external_deps = [ 478 "ability_base:base", 479 "ability_base:session_info", 480 "ability_base:string_utils", 481 "ability_base:view_data", 482 "ability_base:want", 483 "ability_base:zuri", 484 "c_utils:utils", 485 "hilog:libhilog", 486 ] 487} 488 489###################################################################### 490 491group("unittest") { 492 testonly = true 493 deps = [ 494 #":base_test", 495 ":array_wrapper_test", 496 ":base_object_test", 497 ":bool_wrapper_test", 498 ":byte_wrapper_test", 499 ":double_wrapper_test", 500 ":extra_params_test", 501 ":extractor_test", 502 ":float_wrapper_test", 503 ":int_wrapper_test", 504 ":long_wrapper_test", 505 ":operation_test", 506 ":patterns_matcher_test", 507 ":short_wrapper_test", 508 ":skills_test", 509 ":string_wrapper_test", 510 ":uri_test", 511 ":user_object_wrapper_test", 512 ":view_data_test", 513 ":want_params_test", 514 ":want_params_wrapper_test", 515 ":want_test", 516 ":zchar_wrapper_test", 517 ] 518} 519