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 deps = [ 38 "$ARKUI_ROOT_DIR/napi:ace_napi", 39 "$GOOGLE_TEST_DIR:gmock_main", 40 "$GOOGLE_TEST_DIR:gtest_main", 41 "$IPC_ROOT_DIR/interfaces/innerkits/ipc_core:ipc_core", 42 "$LOCATION_LOCATOR_ROOT:lbsservice_locator", 43 "$LOCATION_NETWORK_ROOT:lbsservice_network", 44 "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common", 45 "$LOCATION_ROOT_DIR/frameworks/native:locator_sdk", 46 "$SAMGR_ROOT_DIR/safwk/interfaces/innerkits/safwk:system_ability_fwk", 47 "$SAMGR_ROOT_DIR/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", 48 "$SECURITY_ROOT_DIR/access_token/interfaces/innerkits/nativetoken:libnativetoken", 49 "$SECURITY_ROOT_DIR/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", 50 "$START_UP_ROOT_DIR/init/interfaces/innerkits:libbegetutil", 51 ] 52 53 external_deps = [ 54 "ability_base:want", 55 "access_token:libaccesstoken_sdk", 56 "c_utils:utils", 57 "common_event_service:cesfwk_innerkits", 58 "eventhandler:libeventhandler", 59 "hilog:libhilog", 60 "hisysevent:libhisysevent", 61 ] 62 63 defines = [] 64 if (location_feature_with_network) { 65 defines += [ "FEATURE_NETWORK_SUPPORT" ] 66 } 67 68 module_out_path = module_output_path 69 } 70} else { 71 ohos_unittest("NetworkAbilityTest") { 72 module_out_path = module_output_path 73 } 74} 75 76group("unittest") { 77 testonly = true 78 deps = [] 79 80 deps += [ ":NetworkAbilityTest" ] 81} 82