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 sanitize = { 32 cfi = true 33 cfi_cross_dso = true 34 debug = false 35 } 36 37 sources = [ 38 "bgtask_framework_unit_test.cpp", 39 "mock/src/mock_service_registry.cpp", 40 ] 41 42 deps = [ 43 "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits", 44 "${bgtaskmgr_interfaces_path}/innerkits:expired_callback_proxy", 45 ] 46 47 external_deps = [ 48 "ability_base:want", 49 "ability_runtime:wantagent_innerkits", 50 "c_utils:utils", 51 "common_event_service:cesfwk_innerkits", 52 "googletest:gtest_main", 53 "hilog:libhilog", 54 "ipc:ipc_single", 55 "samgr:samgr_proxy", 56 ] 57 58 subsystem_name = "resourceschedule" 59 part_name = "background_task_mgr" 60} 61 62ohos_unittest("bgtask_framework_abnormal_unit_test") { 63 module_out_path = module_output_path 64 cflags_cc = [ 65 "-Dprivate=public", 66 "-Dprotected=public", 67 ] 68 include_dirs = [ 69 "${bgtaskmgr_interfaces_path}/innerkits/include", 70 "mock/include", 71 ] 72 73 sanitize = { 74 cfi = true 75 cfi_cross_dso = true 76 debug = false 77 } 78 79 sources = [ 80 "bgtask_framework_abnormal_unit_test.cpp", 81 "mock/parcel_abnormal/src/mock_message_parcel.cpp", 82 "mock/src/mock_background_task_mgr_proxy.cpp", 83 ] 84 85 deps = [ 86 "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits", 87 "${bgtaskmgr_interfaces_path}/innerkits:expired_callback_proxy", 88 ] 89 90 external_deps = [ 91 "ability_base:want", 92 "ability_runtime:wantagent_innerkits", 93 "c_utils:utils", 94 "common_event_service:cesfwk_innerkits", 95 "googletest:gtest_main", 96 "hilog:libhilog", 97 "ipc:ipc_single", 98 "samgr:samgr_proxy", 99 ] 100 101 subsystem_name = "resourceschedule" 102 part_name = "background_task_mgr" 103} 104 105group("unittest") { 106 testonly = true 107 108 deps = [ 109 ":bgtask_framework_abnormal_unit_test", 110 ":bgtask_framework_unit_test", 111 ] 112} 113