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. 13import("//build/test.gni") 14import("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni") 15 16module_output_path = "datamgr_service/distributeddataservice" 17 18############################################################################### 19config("module_private_config") { 20 visibility = [ ":*" ] 21 include_dirs = [ 22 "//foundation/distributeddatamgr/kv_store/frameworks/common", 23 "//foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/distributeddatafwk/include", 24 "//foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/distributeddatafwk/src", 25 "//foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/kvdb/include", 26 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata/include", 27 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/include/permission", 28 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/include/account", 29 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/include", 30 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/include/dfx", 31 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/include/broadcaster", 32 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/include/utils", 33 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework/include", 34 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/bootstrap/include", 35 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/config/include", 36 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/crypto/include", 37 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/directory/include", 38 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/permission/include", 39 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/matrix/include", 40 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/session_manager", 41 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/kvdb", 42 "//foundation/distributeddatamgr/distributedfile/interfaces/kits/js/src/mod_securitylabel", 43 "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include", 44 "//commonlibrary/c_utils/base/include", 45 "//utils/system/safwk/native/include", 46 "../include", 47 "../src", 48 "../src/security", 49 "unittest", 50 "../src/uninstaller", 51 "../src/flowctrl_manager", 52 "../../service/backup/include", 53 "../../../../interfaces/innerkits/distributeddata", 54 "//third_party/json/single_include", 55 ] 56 57 if (datamgr_service_power) { 58 include_dirs += 59 [ "//base/powermgr/power_manager/interfaces/innerkits/native/include" ] 60 } 61 ldflags = [ "-Wl,--whole-archive" ] 62 defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 63} 64 65ohos_unittest("KvStoreDataServiceTest") { 66 module_out_path = module_output_path 67 sources = [ 68 "../src/dump_helper.cpp", 69 "../src/feature_stub_impl.cpp", 70 "../src/kvstore_account_observer.cpp", 71 "../src/kvstore_data_service.cpp", 72 "../src/kvstore_device_listener.cpp", 73 "../src/kvstore_meta_manager.cpp", 74 "../src/security/security.cpp", 75 "../src/security/sensitive.cpp", 76 "../src/session_manager/route_head_handler_impl.cpp", 77 "../src/session_manager/session_manager.cpp", 78 "../src/session_manager/upgrade_manager.cpp", 79 "../src/task_manager.cpp", 80 "unittest/kvstore_data_service_test.cpp", 81 ] 82 83 configs = [ ":module_private_config" ] 84 85 external_deps = [ 86 "access_token:libaccesstoken_sdk", 87 "c_utils:utils", 88 "dataclassification:data_transit_mgr", 89 "device_auth:deviceauth_sdk", 90 "hilog:libhilog", 91 "hisysevent:libhisysevent", 92 "hitrace:hitrace_meter", 93 "hitrace:libhitracechain", 94 "ipc:ipc_core", 95 "safwk:system_ability_fwk", 96 "samgr:samgr_proxy", 97 ] 98 99 if (datamgr_service_power) { 100 external_deps += [ 101 "battery_manager:batterysrv_client", 102 "power_manager:powermgr_client", 103 ] 104 } 105 106 deps = [ 107 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 108 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/broadcaster:distributeddata_broadcaster_static", 109 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/utils:distributeddata_utils_static", 110 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/checker:distributeddata_checker_static", 111 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/flowctrl_manager:distributeddata_flowctrl_static", 112 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/uninstaller:distributeddata_uninstaller_static", 113 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", 114 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", 115 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb", 116 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", 117 "//third_party/googletest:gtest_main", 118 ] 119 part_name = "datamgr_service" 120} 121 122ohos_unittest("SessionManagerTest") { 123 module_out_path = module_output_path 124 125 sources = [ 126 "../src/kvstore_meta_manager.cpp", 127 "../src/session_manager/route_head_handler_impl.cpp", 128 "../src/session_manager/session_manager.cpp", 129 "../src/session_manager/upgrade_manager.cpp", 130 "unittest/session_manager_test.cpp", 131 ] 132 133 cflags_cc = [ "-DUT_TEST" ] 134 configs = [ ":module_private_config" ] 135 136 external_deps = [ 137 "access_token:libaccesstoken_sdk", 138 "access_token:libnativetoken", 139 "access_token:libtoken_setproc", 140 "c_utils:utils", 141 "dataclassification:data_transit_mgr", 142 "device_auth:deviceauth_sdk", 143 "hilog:libhilog", 144 "ipc:ipc_core", 145 "safwk:system_ability_fwk", 146 "samgr:samgr_proxy", 147 ] 148 149 if (datamgr_service_power) { 150 external_deps += [ 151 "battery_manager:batterysrv_client", 152 "power_manager:powermgr_client", 153 ] 154 } 155 156 deps = [ 157 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 158 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/broadcaster:distributeddata_broadcaster_static", 159 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/utils:distributeddata_utils_static", 160 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/checker:distributeddata_checker_static", 161 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", 162 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", 163 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb", 164 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", 165 "//third_party/googletest:gtest_main", 166 ] 167 168 part_name = "datamgr_service" 169} 170 171ohos_unittest("KvStoreFlowCtrlManagerTest") { 172 module_out_path = module_output_path 173 sources = [ "unittest/kvstore_flowctrl_manager_test.cpp" ] 174 175 configs = [ ":module_private_config" ] 176 177 external_deps = [ 178 "access_token:libaccesstoken_sdk", 179 "c_utils:utils", 180 "dataclassification:data_transit_mgr", 181 "device_auth:deviceauth_sdk", 182 "hilog:libhilog", 183 "ipc:ipc_core", 184 "safwk:system_ability_fwk", 185 "samgr:samgr_proxy", 186 ] 187 188 if (datamgr_service_power) { 189 external_deps += [ 190 "battery_manager:batterysrv_client", 191 "power_manager:powermgr_client", 192 ] 193 } 194 195 deps = [ 196 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 197 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/flowctrl_manager:distributeddata_flowctrl_static", 198 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", 199 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", 200 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", 201 "//third_party/googletest:gtest_main", 202 ] 203 part_name = "datamgr_service" 204} 205 206############################################################################### 207 208group("unittest") { 209 testonly = true 210 deps = [] 211 212 deps += [ 213 ":KvStoreDataServiceTest", 214 ":KvStoreFlowCtrlManagerTest", 215 ":SessionManagerTest", 216 ] 217} 218 219############################################################################### 220group("moduletest") { 221 testonly = true 222 deps = [ 223 "//third_party/googletest:gmock", 224 "//third_party/googletest:gtest_main", 225 "//third_party/sqlite:sqlite", 226 ] 227 228 deps += [ 229 #":DistributedDataAccountEventModuleTest", 230 #":DistributedDataFlowCtrlManagerTest", 231 ] 232} 233############################################################################### 234