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("//base/location/config.gni") 15import("//build/test.gni") 16 17module_output_path = "location/location" 18 19if (location_feature_with_passive) { 20 PASSIVE_UNIT_TEST_DIR = "$LOCATION_ROOT_DIR/test/location_passive" 21 ohos_unittest("PassiveAbilityTest") { 22 module_out_path = module_output_path 23 sources = [ 24 "$LOCATION_ROOT_DIR/test/mock/src/mock_service_registry.cpp", 25 "$PASSIVE_UNIT_TEST_DIR/source/passive_ability_stub_test.cpp", 26 "$PASSIVE_UNIT_TEST_DIR/source/passive_ability_test.cpp", 27 ] 28 29 include_dirs = [ 30 "$LOCATION_ROOT_DIR/interfaces/inner_api/include", 31 "$PASSIVE_UNIT_TEST_DIR/include", 32 "$PASSIVE_UNIT_TEST_DIR/mock/include", 33 "$SUBSYSTEM_DIR/location_locator/locator/include", 34 "$SUBSYSTEM_DIR/location_passive/passive/include", 35 ] 36 37 sanitize = { 38 cfi = true 39 cfi_cross_dso = true 40 debug = false 41 blocklist = "./../../cfi_blocklist.txt" 42 } 43 branch_protector_ret = "pac_ret" 44 45 deps = [ 46 "$LOCATION_ROOT_DIR/frameworks/js/napi:geolocation_static", 47 "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common_static", 48 "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk_static", 49 "$SUBSYSTEM_DIR/location_locator/locator:lbsservice_locator_static", 50 "$SUBSYSTEM_DIR/location_passive/passive:lbsservice_passive_static", 51 ] 52 53 external_deps = [ 54 "napi:ace_napi", 55 "googletest:gmock_main", 56 "googletest:gtest_main", 57 "access_token:libaccesstoken_sdk", 58 "access_token:libnativetoken", 59 "access_token:libtoken_setproc", 60 "c_utils:utils", 61 "common_event_service:cesfwk_innerkits", 62 "eventhandler:libeventhandler", 63 "hilog:libhilog", 64 "hisysevent:libhisysevent", 65 "init:libbegetutil", 66 "ipc:ipc_core", 67 "safwk:system_ability_fwk", 68 "samgr:samgr_proxy", 69 "samgr:dynamic_cache", 70 "selinux_adapter:librestorecon", 71 ] 72 73 defines = [] 74 if (location_feature_with_passive) { 75 defines += [ "FEATURE_PASSIVE_SUPPORT" ] 76 } 77 78 module_out_path = module_output_path 79 } 80} else { 81 ohos_unittest("PassiveAbilityTest") { 82 module_out_path = module_output_path 83 } 84} 85 86group("unittest") { 87 testonly = true 88 deps = [] 89 90 deps += [ ":PassiveAbilityTest" ] 91} 92