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
19ohos_unittest("LocatorServiceAbilityTest") {
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_locator/source/callback_test.cpp",
30    "$LOCATION_ROOT_DIR/test/location_locator/source/country_code_manager_test.cpp",
31    "$LOCATION_ROOT_DIR/test/location_locator/source/fusion_controller_test.cpp",
32    "$LOCATION_ROOT_DIR/test/location_locator/source/location_approximately_permission_test.cpp",
33    "$LOCATION_ROOT_DIR/test/location_locator/source/location_config_manager_test.cpp",
34    "$LOCATION_ROOT_DIR/test/location_locator/source/location_without_permission_test.cpp",
35    "$LOCATION_ROOT_DIR/test/location_locator/source/locator_agent_test.cpp",
36    "$LOCATION_ROOT_DIR/test/location_locator/source/locator_background_proxy_test.cpp",
37    "$LOCATION_ROOT_DIR/test/location_locator/source/locator_event_manager_test.cpp",
38    "$LOCATION_ROOT_DIR/test/location_locator/source/locator_impl_test.cpp",
39    "$LOCATION_ROOT_DIR/test/location_locator/source/locator_required_data_manager_test.cpp",
40    "$LOCATION_ROOT_DIR/test/location_locator/source/locator_service_test.cpp",
41    "$LOCATION_ROOT_DIR/test/location_locator/source/permission_manager_test.cpp",
42    "$LOCATION_ROOT_DIR/test/location_locator/source/report_manager_test.cpp",
43    "$LOCATION_ROOT_DIR/test/location_locator/source/work_record_test.cpp",
44  ]
45
46  include_dirs = [
47    "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
48    "$LOCATION_ROOT_DIR/test/location_locator/include",
49    "$LOCATION_ROOT_DIR/test/location_locator/mock/include",
50    "$LOCATION_ROOT_DIR/test/mock/include",
51    "$SUBSYSTEM_DIR/location_locator/callback/include",
52    "$SUBSYSTEM_DIR/location_locator/locator/include",
53    "$LOCATION_ROOT_DIR/frameworks/js/napi/include",
54  ]
55
56  deps = [
57    "$LOCATION_ROOT_DIR/frameworks/js/napi:geolocation_static",
58    "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common_static",
59    "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk_static",
60    "$LOCATION_ROOT_DIR/frameworks/native/locator_agent:locator_agent",
61    "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk_static",
62    "$SUBSYSTEM_DIR/location_locator/locator:lbsservice_locator_static",
63    "//third_party/googletest:gmock_main",
64    "//third_party/googletest:gtest_main",
65  ]
66
67  external_deps = [
68    "ability_base:want",
69    "ability_runtime:app_manager",
70    "access_token:libaccesstoken_sdk",
71    "access_token:libnativetoken",
72    "access_token:libtoken_setproc",
73    "bundle_framework:appexecfwk_core",
74    "c_utils:utils",
75    "common_event_service:cesfwk_innerkits",
76    "distributed_notification_service:ans_innerkits",
77    "eventhandler:libeventhandler",
78    "ffrt:libffrt",
79    "hilog:libhilog",
80    "hisysevent:libhisysevent",
81    "init:libbegetutil",
82    "ipc:ipc_core",
83    "napi:ace_napi",
84    "safwk:system_ability_fwk",
85    "samgr:samgr_proxy",
86  ]
87
88  defines = []
89  if (communication_wifi_enable) {
90    external_deps += [ "wifi:wifi_sdk" ]
91    defines += [ "WIFI_ENABLE" ]
92  }
93
94  if (communication_bluetooth_enable) {
95    external_deps += [ "bluetooth:btframework" ]
96    defines += [ "BLUETOOTH_ENABLE" ]
97  }
98
99  if (location_feature_with_geocode) {
100    defines += [ "FEATURE_GEOCODE_SUPPORT" ]
101  }
102
103  if (location_feature_with_gnss) {
104    defines += [ "FEATURE_GNSS_SUPPORT" ]
105  }
106
107  if (hdf_drivers_interface_location_geofence_enable) {
108    external_deps +=
109        [ "drivers_interface_location_geofence:liblocation_geofence_proxy_2.0" ]
110    defines += [ "HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE" ]
111  }
112
113  if (location_feature_with_network) {
114    defines += [ "FEATURE_NETWORK_SUPPORT" ]
115  }
116
117  if (location_feature_with_passive) {
118    defines += [ "FEATURE_PASSIVE_SUPPORT" ]
119  }
120
121  if (is_emulator) {
122    defines += [ "EMULATOR_ENABLED" ]
123  }
124  if (notification_distributed_notification_service_enable) {
125    defines += [ "NOTIFICATION_ENABLE" ]
126  }
127  module_out_path = module_output_path
128}
129
130group("unittest") {
131  testonly = true
132  deps = []
133
134  deps += [ ":LocatorServiceAbilityTest" ]
135}
136