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