xref: /base/location/test/location_gnss/BUILD.gn (revision 5c735df2)
1# Copyright (C) 2022-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
19if (location_feature_with_gnss) {
20  GNSS_UNIT_TEST_DIR = "$LOCATION_ROOT_DIR/test/location_gnss"
21  ohos_unittest("GnssAbilityTest") {
22    module_out_path = module_output_path
23    sources = [
24      "$GNSS_UNIT_TEST_DIR/mock/src/mock_i_cellular_data_manager.cpp",
25      "$GNSS_UNIT_TEST_DIR/source/gnss_ability_stub_test.cpp",
26      "$GNSS_UNIT_TEST_DIR/source/gnss_ability_test.cpp",
27      "$GNSS_UNIT_TEST_DIR/source/gnss_event_callback_test.cpp",
28      "$GNSS_UNIT_TEST_DIR/source/gnss_interface_test.cpp",
29      "$GNSS_UNIT_TEST_DIR/source/ntp_time_test.cpp",
30      "$LOCATION_ROOT_DIR/test/mock/src/mock_service_registry.cpp",
31    ]
32
33    include_dirs = [
34      "$GNSS_UNIT_TEST_DIR/include",
35      "$GNSS_UNIT_TEST_DIR/mock/include",
36      "$LOCATION_GNSS_ROOT/include",
37      "$LOCATION_GNSS_ROOT/include/ntp",
38      "$LOCATION_LOCATOR_ROOT/include",
39      "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
40      "$LOCATION_ROOT_DIR/test/mock/include",
41    ]
42
43    sanitize = {
44      cfi = true
45      cfi_cross_dso = true
46      debug = false
47      blocklist = "./../../cfi_blocklist.txt"
48    }
49    branch_protector_ret = "pac_ret"
50
51    deps = [
52      "$ARKUI_ROOT_DIR/napi:ace_napi",
53      "$GOOGLE_TEST_DIR:gmock_main",
54      "$GOOGLE_TEST_DIR:gtest_main",
55      "$IPC_ROOT_DIR/interfaces/innerkits/ipc_core:ipc_core",
56      "$LOCATION_GNSS_ROOT:lbsservice_gnss_static",
57      "$LOCATION_LOCATOR_ROOT:lbsservice_locator_static",
58      "$LOCATION_ROOT_DIR/frameworks/js/napi:geolocation_static",
59      "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common_static",
60      "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk_static",
61      "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk_static",
62      "$LOCATION_ROOT_DIR/test/location_locator:LocatorServiceAbilityTest",
63      "$SAMGR_ROOT_DIR/safwk/interfaces/innerkits/safwk:system_ability_fwk",
64      "$SAMGR_ROOT_DIR/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
65      "$START_UP_ROOT_DIR/init/interfaces/innerkits:libbegetutil",
66    ]
67
68    external_deps = [
69      "ability_base:want",
70      "access_token:libaccesstoken_sdk",
71      "access_token:libnativetoken",
72      "access_token:libtoken_setproc",
73      "c_utils:utils",
74      "cellular_data:tel_cellular_data_api",
75      "common_event_service:cesfwk_innerkits",
76      "core_service:tel_core_service_api",
77      "distributed_notification_service:ans_innerkits",
78      "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0",
79      "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0",
80      "eventhandler:libeventhandler",
81      "ffrt:libffrt",
82      "hdf_core:libhdi",
83      "hdf_core:libpub_utils",
84      "hilog:libhilog",
85      "hisysevent:libhisysevent",
86      "init:libbegetutil",
87    ]
88
89    defines = []
90    if (location_feature_with_gnss) {
91      defines += [ "FEATURE_GNSS_SUPPORT" ]
92    }
93
94    if (telephony_core_service_enable) {
95      external_deps += [ "core_service:tel_core_service_api" ]
96      defines += [ "TEL_CORE_SERVICE_ENABLE" ]
97    }
98
99    if (hdf_drivers_interface_location_agnss_enable) {
100      defines += [ "HDF_DRIVERS_INTERFACE_AGNSS_ENABLE" ]
101    }
102
103    if (hdf_drivers_interface_location_geofence_enable) {
104      external_deps += [
105        "drivers_interface_location_geofence:liblocation_geofence_proxy_2.0",
106      ]
107      defines += [ "HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE" ]
108    }
109    if (notification_distributed_notification_service_enable) {
110      defines += [ "NOTIFICATION_ENABLE" ]
111    }
112    if (call_manager_enable) {
113      external_deps += [ "call_manager:tel_call_manager_api" ]
114      defines += [ "CALL_MANAGER_ENABLE" ]
115    }
116
117    if (common_event_service_enable) {
118      external_deps += [
119        "ability_runtime:extension_manager",
120        "common_event_service:cesfwk_innerkits",
121      ]
122      defines += [ "COMMON_EVENT_SERVICE_ENABLE" ]
123    }
124
125    if (sms_mms_enable) {
126      defines += [ "SMS_MMS_ENABLE" ]
127    }
128
129    if (time_service_enable) {
130      external_deps += [ "time_service:time_client" ]
131      defines += [ "TIME_SERVICE_ENABLE" ]
132    }
133
134    if (net_manager_enable) {
135      external_deps += [ "netmanager_base:net_conn_manager_if" ]
136      defines += [ "NET_MANAGER_ENABLE" ]
137    }
138    module_out_path = module_output_path
139  }
140} else {
141  ohos_unittest("GnssAbilityTest") {
142    module_out_path = module_output_path
143  }
144}
145
146group("unittest") {
147  testonly = true
148  deps = []
149
150  deps += [ ":GnssAbilityTest" ]
151}
152