1# Copyright (c) 2021 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/test.gni") 15import("//foundation/communication/dsoftbus/dsoftbus.gni") 16 17module_output_path = "dsoftbus/auth" 18 19ohos_unittest("AuthTest") { 20 module_out_path = module_output_path 21 sources = [ "unittest/auth_test.cpp" ] 22 23 include_dirs = [ 24 "//base/security/device_auth/interfaces/innerkits", 25 "$dsoftbus_root_path/core/authentication/include", 26 "$dsoftbus_root_path/core/authentication/interface", 27 "$dsoftbus_root_path/core/bus_center/interface", 28 "$dsoftbus_root_path/core/bus_center/utils/include", 29 "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include", 30 "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include", 31 "$dsoftbus_root_path/core/common/include", 32 "$dsoftbus_root_path/core/common/message_handler/include", 33 "$dsoftbus_root_path/core/connection/interface", 34 "$dsoftbus_root_path/core/frame/$os_type/init/include", 35 "$dsoftbus_root_path/core/frame/common/include", 36 "$dsoftbus_root_path/interfaces/kits/bus_center", 37 "$dsoftbus_root_path/interfaces/kits/common", 38 "$dsoftbus_root_path/core/connection/manager", 39 "$dsoftbus_root_path/adapter/common/include/", 40 "$dsoftbus_root_path/tests/sdk/common/include", 41 "//commonlibrary/c_utils/base/include", 42 "//third_party/cJSON", 43 "unittest/common/", 44 "//third_party/bounds_checking_function/include", 45 ] 46 47 deps = [ 48 "$dsoftbus_root_path/core/common:softbus_utils", 49 "$dsoftbus_root_path/core/frame:softbus_server", 50 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 51 "//third_party/bounds_checking_function:libsec_shared", 52 "//third_party/googletest:gtest_main", 53 ] 54 55 if (is_standard_system) { 56 external_deps = [ 57 "c_utils:utils", 58 "hiviewdfx_hilog_native:libhilog", 59 ] 60 } else { 61 external_deps = [ 62 "c_utils:utils", 63 "hilog:libhilog", 64 ] 65 } 66} 67 68ohos_unittest("AuthTestMock") { 69 module_out_path = module_output_path 70 sources = [ 71 "$dsoftbus_root_path/core/authentication/src/auth_common.c", 72 "$dsoftbus_root_path/core/authentication/src/auth_connection.c", 73 "$dsoftbus_root_path/core/authentication/src/auth_hichain.c", 74 "$dsoftbus_root_path/core/authentication/src/auth_interface.c", 75 "$dsoftbus_root_path/core/authentication/src/auth_manager.c", 76 "$dsoftbus_root_path/core/authentication/src/auth_request.c", 77 "$dsoftbus_root_path/core/authentication/src/auth_session_fsm.c", 78 "$dsoftbus_root_path/core/authentication/src/auth_session_key.c", 79 "$dsoftbus_root_path/core/authentication/src/auth_session_message.c", 80 "$dsoftbus_root_path/core/authentication/src/auth_tcp_connection.c", 81 "$dsoftbus_root_path/core/authentication/src/virtual/auth_meta_manager_virtual.c", 82 "$dsoftbus_root_path/core/bus_center/utils/src/lnn_state_machine.c", 83 "unittest/auth_connection_mock.cpp", 84 "unittest/auth_hichain_mock.cpp", 85 "unittest/auth_net_ledger_mock.cpp", 86 "unittest/auth_test_enhance.cpp", 87 ] 88 89 include_dirs = [ 90 "//base/security/device_auth/interfaces/innerkits", 91 "$dsoftbus_root_path/core/authentication/include", 92 "$dsoftbus_root_path/core/authentication/interface", 93 "$dsoftbus_root_path/core/bus_center/interface", 94 "$dsoftbus_root_path/core/bus_center/utils/include", 95 "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include", 96 "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include", 97 "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include", 98 "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include", 99 "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include", 100 "$dsoftbus_root_path/core/common/include", 101 "$dsoftbus_root_path/core/common/message_handler/include", 102 "$dsoftbus_root_path/core/connection/interface", 103 "$dsoftbus_root_path/core/frame/$os_type/init/include", 104 "$dsoftbus_root_path/core/frame/common/include", 105 "$dsoftbus_root_path/core/discovery/manager/include", 106 "$dsoftbus_root_path/core/discovery/interface", 107 "$dsoftbus_root_path/interfaces/kits/bus_center", 108 "$dsoftbus_root_path/interfaces/kits/discovery", 109 "$dsoftbus_root_path/interfaces/kits/common", 110 "$dsoftbus_root_path/core/connection/manager", 111 "$dsoftbus_root_path/adapter/common/include/", 112 "$dsoftbus_root_path/tests/sdk/common/include", 113 "//commonlibrary/c_utils/base/include", 114 "//third_party/cJSON", 115 "unittest/common/", 116 "//third_party/bounds_checking_function/include", 117 ] 118 119 deps = [ 120 "$dsoftbus_root_path/adapter:softbus_adapter", 121 "$dsoftbus_root_path/core/common:softbus_utils", 122 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 123 "//third_party/bounds_checking_function:libsec_shared", 124 "//third_party/googletest:gmock", 125 "//third_party/googletest:gtest_main", 126 ] 127 128 if (is_standard_system) { 129 external_deps = [ 130 "c_utils:utils", 131 "hiviewdfx_hilog_native:libhilog", 132 ] 133 } else { 134 external_deps = [ 135 "c_utils:utils", 136 "hilog:libhilog", 137 ] 138 } 139} 140 141group("unittest") { 142 testonly = true 143 deps = [ 144 ":AuthTest", 145 ":AuthTestMock", 146 ] 147} 148