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
19av_codec_unittest_include_dirs =
20    [ "$av_codec_root_dir/interfaces/inner_api/native" ]
21
22av_audio_sink_unittest_cflags = [
23  "-O2",
24  "-fPIC",
25  "-Wall",
26  "-fexceptions",
27  "-fno-rtti",
28  "-Wno-unused-but-set-variable",
29  "-Wno-format",
30  "-Dprivate=public",
31  "-Dprtected=public",
32]
33
34##################################################################################################################
35ohos_unittest("av_audio_sink_unit_test") {
36  sanitize = av_codec_test_sanitize
37  module_out_path = module_output_path
38  include_dirs = av_codec_unittest_include_dirs
39  include_dirs += [
40    "$audio_framework_root_dir/interfaces/inner_api/native/audiocommon/include",
41    "$av_codec_root_dir/interfaces",
42    "$av_codec_root_dir/interfaces/plugin",
43    "$av_codec_root_dir/services/media_engine/plugins/sink",
44    "$av_codec_root_dir/services/media_engine/modules",
45    "$av_codec_root_dir/services/media_engine/modules/sink",
46    "$av_codec_root_dir/services/media_engine/plugins/ffmpeg_adapter/common",
47    "$av_codec_root_dir/test/unittest/media_sink_test/mock/include",
48    "$media_foundation_root_dir/../../graphic/graphic_surface/interfaces/innerkits/surface",
49    "$media_foundation_root_dir/../../graphic/graphic_surface/interface/inner_api/surface",
50    "$media_foundation_root_dir/../../graphic/graphic_surface/surface/include",
51  ]
52
53  cflags = av_audio_sink_unittest_cflags
54
55  cflags_cc = cflags
56
57  public_configs = []
58
59  if (av_codec_support_test) {
60    public_external_deps = [ "ffmpeg:libohosffmpeg" ]
61
62    sources = [
63      "./audio_server_sink_plugin_test.cpp",
64      "./audio_sink_test.cpp",
65      "./mock/src/media_sync_center_mock.cpp",
66      "./subtitle_sink_test.cpp",
67      "./sync_manager_test.cpp",
68      "./video_sink_test.cpp",
69    ]
70
71    sources += [
72      "$av_codec_root_dir/services/media_engine/plugins/ffmpeg_adapter/common/ffmpeg_convert.cpp",
73      "$av_codec_root_dir/services/media_engine/plugins/ffmpeg_adapter/common/ffmpeg_utils.cpp",
74      "$av_codec_root_dir/services/media_engine/plugins/sink/audio_server_sink_plugin.cpp",
75    ]
76  }
77
78  configs = [
79    "$av_codec_root_dir/services/media_engine/plugins/sink:audio_server_sink_plugin_config",
80    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
81  ]
82
83  deps = [
84    "$av_codec_root_dir/services/dfx:av_codec_service_dfx",
85    "$av_codec_root_dir/services/media_engine/modules:av_codec_media_engine_modules",
86  ]
87
88  external_deps = [
89    "audio_framework:audio_renderer",
90    "c_utils:utils",
91    "graphic_surface:surface",
92    "hilog:libhilog",
93    "init:libbegetutil",
94    "ipc:ipc_single",
95    "media_foundation:media_foundation",
96    "safwk:system_ability_fwk",
97  ]
98
99  resource_config_file =
100      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
101}
102