1# Copyright (c) 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("//build/ohos.gni") 15import("//build/test.gni") 16import("../../../../../os_account.gni") 17 18module_output_path = "os_account/services/ohos_account" 19 20config("accountmgr_data_deal_test_config") { 21 include_dirs = [ 22 "./include", 23 "${app_account_core_path}/include", 24 "${app_account_interfaces_native_path}/include", 25 "${common_path}/log/include", 26 "${common_path}/account_error/include", 27 "${os_account_dfx_path}/hisysevent_adapter", 28 "${services_path}/accountmgr/include", 29 "//third_party/json/include", 30 "${innerkits_path}/include", 31 ] 32} 33 34ohos_unittest("OhosServiceTest") { 35 module_out_path = module_output_path 36 cflags_cc = [] 37 include_dirs = [ 38 "${account_iam_interfaces_native_path}/include", 39 "${os_account_interfaces_native_path}/include", 40 "${os_account_core_path}/include", 41 ] 42 43 sources = [ 44 "${common_path}/log/src/account_log_wrapper.cpp", 45 "${os_account_dfx_path}/hisysevent_adapter/hisysevent_adapter.cpp", 46 "${services_path}/accountmgr/src/account_event_provider.cpp", 47 "${services_path}/accountmgr/src/account_mgr_service.cpp", 48 "${services_path}/accountmgr/src/ohos_account_data_deal.cpp", 49 "${services_path}/accountmgr/src/ohos_account_manager.cpp", 50 ] 51 52 sources += [ "ohos_account_manager_test.cpp" ] 53 54 configs = [ 55 ":accountmgr_data_deal_test_config", 56 "${services_path}/accountmgr:accountmgr_config", 57 "${services_path}/accountmgr/test:accountmgr_test_config", 58 ] 59 60 deps = [ 61 "${common_path}:libaccount_common", 62 "${os_account_innerkits_native_path}:os_account_innerkits", 63 "${services_path}/accountmgr:accountmgr", 64 "//third_party/googletest:gmock_main", 65 "//third_party/googletest:gtest_main", 66 "//third_party/mbedtls:mbedtls", 67 ] 68 69 external_deps = [ 70 "ability_base:base", 71 "ability_base:want", 72 "ability_runtime:app_manager", 73 "c_utils:utils", 74 "hilog:libhilog", 75 "ipc:ipc_single", 76 "kv_store:distributeddata_inner", 77 "safwk:system_ability_fwk", 78 ] 79 if (has_hiviewdfx_hisysevent_part) { 80 cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] 81 external_deps += [ "hisysevent:libhisysevent" ] 82 } 83 if (has_ces_part) { 84 cflags_cc += [ "-DHAS_CES_PART" ] 85 external_deps += [ "common_event_service:cesfwk_innerkits" ] 86 } 87 part_name = "os_account" 88} 89 90ohos_unittest("OhosDataDealTest") { 91 module_out_path = module_output_path 92 cflags_cc = [] 93 resource_config_file = 94 "${os_account_path}/test/resource/accountmgrservice/ohos_test.xml" 95 include_dirs = [ 96 "${account_iam_interfaces_native_path}/include", 97 "${os_account_interfaces_native_path}/include", 98 "${os_account_core_path}/include", 99 ] 100 101 sources = [ 102 "${common_path}/log/src/account_log_wrapper.cpp", 103 "${os_account_dfx_path}/hisysevent_adapter/hisysevent_adapter.cpp", 104 "${services_path}/accountmgr/src/ohos_account_data_deal.cpp", 105 ] 106 107 sources += [ "ohos_account_data_deal_test.cpp" ] 108 109 configs = [ 110 ":accountmgr_data_deal_test_config", 111 "${services_path}/accountmgr/test:accountmgr_test_config", 112 ] 113 114 deps = [ 115 "//third_party/googletest:gmock_main", 116 "//third_party/googletest:gtest_main", 117 ] 118 119 external_deps = [ 120 "ability_base:want", 121 "c_utils:utils", 122 "hilog:libhilog", 123 ] 124 if (has_hiviewdfx_hisysevent_part) { 125 cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] 126 external_deps += [ "hisysevent:libhisysevent" ] 127 } 128 part_name = "os_account" 129} 130 131group("unittest") { 132 testonly = true 133 134 deps = [ 135 ":OhosDataDealTest", 136 ":OhosServiceTest", 137 ] 138} 139