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. 13import("//build/test.gni") 14import("//foundation/distributeddatamgr/udmf/udmf.gni") 15 16module_output_path = "udmf/common" 17 18############################################################################### 19config("module_private_config") { 20 include_dirs = [ 21 "${udmf_interfaces_path}/innerkits/common", 22 "${udmf_interfaces_path}/innerkits/convert", 23 "${udmf_framework_path}/innerkitsimpl/data", 24 "${udmf_framework_path}/common", 25 "${kv_store_path}/frameworks/common", 26 "${udmf_interfaces_path}/innerkits/data", 27 "${udmf_framework_path}/common/unittest/mock/include", 28 "${udmf_framework_path}/innerkitsimpl/client/", 29 ] 30} 31 32common_deps = [ "${udmf_interfaces_path}/innerkits:udmf_client" ] 33 34common_external_deps = [ 35 "ability_base:want", 36 "access_token:libaccesstoken_sdk", 37 "access_token:libnativetoken", 38 "access_token:libtoken_setproc", 39 "bundle_framework:appexecfwk_core", 40 "c_utils:utils", 41 "ffmpeg:libohosffmpeg", 42 "hilog:libhilog", 43 "hisysevent:libhisysevent", 44 "hitrace:hitrace_meter", 45 "hitrace:libhitracechain", 46 "image_framework:image", 47 "image_framework:image", 48 "image_framework:image_native", 49 "image_framework:pixelmap", 50 "ipc:ipc_core", 51 "kv_store:distributeddata_inner", 52 "kv_store:distributeddata_mgr", 53 "libexif:libexif", 54 "samgr:samgr_proxy", 55] 56 57ohos_unittest("UtdCfgsCheckerTest") { 58 module_out_path = module_output_path 59 60 sources = [ 61 "${udmf_framework_path}/common/graph.cpp", 62 "${udmf_framework_path}/common/utd_cfgs_checker.cpp", 63 "${udmf_framework_path}/common/utd_graph.cpp", 64 "utd_cfgs_checker_test.cpp", 65 ] 66 67 configs = [ ":module_private_config" ] 68 69 deps = common_deps 70 71 external_deps = common_external_deps 72} 73 74ohos_unittest("UdmfTypesUtilTest") { 75 module_out_path = module_output_path 76 77 sources = [ "udmf_types_util_test.cpp" ] 78 79 configs = [ ":module_private_config" ] 80 81 deps = common_deps 82 83 external_deps = common_external_deps 84 85 defines = [ 86 "private=public", 87 "protected=public", 88 ] 89} 90 91ohos_unittest("UdmfTypesUtilAbnormalTest") { 92 module_out_path = module_output_path 93 94 sources = [ 95 "${udmf_framework_path}/common/tlv_object.cpp", 96 "${udmf_framework_path}/common/udmf_types_util.cpp", 97 "${udmf_framework_path}/common/unittest/mock/tlv_util_mock.cpp", 98 "${udmf_framework_path}/innerkitsimpl/common/unified_meta.cpp", 99 "${udmf_framework_path}/innerkitsimpl/convert/udmf_conversion.cpp", 100 "${udmf_framework_path}/innerkitsimpl/data/application_defined_record.cpp", 101 "${udmf_framework_path}/innerkitsimpl/data/file.cpp", 102 "${udmf_framework_path}/innerkitsimpl/data/image.cpp", 103 "${udmf_framework_path}/innerkitsimpl/data/plain_text.cpp", 104 "${udmf_framework_path}/innerkitsimpl/data/system_defined_form.cpp", 105 "${udmf_framework_path}/innerkitsimpl/data/system_defined_record.cpp", 106 "${udmf_framework_path}/innerkitsimpl/data/text.cpp", 107 "${udmf_framework_path}/innerkitsimpl/data/unified_data.cpp", 108 "${udmf_framework_path}/innerkitsimpl/data/unified_record.cpp", 109 "udmf_types_util_abnormal_test.cpp", 110 ] 111 112 configs = [ ":module_private_config" ] 113 114 deps = [ 115 "${udmf_interfaces_path}/innerkits:udmf_client", 116 "${udmf_interfaces_path}/innerkits:utd_client", 117 "//third_party/googletest:gmock_main", 118 "//third_party/googletest:gtest_main", 119 ] 120 121 external_deps = common_external_deps 122 123 defines = [ 124 "private=public", 125 "protected=public", 126 ] 127} 128 129ohos_unittest("TlvUtilTest") { 130 module_out_path = module_output_path 131 132 sources = [ "tlv_util_test.cpp" ] 133 134 configs = [ ":module_private_config" ] 135 136 deps = common_deps 137 138 external_deps = [ 139 "ability_base:want", 140 "c_utils:utils", 141 "hilog:libhilog", 142 "image_framework:image", 143 "image_framework:image_native", 144 "image_framework:pixelmap", 145 ] 146 147 defines = [ 148 "private=public", 149 "protected=public", 150 ] 151} 152 153############################################################################### 154group("unittest") { 155 testonly = true 156 157 deps = [ 158 ":TlvUtilTest", 159 ":UdmfTypesUtilAbnormalTest", 160 ":UdmfTypesUtilTest", 161 ":UtdCfgsCheckerTest", 162 ] 163} 164############################################################################### 165