15c735df2Sopenharmony_ci# Copyright (C) 2022-2023 Huawei Device Co., Ltd.
25c735df2Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
35c735df2Sopenharmony_ci# you may not use this file except in compliance with the License.
45c735df2Sopenharmony_ci# You may obtain a copy of the License at
55c735df2Sopenharmony_ci#
65c735df2Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
75c735df2Sopenharmony_ci#
85c735df2Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
95c735df2Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
105c735df2Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
115c735df2Sopenharmony_ci# See the License for the specific language governing permissions and
125c735df2Sopenharmony_ci# limitations under the License.
135c735df2Sopenharmony_ci
145c735df2Sopenharmony_ciimport("//base/location/config.gni")
155c735df2Sopenharmony_ciimport("//build/test.gni")
165c735df2Sopenharmony_ci
175c735df2Sopenharmony_cimodule_output_path = "location/service"
185c735df2Sopenharmony_ci
195c735df2Sopenharmony_ciif (location_feature_with_gnss) {
205c735df2Sopenharmony_ci  GNSS_UNIT_TEST_DIR = "$LOCATION_ROOT_DIR/test/location_gnss"
215c735df2Sopenharmony_ci  ohos_unittest("GnssAbilityTest") {
225c735df2Sopenharmony_ci    module_out_path = module_output_path
235c735df2Sopenharmony_ci    sources = [
245c735df2Sopenharmony_ci      "$GNSS_UNIT_TEST_DIR/mock/src/mock_i_cellular_data_manager.cpp",
255c735df2Sopenharmony_ci      "$GNSS_UNIT_TEST_DIR/source/gnss_ability_stub_test.cpp",
265c735df2Sopenharmony_ci      "$GNSS_UNIT_TEST_DIR/source/gnss_ability_test.cpp",
275c735df2Sopenharmony_ci      "$GNSS_UNIT_TEST_DIR/source/gnss_event_callback_test.cpp",
285c735df2Sopenharmony_ci      "$GNSS_UNIT_TEST_DIR/source/gnss_interface_test.cpp",
295c735df2Sopenharmony_ci      "$GNSS_UNIT_TEST_DIR/source/ntp_time_test.cpp",
305c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/test/mock/src/mock_service_registry.cpp",
315c735df2Sopenharmony_ci    ]
325c735df2Sopenharmony_ci
335c735df2Sopenharmony_ci    include_dirs = [
345c735df2Sopenharmony_ci      "$GNSS_UNIT_TEST_DIR/include",
355c735df2Sopenharmony_ci      "$GNSS_UNIT_TEST_DIR/mock/include",
365c735df2Sopenharmony_ci      "$LOCATION_GNSS_ROOT/include",
375c735df2Sopenharmony_ci      "$LOCATION_GNSS_ROOT/include/ntp",
385c735df2Sopenharmony_ci      "$LOCATION_LOCATOR_ROOT/include",
395c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
405c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/test/mock/include",
415c735df2Sopenharmony_ci    ]
425c735df2Sopenharmony_ci
435c735df2Sopenharmony_ci    sanitize = {
445c735df2Sopenharmony_ci      cfi = true
455c735df2Sopenharmony_ci      cfi_cross_dso = true
465c735df2Sopenharmony_ci      debug = false
475c735df2Sopenharmony_ci      blocklist = "./../../cfi_blocklist.txt"
485c735df2Sopenharmony_ci    }
495c735df2Sopenharmony_ci    branch_protector_ret = "pac_ret"
505c735df2Sopenharmony_ci
515c735df2Sopenharmony_ci    deps = [
525c735df2Sopenharmony_ci      "$ARKUI_ROOT_DIR/napi:ace_napi",
535c735df2Sopenharmony_ci      "$GOOGLE_TEST_DIR:gmock_main",
545c735df2Sopenharmony_ci      "$GOOGLE_TEST_DIR:gtest_main",
555c735df2Sopenharmony_ci      "$IPC_ROOT_DIR/interfaces/innerkits/ipc_core:ipc_core",
565c735df2Sopenharmony_ci      "$LOCATION_GNSS_ROOT:lbsservice_gnss_static",
575c735df2Sopenharmony_ci      "$LOCATION_LOCATOR_ROOT:lbsservice_locator_static",
585c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/frameworks/js/napi:geolocation_static",
595c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common_static",
605c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk_static",
615c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk_static",
625c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/test/location_locator:LocatorServiceAbilityTest",
635c735df2Sopenharmony_ci      "$SAMGR_ROOT_DIR/safwk/interfaces/innerkits/safwk:system_ability_fwk",
645c735df2Sopenharmony_ci      "$SAMGR_ROOT_DIR/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
655c735df2Sopenharmony_ci      "$START_UP_ROOT_DIR/init/interfaces/innerkits:libbegetutil",
665c735df2Sopenharmony_ci    ]
675c735df2Sopenharmony_ci
685c735df2Sopenharmony_ci    external_deps = [
695c735df2Sopenharmony_ci      "ability_base:want",
705c735df2Sopenharmony_ci      "access_token:libaccesstoken_sdk",
715c735df2Sopenharmony_ci      "access_token:libnativetoken",
725c735df2Sopenharmony_ci      "access_token:libtoken_setproc",
735c735df2Sopenharmony_ci      "c_utils:utils",
745c735df2Sopenharmony_ci      "cellular_data:tel_cellular_data_api",
755c735df2Sopenharmony_ci      "common_event_service:cesfwk_innerkits",
765c735df2Sopenharmony_ci      "core_service:tel_core_service_api",
775c735df2Sopenharmony_ci      "distributed_notification_service:ans_innerkits",
785c735df2Sopenharmony_ci      "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0",
795c735df2Sopenharmony_ci      "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0",
805c735df2Sopenharmony_ci      "eventhandler:libeventhandler",
815c735df2Sopenharmony_ci      "ffrt:libffrt",
825c735df2Sopenharmony_ci      "hdf_core:libhdi",
835c735df2Sopenharmony_ci      "hdf_core:libpub_utils",
845c735df2Sopenharmony_ci      "hilog:libhilog",
855c735df2Sopenharmony_ci      "hisysevent:libhisysevent",
865c735df2Sopenharmony_ci      "init:libbegetutil",
875c735df2Sopenharmony_ci    ]
885c735df2Sopenharmony_ci
895c735df2Sopenharmony_ci    defines = []
905c735df2Sopenharmony_ci    if (location_feature_with_gnss) {
915c735df2Sopenharmony_ci      defines += [ "FEATURE_GNSS_SUPPORT" ]
925c735df2Sopenharmony_ci    }
935c735df2Sopenharmony_ci
945c735df2Sopenharmony_ci    if (telephony_core_service_enable) {
955c735df2Sopenharmony_ci      external_deps += [ "core_service:tel_core_service_api" ]
965c735df2Sopenharmony_ci      defines += [ "TEL_CORE_SERVICE_ENABLE" ]
975c735df2Sopenharmony_ci    }
985c735df2Sopenharmony_ci
995c735df2Sopenharmony_ci    if (hdf_drivers_interface_location_agnss_enable) {
1005c735df2Sopenharmony_ci      defines += [ "HDF_DRIVERS_INTERFACE_AGNSS_ENABLE" ]
1015c735df2Sopenharmony_ci    }
1025c735df2Sopenharmony_ci
1035c735df2Sopenharmony_ci    if (hdf_drivers_interface_location_geofence_enable) {
1045c735df2Sopenharmony_ci      external_deps += [
1055c735df2Sopenharmony_ci        "drivers_interface_location_geofence:liblocation_geofence_proxy_2.0",
1065c735df2Sopenharmony_ci      ]
1075c735df2Sopenharmony_ci      defines += [ "HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE" ]
1085c735df2Sopenharmony_ci    }
1095c735df2Sopenharmony_ci    if (notification_distributed_notification_service_enable) {
1105c735df2Sopenharmony_ci      defines += [ "NOTIFICATION_ENABLE" ]
1115c735df2Sopenharmony_ci    }
1125c735df2Sopenharmony_ci    if (call_manager_enable) {
1135c735df2Sopenharmony_ci      external_deps += [ "call_manager:tel_call_manager_api" ]
1145c735df2Sopenharmony_ci      defines += [ "CALL_MANAGER_ENABLE" ]
1155c735df2Sopenharmony_ci    }
1165c735df2Sopenharmony_ci
1175c735df2Sopenharmony_ci    if (common_event_service_enable) {
1185c735df2Sopenharmony_ci      external_deps += [
1195c735df2Sopenharmony_ci        "ability_runtime:extension_manager",
1205c735df2Sopenharmony_ci        "common_event_service:cesfwk_innerkits",
1215c735df2Sopenharmony_ci      ]
1225c735df2Sopenharmony_ci      defines += [ "COMMON_EVENT_SERVICE_ENABLE" ]
1235c735df2Sopenharmony_ci    }
1245c735df2Sopenharmony_ci
1255c735df2Sopenharmony_ci    if (sms_mms_enable) {
1265c735df2Sopenharmony_ci      defines += [ "SMS_MMS_ENABLE" ]
1275c735df2Sopenharmony_ci    }
1285c735df2Sopenharmony_ci
1295c735df2Sopenharmony_ci    if (time_service_enable) {
1305c735df2Sopenharmony_ci      external_deps += [ "time_service:time_client" ]
1315c735df2Sopenharmony_ci      defines += [ "TIME_SERVICE_ENABLE" ]
1325c735df2Sopenharmony_ci    }
1335c735df2Sopenharmony_ci
1345c735df2Sopenharmony_ci    if (net_manager_enable) {
1355c735df2Sopenharmony_ci      external_deps += [ "netmanager_base:net_conn_manager_if" ]
1365c735df2Sopenharmony_ci      defines += [ "NET_MANAGER_ENABLE" ]
1375c735df2Sopenharmony_ci    }
1385c735df2Sopenharmony_ci    module_out_path = module_output_path
1395c735df2Sopenharmony_ci  }
1405c735df2Sopenharmony_ci} else {
1415c735df2Sopenharmony_ci  ohos_unittest("GnssAbilityTest") {
1425c735df2Sopenharmony_ci    module_out_path = module_output_path
1435c735df2Sopenharmony_ci  }
1445c735df2Sopenharmony_ci}
1455c735df2Sopenharmony_ci
1465c735df2Sopenharmony_cigroup("unittest") {
1475c735df2Sopenharmony_ci  testonly = true
1485c735df2Sopenharmony_ci  deps = []
1495c735df2Sopenharmony_ci
1505c735df2Sopenharmony_ci  deps += [ ":GnssAbilityTest" ]
1515c735df2Sopenharmony_ci}
152