1# Copyright (c) 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/ohos.gni") 15import("//build/test.gni") 16import("//foundation/resourceschedule/background_task_mgr/bgtaskmgr.gni") 17 18module_output_path = "background_task_mgr/unittest" 19 20ohos_unittest("bgtask_framework_unit_test") { 21 module_out_path = module_output_path 22 cflags_cc = [ 23 "-Dprivate=public", 24 "-Dprotected=public", 25 ] 26 include_dirs = [ 27 "${bgtaskmgr_interfaces_path}/innerkits/include", 28 "mock/include", 29 ] 30 31 sources = [ 32 "${bgtaskmgr_frameworks_path}/src/expired_callback_proxy.cpp", 33 "bgtask_framework_unit_test.cpp", 34 "mock/src/mock_service_registry.cpp", 35 ] 36 37 deps = [ 38 "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits", 39 "//third_party/googletest:gtest_main", 40 ] 41 42 external_deps = [ 43 "ability_base:want", 44 "ability_runtime:wantagent_innerkits", 45 "c_utils:utils", 46 "hiviewdfx_hilog_native:libhilog", 47 "ipc:ipc_core", 48 "samgr:samgr_proxy", 49 ] 50 51 subsystem_name = "resourceschedule" 52 part_name = "background_task_mgr" 53} 54 55ohos_unittest("bgtask_framework_abnormal_unit_test") { 56 module_out_path = module_output_path 57 cflags_cc = [ 58 "-Dprivate=public", 59 "-Dprotected=public", 60 ] 61 include_dirs = [ 62 "${bgtaskmgr_interfaces_path}/innerkits/include", 63 "mock/parcel_abnormal/include", 64 ] 65 66 sources = [ 67 "${bgtaskmgr_frameworks_path}/src/expired_callback_proxy.cpp", 68 "bgtask_framework_abnormal_unit_test.cpp", 69 "mock/parcel_abnormal/src/mock_message_parcel.cpp", 70 "mock/src/mock_background_task_mgr_proxy.cpp", 71 ] 72 73 deps = [ 74 "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits", 75 "//third_party/googletest:gtest_main", 76 ] 77 78 external_deps = [ 79 "ability_base:want", 80 "ability_runtime:wantagent_innerkits", 81 "c_utils:utils", 82 "hiviewdfx_hilog_native:libhilog", 83 "ipc:ipc_core", 84 "samgr:samgr_proxy", 85 ] 86 87 subsystem_name = "resourceschedule" 88 part_name = "background_task_mgr" 89} 90 91group("unittest") { 92 testonly = true 93 94 deps = [ 95 ":bgtask_framework_abnormal_unit_test", 96 ":bgtask_framework_unit_test", 97 ] 98} 99