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/service" 18 19if (location_feature_with_network) { 20 NETWORK_UNIT_TEST_DIR = "$LOCATION_ROOT_DIR/test/location_network" 21 ohos_unittest("NetworkAbilityTest") { 22 module_out_path = module_output_path 23 sources = [ 24 "$LOCATION_ROOT_DIR/test/mock/src/mock_service_registry.cpp", 25 "$NETWORK_UNIT_TEST_DIR/source/network_ability_stub_test.cpp", 26 "$NETWORK_UNIT_TEST_DIR/source/network_ability_test.cpp", 27 ] 28 29 include_dirs = [ 30 "$LOCATION_ROOT_DIR/interfaces/inner_api/include", 31 "$NETWORK_UNIT_TEST_DIR/include", 32 "$NETWORK_UNIT_TEST_DIR/mock/include", 33 "$LOCATION_LOCATOR_ROOT/include", 34 "$LOCATION_NETWORK_ROOT/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 "$ARKUI_ROOT_DIR/napi:ace_napi", 47 "$GOOGLE_TEST_DIR:gmock_main", 48 "$GOOGLE_TEST_DIR:gtest_main", 49 "$IPC_ROOT_DIR/interfaces/innerkits/ipc_core:ipc_core", 50 "$LOCATION_LOCATOR_ROOT:lbsservice_locator_static", 51 "$LOCATION_NETWORK_ROOT:lbsservice_network_static", 52 "$LOCATION_ROOT_DIR/frameworks/js/napi:geolocation_static", 53 "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common_static", 54 "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk_static", 55 "$SAMGR_ROOT_DIR/safwk/interfaces/innerkits/safwk:system_ability_fwk", 56 "$SAMGR_ROOT_DIR/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", 57 "$START_UP_ROOT_DIR/init/interfaces/innerkits:libbegetutil", 58 ] 59 60 external_deps = [ 61 "ability_base:want", 62 "ability_runtime:ability_manager", 63 "access_token:libaccesstoken_sdk", 64 "access_token:libnativetoken", 65 "access_token:libtoken_setproc", 66 "c_utils:utils", 67 "common_event_service:cesfwk_innerkits", 68 "eventhandler:libeventhandler", 69 "ffrt:libffrt", 70 "hilog:libhilog", 71 "hisysevent:libhisysevent", 72 "init:libbegetutil", 73 ] 74 75 defines = [] 76 if (location_feature_with_network) { 77 defines += [ "FEATURE_NETWORK_SUPPORT" ] 78 } 79 80 module_out_path = module_output_path 81 } 82} else { 83 ohos_unittest("NetworkAbilityTest") { 84 module_out_path = module_output_path 85 } 86} 87 88group("unittest") { 89 testonly = true 90 deps = [] 91 92 deps += [ ":NetworkAbilityTest" ] 93} 94