1# Copyright (c) 2024 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("//build/lite/config/component/lite_component.gni")
15import("//build/ohos.gni")
16import("//build/test.gni")
17import("../../../adapter/common/net/bluetooth/net_bluetooth.gni")
18import("../../../core/common/dfx/dsoftbus_dfx.gni")
19import("../../../dsoftbus.gni")
20
21if (!defined(ohos_lite)) {
22  module_output_path = "dsoftbus/adapter"
23  bc_gatt_test_sources = [
24    "$dsoftbus_root_path/adapter/common/net/bluetooth/broadcast/adapter/ble/src/softbus_ble_gatt.c",
25    "$dsoftbus_root_path/adapter/common/net/bluetooth/broadcast/adapter/ble/src/softbus_ble_utils.c",
26    "bluetooth_mock.cpp",
27  ]
28
29  bc_gatt_test_inc =
30      [ "${dsoftbus_root_path}/adapter/common/net/bluetooth/include" ]
31  bc_gatt_test_inc += adapter_ble_inc
32
33  bc_gatt_test_deps = [
34    "$dsoftbus_dfx_path/log:softbus_dfx_log",
35    "$dsoftbus_root_path/core/common:softbus_utils",
36  ]
37
38  bc_gatt_test_external_deps = [
39    "c_utils:utils",
40    "googletest:gmock_main",
41    "googletest:gtest_main",
42    "hilog:libhilog",
43  ]
44
45  if (support_bluetooth &&
46      (dsoftbus_feature_conn_ble || dsoftbus_feature_conn_br)) {
47    bc_gatt_test_external_deps += [ "bluetooth:btframework" ]
48  }
49
50  ohos_unittest("SoftbusBleGattTest") {
51    module_out_path = module_output_path
52    sources = bc_gatt_test_sources
53    sources += [ "softbus_ble_gatt_test.cpp" ]
54
55    include_dirs = bc_gatt_test_inc
56    deps = bc_gatt_test_deps
57    external_deps = bc_gatt_test_external_deps
58  }
59
60  ohos_unittest("SoftbusBleUtilsTest") {
61    module_out_path = module_output_path
62    sources = bc_gatt_test_sources
63    sources += [ "softbus_ble_utils_test.cpp" ]
64
65    include_dirs = bc_gatt_test_inc
66    deps = bc_gatt_test_deps
67    external_deps = bc_gatt_test_external_deps
68  }
69
70  group("unittest") {
71    testonly = true
72    deps = []
73    if (support_bluetooth &&
74        (dsoftbus_feature_conn_ble || dsoftbus_feature_conn_br)) {
75      deps += [
76        ":SoftbusBleGattTest",
77        ":SoftbusBleUtilsTest",
78      ]
79    }
80  }
81}
82