1# Copyright (C) 2022-2023 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_gnss) { 20 GNSS_UNIT_TEST_DIR = "$LOCATION_ROOT_DIR/test/location_gnss" 21 ohos_unittest("GnssAbilityTest") { 22 module_out_path = module_output_path 23 sources = [ 24 "$GNSS_UNIT_TEST_DIR/mock/src/mock_i_cellular_data_manager.cpp", 25 "$GNSS_UNIT_TEST_DIR/source/gnss_ability_stub_test.cpp", 26 "$GNSS_UNIT_TEST_DIR/source/gnss_ability_test.cpp", 27 "$GNSS_UNIT_TEST_DIR/source/gnss_event_callback_test.cpp", 28 "$GNSS_UNIT_TEST_DIR/source/gnss_interface_test.cpp", 29 "$GNSS_UNIT_TEST_DIR/source/ntp_time_test.cpp", 30 "$LOCATION_ROOT_DIR/test/mock/src/mock_service_registry.cpp", 31 ] 32 33 include_dirs = [ 34 "$GNSS_UNIT_TEST_DIR/include", 35 "$GNSS_UNIT_TEST_DIR/mock/include", 36 "$LOCATION_GNSS_ROOT/include", 37 "$LOCATION_GNSS_ROOT/include/ntp", 38 "$LOCATION_LOCATOR_ROOT/include", 39 "$LOCATION_ROOT_DIR/interfaces/inner_api/include", 40 "$LOCATION_ROOT_DIR/test/mock/include", 41 ] 42 43 sanitize = { 44 cfi = true 45 cfi_cross_dso = true 46 debug = false 47 blocklist = "./../../cfi_blocklist.txt" 48 } 49 branch_protector_ret = "pac_ret" 50 51 deps = [ 52 "$LOCATION_GNSS_ROOT:lbsservice_gnss_static", 53 "$LOCATION_LOCATOR_ROOT:lbsservice_locator_static", 54 "$LOCATION_ROOT_DIR/frameworks/js/napi:geolocation_static", 55 "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common_static", 56 "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk_static", 57 "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk_static", 58 "$LOCATION_ROOT_DIR/test/location_locator:LocatorServiceAbilityTest", 59 ] 60 61 external_deps = [ 62 "napi:ace_napi", 63 "googletest:gmock_main", 64 "googletest:gtest_main", 65 "ipc:ipc_core", 66 "safwk:system_ability_fwk", 67 "samgr:samgr_proxy", 68 "ability_base:want", 69 "access_token:libaccesstoken_sdk", 70 "access_token:libnativetoken", 71 "access_token:libtoken_setproc", 72 "c_utils:utils", 73 "cellular_data:tel_cellular_data_api", 74 "common_event_service:cesfwk_innerkits", 75 "core_service:tel_core_service_api", 76 "distributed_notification_service:ans_innerkits", 77 "eventhandler:libeventhandler", 78 "ffrt:libffrt", 79 "hdf_core:libhdi", 80 "hdf_core:libpub_utils", 81 "hilog:libhilog", 82 "hisysevent:libhisysevent", 83 "init:libbegetutil", 84 "samgr:dynamic_cache", 85 "selinux_adapter:librestorecon", 86 ] 87 88 defines = [] 89 if (location_feature_with_gnss) { 90 defines += [ "FEATURE_GNSS_SUPPORT" ] 91 } 92 93 if (telephony_core_service_enable) { 94 external_deps += [ "core_service:tel_core_service_api" ] 95 defines += [ "TEL_CORE_SERVICE_ENABLE" ] 96 } 97 98 if (hdf_drivers_interface_location_agnss_enable) { 99 defines += [ "HDF_DRIVERS_INTERFACE_AGNSS_ENABLE" ] 100 } 101 102 if (hdf_drivers_interface_location_geofence_enable) { 103 external_deps += [ 104 "drivers_interface_location_geofence:liblocation_geofence_proxy_2.0", 105 ] 106 defines += [ "HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE" ] 107 } 108 if (notification_distributed_notification_service_enable) { 109 defines += [ "NOTIFICATION_ENABLE" ] 110 } 111 if (call_manager_enable) { 112 external_deps += [ "call_manager:tel_call_manager_api" ] 113 defines += [ "CALL_MANAGER_ENABLE" ] 114 } 115 116 if (common_event_service_enable) { 117 external_deps += [ 118 "ability_runtime:extension_manager", 119 "common_event_service:cesfwk_innerkits", 120 ] 121 defines += [ "COMMON_EVENT_SERVICE_ENABLE" ] 122 } 123 124 if (sms_mms_enable) { 125 defines += [ "SMS_MMS_ENABLE" ] 126 } 127 128 if (time_service_enable) { 129 external_deps += [ "time_service:time_client" ] 130 defines += [ "TIME_SERVICE_ENABLE" ] 131 } 132 133 if (net_manager_enable) { 134 external_deps += [ "netmanager_base:net_conn_manager_if" ] 135 defines += [ "NET_MANAGER_ENABLE" ] 136 } 137 138 if (hdf_drivers_interface_location_agnss_enable) { 139 external_deps += 140 [ "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0" ] 141 defines += [ "HDF_DRIVERS_INTERFACE_AGNSS_ENABLE" ] 142 } 143 144 if (location_feature_with_gnss && 145 hdf_drivers_interface_location_gnss_enable) { 146 external_deps += 147 [ "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0" ] 148 defines += [ "FEATURE_GNSS_SUPPORT" ] 149 } 150 module_out_path = module_output_path 151 } 152} else { 153 ohos_unittest("GnssAbilityTest") { 154 module_out_path = module_output_path 155 } 156} 157 158group("unittest") { 159 testonly = true 160 deps = [] 161 162 deps += [ ":GnssAbilityTest" ] 163} 164