1# Copyright (C) 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/service"
18
19MOCK_IPC_UNIT_TEST_DIR = "$LOCATION_ROOT_DIR/test/location_mock_ipc"
20ohos_unittest("LocationMockIpcTest") {
21  module_out_path = module_output_path
22  sources = [
23    "$LOCATION_ROOT_DIR/test/mock/src/mock_ipc.cpp",
24    "$MOCK_IPC_UNIT_TEST_DIR/src/location_mock_ipc.cpp",
25  ]
26
27  include_dirs = [
28    "$MOCK_IPC_UNIT_TEST_DIR/include",
29    "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
30    "$LOCATION_GNSS_ROOT/include",
31    "$LOCATION_NETWORK_ROOT/include",
32    "$LOCATION_GEOCONVERT_ROOT/include",
33    "$LOCATION_PASSIVE_ROOT/include",
34    "$LOCATION_LOCATOR_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    "$GOOGLE_TEST_DIR:gmock_main",
47    "$GOOGLE_TEST_DIR:gtest_main",
48    "$LOCATION_GEOCONVERT_ROOT:lbsservice_geocode_static",
49    "$LOCATION_GNSS_ROOT:lbsservice_gnss_static",
50    "$LOCATION_LOCATOR_ROOT:lbsservice_locator_static",
51    "$LOCATION_NETWORK_ROOT:lbsservice_network_static",
52    "$LOCATION_PASSIVE_ROOT:lbsservice_passive_static",
53    "$LOCATION_ROOT_DIR/frameworks/js/napi:geolocation_static",
54    "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk_static",
55    "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk_static",
56  ]
57
58  external_deps = [
59    "ability_base:want",
60    "ability_runtime:app_manager",
61    "ability_runtime:wantagent_innerkits",
62    "access_token:libaccesstoken_sdk",
63    "access_token:libnativetoken",
64    "access_token:libtoken_setproc",
65    "bundle_framework:appexecfwk_core",
66    "c_utils:utils",
67    "cellular_data:tel_cellular_data_api",
68    "common_event_service:cesfwk_innerkits",
69    "core_service:tel_core_service_api",
70    "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0",
71    "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0",
72    "eventhandler:libeventhandler",
73    "ffrt:libffrt",
74    "hdf_core:libhdi",
75    "hdf_core:libpub_utils",
76    "hilog:libhilog",
77    "hisysevent:libhisysevent",
78    "init:libbegetutil",
79    "ipc:ipc_core",
80    "napi:ace_napi",
81    "safwk:system_ability_fwk",
82    "samgr:samgr_proxy",
83  ]
84
85  defines = []
86
87  if (telephony_core_service_enable) {
88    external_deps += [ "core_service:tel_core_service_api" ]
89    defines += [ "TEL_CORE_SERVICE_ENABLE" ]
90  }
91
92  if (telephony_cellular_data_enable) {
93    external_deps += [ "cellular_data:tel_cellular_data_api" ]
94    defines += [ "TEL_CELLULAR_DATA_ENABLE" ]
95  }
96
97  if (hdf_drivers_interface_location_agnss_enable) {
98    external_deps +=
99        [ "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0" ]
100    defines += [ "HDF_DRIVERS_INTERFACE_AGNSS_ENABLE" ]
101  }
102
103  if (location_feature_with_gnss &&
104      hdf_drivers_interface_location_gnss_enable) {
105    external_deps +=
106        [ "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0" ]
107    defines += [ "FEATURE_GNSS_SUPPORT" ]
108  }
109
110  if (hdf_drivers_interface_location_geofence_enable) {
111    external_deps +=
112        [ "drivers_interface_location_geofence:liblocation_geofence_proxy_2.0" ]
113    defines += [ "HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE" ]
114  }
115
116  if (location_feature_with_passive) {
117    defines += [ "FEATURE_PASSIVE_SUPPORT" ]
118  }
119
120  if (location_feature_with_geocode) {
121    defines += [ "FEATURE_GEOCODE_SUPPORT" ]
122  }
123
124  if (location_feature_with_network) {
125    defines += [ "FEATURE_NETWORK_SUPPORT" ]
126  }
127
128  module_out_path = module_output_path
129}
130
131group("unittest") {
132  testonly = true
133  deps = []
134
135  deps += [ ":LocationMockIpcTest" ]
136}
137