• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/test.gni")
15import("//foundation/multimedia/av_codec/config.gni")
16
17module_output_path = "av_codec/unittest"
18dash_test_sources = [
19  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/base64/base64_utils.cpp",
20  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/dash_media_downloader.cpp",
21  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/dash_mpd_downloader.cpp",
22  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/dash_segment_downloader.cpp",
23  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_adpt_set_manager.cpp",
24  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_adpt_set_node.cpp",
25  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_com_attrs_elements.cpp",
26  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_content_comp_node.cpp",
27  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_descriptor_node.cpp",
28  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_manager_util.cpp",
29  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_mpd_manager.cpp",
30  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_mpd_node.cpp",
31  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_mpd_parser.cpp",
32  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_mpd_util.cpp",
33  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_mult_seg_base_node.cpp",
34  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_period_manager.cpp",
35  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_period_node.cpp",
36  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_representation_manager.cpp",
37  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_representation_node.cpp",
38  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_seg_base_node.cpp",
39  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_seg_list_node.cpp",
40  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_seg_template_node.cpp",
41  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_seg_tmline_node.cpp",
42  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_seg_url_node.cpp",
43  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/dash_url_type_node.cpp",
44  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/i_dash_mpd_node.cpp",
45  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/mpd_parser/sidx_box_parser.cpp",
46  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/app_client.cpp",
47  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/downloader.cpp",
48  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/media_source_loading_request.cpp",
49  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/network_client/http_curl_client.cpp",
50  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/xml/xml_element.cpp",
51  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/xml/xml_parser.cpp",
52  "$av_codec_root_dir/test/unittest/common/http_server_demo.cpp",
53]
54config("dash_unittest_cfg") {
55  defines = [
56    "HST_ANY_WITH_NO_RTTI",
57    "MEDIA_OHOS",
58  ]
59
60  cflags = [
61    "-Wno-sign-compare",
62    "-fno-exceptions",
63    "-fno-common",
64    "-fstack-protector-all",
65    "-Wshadow",
66    "-FPIC",
67    "-FS",
68    "-O2",
69    "-D_FORTIFY_SOURCE=2",
70    "-Wformat=2",
71    "-Wdate-time",
72  ]
73
74  cflags_cc = [
75    "-std=c++17",
76    "-fno-rtti",
77  ]
78
79  include_dirs = [
80    "$av_codec_root_dir/interfaces",
81    "$av_codec_root_dir/interfaces/inner_api/native",
82    "$av_codec_root_dir/services/media_engine/plugins/source/http_source",
83    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download",
84    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/xml",
85    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/base64",
86    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash",
87    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/include",
88    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/include/mpd_parser",
89    "$av_codec_root_dir/test/unittest/common",
90    "$media_foundation_root_dir/interface/inner_api",
91    "$media_foundation_root_dir/src",
92    "//third_party/curl/include",
93  ]
94}
95
96ohos_unittest("dash_xml_unit_test") {
97  module_out_path = module_output_path
98  testonly = true
99  configs = [
100    ":dash_unittest_cfg",
101    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
102  ]
103  sources = dash_test_sources + [ "dash_xml_unit_test.cpp" ]
104  deps = [
105    "$av_codec_root_dir/services/dfx:av_codec_service_dfx",
106    "//third_party/curl:curl_shared",
107    "//third_party/openssl:libcrypto_shared",
108  ]
109
110  external_deps = [
111    "c_utils:utils",
112    "graphic_surface:surface",
113    "hilog:libhilog",
114    "init:libbegetutil",
115    "ipc:ipc_single",
116    "libxml2:libxml2",
117    "media_foundation:media_foundation",
118    "netmanager_base:net_conn_manager_if",
119    "safwk:system_ability_fwk",
120  ]
121}
122
123ohos_unittest("dash_mpd_parser_unit_test") {
124  module_out_path = module_output_path
125  testonly = true
126  configs = [
127    ":dash_unittest_cfg",
128    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
129  ]
130  sources = dash_test_sources + [ "dash_mpd_parser_unit_test.cpp" ]
131  deps = [
132    "$av_codec_root_dir/services/dfx:av_codec_service_dfx",
133    "//third_party/curl:curl_shared",
134    "//third_party/openssl:libcrypto_shared",
135  ]
136
137  external_deps = [
138    "c_utils:utils",
139    "graphic_surface:surface",
140    "hilog:libhilog",
141    "init:libbegetutil",
142    "ipc:ipc_single",
143    "libxml2:libxml2",
144    "media_foundation:media_foundation",
145    "netmanager_base:net_conn_manager_if",
146    "safwk:system_ability_fwk",
147  ]
148}
149
150ohos_unittest("dash_media_downloader_unit_test") {
151  module_out_path = module_output_path
152  testonly = true
153  configs = [
154    ":dash_unittest_cfg",
155    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
156  ]
157  sources = dash_test_sources + [ "dash_media_downloader_unit_test.cpp" ]
158  deps = [
159    "$av_codec_root_dir/services/dfx:av_codec_service_dfx",
160    "//third_party/curl:curl_shared",
161    "//third_party/openssl:libcrypto_shared",
162  ]
163
164  external_deps = [
165    "c_utils:utils",
166    "graphic_surface:surface",
167    "hilog:libhilog",
168    "init:libbegetutil",
169    "ipc:ipc_single",
170    "libxml2:libxml2",
171    "media_foundation:media_foundation",
172    "netmanager_base:net_conn_manager_if",
173    "safwk:system_ability_fwk",
174  ]
175
176  resource_config_file =
177      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
178}
179
180ohos_unittest("dash_mpd_downloader_unit_test") {
181  module_out_path = module_output_path
182  testonly = true
183  configs = [
184    ":dash_unittest_cfg",
185    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
186  ]
187  sources = dash_test_sources + [ "dash_mpd_downloader_unit_test.cpp" ]
188  deps = [
189    "$av_codec_root_dir/services/dfx:av_codec_service_dfx",
190    "//third_party/curl:curl_shared",
191    "//third_party/openssl:libcrypto_shared",
192  ]
193
194  external_deps = [
195    "c_utils:utils",
196    "graphic_surface:surface",
197    "hilog:libhilog",
198    "init:libbegetutil",
199    "ipc:ipc_single",
200    "libxml2:libxml2",
201    "media_foundation:media_foundation",
202    "netmanager_base:net_conn_manager_if",
203    "safwk:system_ability_fwk",
204  ]
205
206  resource_config_file =
207      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
208}
209
210ohos_unittest("dash_segment_downloader_unit_test") {
211  module_out_path = module_output_path
212  testonly = true
213  configs = [
214    ":dash_unittest_cfg",
215    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
216  ]
217  sources = dash_test_sources + [ "dash_segment_downloader_unit_test.cpp" ]
218  deps = [
219    "$av_codec_root_dir/services/dfx:av_codec_service_dfx",
220    "//third_party/curl:curl_shared",
221    "//third_party/openssl:libcrypto_shared",
222  ]
223
224  external_deps = [
225    "c_utils:utils",
226    "graphic_surface:surface",
227    "hilog:libhilog",
228    "init:libbegetutil",
229    "ipc:ipc_single",
230    "libxml2:libxml2",
231    "media_foundation:media_foundation",
232    "netmanager_base:net_conn_manager_if",
233    "safwk:system_ability_fwk",
234  ]
235
236  resource_config_file =
237      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
238}
239