• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    "${udmf_interfaces_path}/innerkits/data",
26    "${udmf_framework_path}/common/unittest/mock/include",
27    "${udmf_framework_path}/innerkitsimpl/client/",
28  ]
29}
30
31common_deps = [
32  "${udmf_interfaces_path}/innerkits:udmf_client",
33  "${udmf_interfaces_path}/innerkits:utd_client",
34]
35
36common_external_deps = [
37  "ability_base:want",
38  "ability_base:zuri",
39  "access_token:libaccesstoken_sdk",
40  "access_token:libnativetoken",
41  "access_token:libtoken_setproc",
42  "bundle_framework:appexecfwk_core",
43  "c_utils:utils",
44  "ffmpeg:libohosffmpeg",
45  "hilog:libhilog",
46  "hisysevent:libhisysevent",
47  "hitrace:hitrace_meter",
48  "hitrace:libhitracechain",
49  "image_framework:image",
50  "image_framework:image_native",
51  "image_framework:pixelmap",
52  "ipc:ipc_core",
53  "kv_store:distributeddata_inner",
54  "kv_store:distributeddata_mgr",
55  "libexif:libexif",
56  "samgr:samgr_proxy",
57]
58
59ohos_unittest("UtdCfgsCheckerTest") {
60  module_out_path = module_output_path
61
62  sources = [
63    "${udmf_framework_path}/common/graph.cpp",
64    "${udmf_framework_path}/common/utd_cfgs_checker.cpp",
65    "${udmf_framework_path}/common/utd_graph.cpp",
66    "utd_cfgs_checker_test.cpp",
67  ]
68
69  configs = [ ":module_private_config" ]
70
71  deps = common_deps
72  use_exceptions = true
73  external_deps = common_external_deps
74}
75
76ohos_unittest("UdmfTypesUtilTest") {
77  module_out_path = module_output_path
78
79  sources = [ "udmf_types_util_test.cpp" ]
80
81  configs = [ ":module_private_config" ]
82
83  deps = common_deps
84
85  external_deps = common_external_deps
86
87  defines = [
88    "private=public",
89    "protected=public",
90  ]
91}
92
93ohos_unittest("UdmfTypesUtilAbnormalTest") {
94  module_out_path = module_output_path
95
96  sources = [
97    "${udmf_framework_path}/common/tlv_object.cpp",
98    "${udmf_framework_path}/common/udmf_types_util.cpp",
99    "${udmf_framework_path}/common/udmf_utils.cpp",
100    "${udmf_framework_path}/common/unittest/mock/tlv_util_mock.cpp",
101    "${udmf_framework_path}/innerkitsimpl/client/getter_system.cpp",
102    "${udmf_framework_path}/innerkitsimpl/common/unified_meta.cpp",
103    "${udmf_framework_path}/innerkitsimpl/convert/udmf_conversion.cpp",
104    "${udmf_framework_path}/innerkitsimpl/data/application_defined_record.cpp",
105    "${udmf_framework_path}/innerkitsimpl/data/file.cpp",
106    "${udmf_framework_path}/innerkitsimpl/data/image.cpp",
107    "${udmf_framework_path}/innerkitsimpl/data/plain_text.cpp",
108    "${udmf_framework_path}/innerkitsimpl/data/system_defined_form.cpp",
109    "${udmf_framework_path}/innerkitsimpl/data/system_defined_record.cpp",
110    "${udmf_framework_path}/innerkitsimpl/data/text.cpp",
111    "${udmf_framework_path}/innerkitsimpl/data/unified_data.cpp",
112    "${udmf_framework_path}/innerkitsimpl/data/unified_record.cpp",
113    "udmf_types_util_abnormal_test.cpp",
114  ]
115
116  configs = [ ":module_private_config" ]
117
118  deps = [
119    "${udmf_interfaces_path}/innerkits:udmf_client",
120    "${udmf_interfaces_path}/innerkits:utd_client",
121    "//third_party/googletest:gmock_main",
122    "//third_party/googletest:gtest_main",
123  ]
124
125  external_deps = common_external_deps
126
127  defines = [
128    "private=public",
129    "protected=public",
130  ]
131}
132
133ohos_unittest("TlvUtilTest") {
134  module_out_path = module_output_path
135
136  sources = [
137    "${udmf_framework_path}/innerkitsimpl/common/unified_meta.cpp",
138    "${udmf_framework_path}/innerkitsimpl/convert/udmf_conversion.cpp",
139    "${udmf_framework_path}/innerkitsimpl/data/unified_record.cpp",
140    "tlv_util_test.cpp",
141  ]
142
143  configs = [ ":module_private_config" ]
144
145  deps = common_deps
146
147  external_deps = [
148    "ability_base:base",
149    "ability_base:want",
150    "c_utils:utils",
151    "hilog:libhilog",
152    "image_framework:image",
153    "image_framework:image_native",
154    "image_framework:pixelmap",
155  ]
156
157  defines = [
158    "private=public",
159    "protected=public",
160  ]
161}
162
163ohos_unittest("EndianConverterTest") {
164  module_out_path = module_output_path
165
166  sources = [
167    "${udmf_framework_path}/common/endian_converter.cpp",
168    "endian_converter_test.cpp",
169  ]
170
171  configs = [ ":module_private_config" ]
172
173  deps = common_deps
174
175  external_deps = common_external_deps
176
177  defines = [
178    "private=public",
179    "protected=public",
180  ]
181}
182
183###############################################################################
184group("unittest") {
185  testonly = true
186
187  deps = [
188    ":EndianConverterTest",
189    ":TlvUtilTest",
190    ":UdmfTypesUtilAbnormalTest",
191    ":UdmfTypesUtilTest",
192    ":UtdCfgsCheckerTest",
193  ]
194}
195###############################################################################
196