• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_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      "$LOCATION_LOCATOR_ROOT:lbsservice_locator_static",
47      "$LOCATION_NETWORK_ROOT:lbsservice_network_static",
48      "$LOCATION_ROOT_DIR/frameworks/js/napi:geolocation_static",
49      "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common_static",
50      "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk_static",
51    ]
52
53    external_deps = [
54      "napi:ace_napi",
55      "googletest:gmock_main",
56      "googletest:gtest_main",
57      "ipc:ipc_core",
58      "safwk:system_ability_fwk",
59      "samgr:samgr_proxy",
60      "ability_base:want",
61      "ability_runtime:ability_manager",
62      "access_token:libaccesstoken_sdk",
63      "access_token:libnativetoken",
64      "access_token:libtoken_setproc",
65      "c_utils:utils",
66      "common_event_service:cesfwk_innerkits",
67      "eventhandler:libeventhandler",
68      "ffrt:libffrt",
69      "hilog:libhilog",
70      "hisysevent:libhisysevent",
71      "init:libbegetutil",
72      "samgr:dynamic_cache",
73      "selinux_adapter:librestorecon",
74    ]
75
76    defines = []
77    if (location_feature_with_network) {
78      defines += [ "FEATURE_NETWORK_SUPPORT" ]
79    }
80
81    module_out_path = module_output_path
82  }
83} else {
84  ohos_unittest("NetworkAbilityTest") {
85    module_out_path = module_output_path
86  }
87}
88
89group("unittest") {
90  testonly = true
91  deps = []
92
93  deps += [ ":NetworkAbilityTest" ]
94}
95