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  "$av_codec_root_dir/interfaces/interfaces/inner_api/native",
22]
23
24av_codec_unittest_cflags = [
25  "-std=c++17",
26  "-fno-rtti",
27  "-fno-exceptions",
28  "-Wall",
29  "-fno-common",
30  "-fstack-protector-strong",
31  "-Wshadow",
32  "-FPIC",
33  "-FS",
34  "-O2",
35  "-D_FORTIFY_SOURCE=2",
36  "-fvisibility=hidden",
37  "-Wformat=2",
38  "-Wdate-time",
39  "-Werror",
40  "-Wextra",
41  "-Wimplicit-fallthrough",
42  "-Wsign-compare",
43  "-Wunused-parameter",
44  "-Dprivate=public",
45  "-Dprotected=public",
46]
47
48##################################################################################################################
49ohos_unittest("audio_capture_module_unit_test") {
50  sanitize = av_codec_test_sanitize
51  module_out_path = module_output_path
52  include_dirs = av_codec_unittest_include_dirs
53  include_dirs += [
54    "./",
55    "$av_codec_root_dir/interfaces/kits/c",
56    "$av_codec_root_dir/services/engine/common/include",
57    "$av_codec_root_dir/services/engine/base/include",
58    "$av_codec_root_dir/services/utils/include",
59    "$av_codec_root_dir/services/engine/codec/include/audio",
60    "$av_codec_root_dir/services/engine/factory",
61    "$av_codec_root_dir/services/media_engine/modules/source/audio_capture",
62  ]
63
64  cflags = av_codec_unittest_cflags
65
66  cflags_cc = cflags
67
68  public_configs = []
69
70  if (av_codec_support_test) {
71    sources = [ "./audio_capture_module_unit_test.cpp" ]
72  }
73
74  deps = [
75    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
76    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
77    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
78    "$av_codec_root_dir/services/media_engine/modules:av_codec_media_engine_modules",
79    "$av_codec_root_dir/services/services:av_codec_service",
80    "$av_codec_root_dir/services/utils:av_codec_service_utils",
81  ]
82
83  public_configs = [ "$audio_framework_root_dir/frameworks/native/audiocapturer:audio_capturer_config" ]
84
85  external_deps = [
86    "ability_base:base",
87    "ability_base:want",
88    "ability_base:zuri",
89    "ability_runtime:ability_context_native",
90    "ability_runtime:ability_manager",
91    "ability_runtime:abilitykit_native",
92    "ability_runtime:app_context",
93    "ability_runtime:data_ability_helper",
94    "access_token:libaccesstoken_sdk",
95    "access_token:libnativetoken",
96    "access_token:libtoken_setproc",
97    "audio_framework:audio_capturer",
98    "ffmpeg:libohosffmpeg",
99    "graphic_surface:surface",
100    "media_foundation:native_media_core",
101  ]
102
103  resource_config_file =
104      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
105}
106