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 "common_event_service:cesfwk_innerkits", 47 "hilog:libhilog", 48 "ipc:ipc_single", 49 "samgr:samgr_proxy", 50 ] 51 52 subsystem_name = "resourceschedule" 53 part_name = "background_task_mgr" 54} 55 56ohos_unittest("bgtask_framework_abnormal_unit_test") { 57 module_out_path = module_output_path 58 cflags_cc = [ 59 "-Dprivate=public", 60 "-Dprotected=public", 61 ] 62 include_dirs = [ 63 "${bgtaskmgr_interfaces_path}/innerkits/include", 64 "mock/include", 65 ] 66 67 sources = [ 68 "${bgtaskmgr_frameworks_path}/src/expired_callback_proxy.cpp", 69 "bgtask_framework_abnormal_unit_test.cpp", 70 "mock/parcel_abnormal/src/mock_message_parcel.cpp", 71 "mock/src/mock_background_task_mgr_proxy.cpp", 72 ] 73 74 deps = [ 75 "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits", 76 "//third_party/googletest:gtest_main", 77 ] 78 79 external_deps = [ 80 "ability_base:want", 81 "ability_runtime:wantagent_innerkits", 82 "c_utils:utils", 83 "common_event_service:cesfwk_innerkits", 84 "hilog:libhilog", 85 "ipc:ipc_single", 86 "samgr:samgr_proxy", 87 ] 88 89 subsystem_name = "resourceschedule" 90 part_name = "background_task_mgr" 91} 92 93group("unittest") { 94 testonly = true 95 96 deps = [ 97 ":bgtask_framework_abnormal_unit_test", 98 ":bgtask_framework_unit_test", 99 ] 100} 101