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 19ohos_unittest("LocatorManagerAbilityTest") { 20 sanitize = { 21 cfi = true 22 cfi_cross_dso = true 23 debug = false 24 blocklist = "./../../cfi_blocklist.txt" 25 } 26 branch_protector_ret = "pac_ret" 27 module_out_path = module_output_path 28 sources = [ 29 "$LOCATION_ROOT_DIR/test/location_manager/source/locator_ability_test.cpp", 30 "$LOCATION_ROOT_DIR/test/location_manager/source/request_manager_test.cpp", 31 ] 32 33 include_dirs = [ 34 "$LOCATION_ROOT_DIR/interfaces/inner_api/include", 35 "$LOCATION_ROOT_DIR/test/location_manager/include", 36 "$LOCATION_ROOT_DIR/test/location_manager/mock/include", 37 "$LOCATION_ROOT_DIR/test/mock/include", 38 "$SUBSYSTEM_DIR/location_locator/callback/include", 39 "$SUBSYSTEM_DIR/location_locator/locator/include", 40 "$LOCATION_ROOT_DIR/frameworks/js/napi/include", 41 ] 42 43 deps = [ 44 "$LOCATION_ROOT_DIR/frameworks/js/napi:geolocation_static", 45 "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common_static", 46 "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk_static", 47 "$LOCATION_ROOT_DIR/frameworks/native/locator_agent:locator_agent", 48 "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:liblocator_interface_proxy", 49 "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:liblocator_interface_stub", 50 "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk_static", 51 "$SUBSYSTEM_DIR/location_locator/locator:lbsservice_locator_static", 52 ] 53 54 external_deps = [ 55 "googletest:gmock_main", 56 "googletest:gtest_main", 57 "ability_base:want", 58 "ability_runtime:app_manager", 59 "access_token:libaccesstoken_sdk", 60 "access_token:libnativetoken", 61 "access_token:libtoken_setproc", 62 "bundle_framework:appexecfwk_core", 63 "c_utils:utils", 64 "common_event_service:cesfwk_innerkits", 65 "distributed_notification_service:ans_innerkits", 66 "eventhandler:libeventhandler", 67 "ffrt:libffrt", 68 "hilog:libhilog", 69 "hisysevent:libhisysevent", 70 "init:libbegetutil", 71 "ipc:ipc_core", 72 "napi:ace_napi", 73 "safwk:system_ability_fwk", 74 "samgr:dynamic_cache", 75 "samgr:samgr_proxy", 76 "selinux_adapter:librestorecon", 77 ] 78 79 defines = [] 80 if (communication_wifi_enable) { 81 external_deps += [ "wifi:wifi_sdk" ] 82 defines += [ "WIFI_ENABLE" ] 83 } 84 85 if (communication_bluetooth_enable) { 86 external_deps += [ "bluetooth:btframework" ] 87 defines += [ "BLUETOOTH_ENABLE" ] 88 } 89 90 if (location_feature_with_geocode) { 91 defines += [ "FEATURE_GEOCODE_SUPPORT" ] 92 } 93 94 if (location_feature_with_gnss) { 95 defines += [ "FEATURE_GNSS_SUPPORT" ] 96 } 97 98 if (hdf_drivers_interface_location_geofence_enable) { 99 external_deps += 100 [ "drivers_interface_location_geofence:liblocation_geofence_proxy_2.0" ] 101 defines += [ "HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE" ] 102 } 103 104 if (location_feature_with_network) { 105 defines += [ "FEATURE_NETWORK_SUPPORT" ] 106 } 107 108 if (location_feature_with_passive) { 109 defines += [ "FEATURE_PASSIVE_SUPPORT" ] 110 } 111 112 if (is_emulator) { 113 defines += [ "EMULATOR_ENABLED" ] 114 } 115 if (notification_distributed_notification_service_enable) { 116 defines += [ "NOTIFICATION_ENABLE" ] 117 } 118 module_out_path = module_output_path 119} 120 121group("unittest") { 122 testonly = true 123 deps = [] 124 125 deps += [ ":LocatorManagerAbilityTest" ] 126} 127