• 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"
18
19hls_test_sources = [
20  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/base64/base64_utils.cpp",
21  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/app_client.cpp",
22  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/downloader.cpp",
23  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/media_source_loading_request.cpp",
24  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/download/network_client/http_curl_client.cpp",
25  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_media_downloader.cpp",
26  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_playlist_downloader.cpp",
27  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/hls_tags.cpp",
28  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/m3u8.cpp",
29  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/hls/playlist_downloader.cpp",
30  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/http/http_media_downloader.cpp",
31  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/http_source_plugin.cpp",
32  "$av_codec_root_dir/services/media_engine/plugins/source/http_source/utils/media_cached_buffer.cpp",
33  "$av_codec_root_dir/test/unittest/common/http_server_demo.cpp",
34]
35
36config("hls_unittest_cfg") {
37  defines = [
38    "HST_ANY_WITH_NO_RTTI",
39    "MEDIA_OHOS",
40    "TESTING",
41  ]
42
43  cflags = [
44    "-Wno-sign-compare",
45    "-fno-exceptions",
46    "-fno-common",
47    "-fstack-protector-all",
48    "-Wshadow",
49    "-FPIC",
50    "-FS",
51    "-O2",
52    "-D_FORTIFY_SOURCE=2",
53    "-Wformat=2",
54    "-Wdate-time",
55    "-Dprivate=public",
56    "-Dprotected=public",
57  ]
58
59  cflags_cc = [
60    "-std=c++17",
61    "-fno-rtti",
62    "-Dprivate=public",
63    "-Dprotected=public",
64  ]
65
66  include_dirs = [
67    "$av_codec_root_dir/interfaces",
68    "$av_codec_root_dir/interfaces/inner_api/native",
69    "$av_codec_root_dir/services/media_engine/plugins/source/http_source",
70    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/base64",
71    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/xml",
72    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash",
73    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/include",
74    "$av_codec_root_dir/services/media_engine/plugins/source/http_source/dash/include/mpd_parser",
75    "$media_foundation_root_dir/src",
76    "$av_codec_root_dir/test/unittest/common",
77    "//third_party/curl/include",
78    "$av_codec_root_dir/services/drm_decryptor",
79    "$av_codec_root_dir/services/media_engine/modules",
80    "$media_foundation_root_dir/interface/inner_api",
81    "//commonlibrary/c_utils/base/include/",
82    "//third_party/ffmpeg",
83  ]
84}
85
86ohos_unittest("hls_media_downloader_unit_test") {
87  sanitize = av_codec_test_sanitize
88  module_out_path = module_output_path
89  testonly = true
90  configs = [
91    ":hls_unittest_cfg",
92    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
93  ]
94  sources = hls_test_sources + [ "hls_media_downloader_unit_test.cpp" ]
95  deps = [
96    "$av_codec_root_dir/services/dfx:av_codec_service_dfx",
97    "//third_party/curl:curl_shared",
98    "//third_party/openssl:libcrypto_shared",
99  ]
100
101  external_deps = [
102    "c_utils:utils",
103    "graphic_surface:surface",
104    "hilog:libhilog",
105    "init:libbegetutil",
106    "ipc:ipc_single",
107    "media_foundation:media_foundation",
108    "netmanager_base:net_conn_manager_if",
109    "safwk:system_ability_fwk",
110  ]
111  resource_config_file =
112      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
113}
114
115ohos_unittest("hls_playlist_downloader_unit_test") {
116  sanitize = av_codec_test_sanitize
117  module_out_path = module_output_path
118  testonly = true
119  configs = [
120    ":hls_unittest_cfg",
121    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
122  ]
123  sources = hls_test_sources + [ "hls_playlist_downloader_unit_test.cpp" ]
124  deps = [
125    "$av_codec_root_dir/services/dfx:av_codec_service_dfx",
126    "//third_party/curl:curl_shared",
127    "//third_party/openssl:libcrypto_shared",
128  ]
129
130  external_deps = [
131    "c_utils:utils",
132    "graphic_surface:surface",
133    "hilog:libhilog",
134    "init:libbegetutil",
135    "ipc:ipc_single",
136    "media_foundation:media_foundation",
137    "netmanager_base:net_conn_manager_if",
138    "safwk:system_ability_fwk",
139  ]
140  resource_config_file =
141      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
142}
143
144ohos_unittest("hls_tags_unit_test") {
145  sanitize = av_codec_test_sanitize
146  module_out_path = module_output_path
147  testonly = true
148  configs = [
149    ":hls_unittest_cfg",
150    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
151  ]
152  sources = hls_test_sources + [ "hls_tags_unit_test.cpp" ]
153  deps = [
154    "$av_codec_root_dir/services/dfx:av_codec_service_dfx",
155    "//third_party/curl:curl_shared",
156    "//third_party/openssl:libcrypto_shared",
157  ]
158
159  external_deps = [
160    "c_utils:utils",
161    "graphic_surface:surface",
162    "hilog:libhilog",
163    "init:libbegetutil",
164    "ipc:ipc_single",
165    "media_foundation:media_foundation",
166    "netmanager_base:net_conn_manager_if",
167    "safwk:system_ability_fwk",
168  ]
169  resource_config_file =
170      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
171}
172
173ohos_unittest("m3u8_unit_test") {
174  sanitize = av_codec_test_sanitize
175  module_out_path = module_output_path
176  testonly = true
177  configs = [
178    ":hls_unittest_cfg",
179    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
180  ]
181  sources = hls_test_sources + [ "m3u8_unit_test.cpp" ]
182  deps = [
183    "$av_codec_root_dir/services/dfx:av_codec_service_dfx",
184    "//third_party/curl:curl_shared",
185    "//third_party/openssl:libcrypto_shared",
186  ]
187
188  external_deps = [
189    "c_utils:utils",
190    "graphic_surface:surface",
191    "hilog:libhilog",
192    "init:libbegetutil",
193    "ipc:ipc_single",
194    "media_foundation:media_foundation",
195    "netmanager_base:net_conn_manager_if",
196    "safwk:system_ability_fwk",
197  ]
198  resource_config_file =
199      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
200}
201