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