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.
13
14import("//build/test.gni")
15import("//foundation/multimedia/ringtone_library/ringtone_library.gni")
16
17group("unittest") {
18  testonly = true
19
20  deps = [ ":ringtone_restore_unittest" ]
21}
22
23ohos_unittest("ringtone_restore_unittest") {
24  module_out_path = "ringtone_library/ringtonelibraryextention"
25
26  include_dirs = [
27    "./include",
28    "../ringtone_unittest_utils/include",
29    "${RINGTONE_RESTORE_PATH}/include",
30    "${RINGTONE_UTILS_PATH}/include",
31    "${RINGTONE_SETTING_PATH}/include",
32    "${RINGTONE_INTERFACES_PATH}/inner_api/native",
33  ]
34
35  sources = [
36    "${RINGTONE_RESTORE_PATH}/src/dualfwk_conf_loader.cpp",
37    "${RINGTONE_RESTORE_PATH}/src/dualfwk_conf_parser.cpp",
38    "${RINGTONE_RESTORE_PATH}/src/dualfwk_sound_setting.cpp",
39    "${RINGTONE_RESTORE_PATH}/src/native_module_ohos_ringtone_restore.cpp",
40    "${RINGTONE_RESTORE_PATH}/src/ringtone_dualfwk_restore.cpp",
41    "${RINGTONE_RESTORE_PATH}/src/ringtone_rdb_transaction.cpp",
42    "${RINGTONE_RESTORE_PATH}/src/ringtone_restore.cpp",
43    "${RINGTONE_RESTORE_PATH}/src/ringtone_restore_base.cpp",
44    "${RINGTONE_RESTORE_PATH}/src/ringtone_restore_db_utils.cpp",
45    "${RINGTONE_RESTORE_PATH}/src/ringtone_restore_factory.cpp",
46    "${RINGTONE_RESTORE_PATH}/src/ringtone_restore_napi.cpp",
47    "../ringtone_unittest_utils/src/ringtone_unittest_utils.cpp",
48    "./src/ringtone_restore_test.cpp",
49    "./src/ringtone_source.cpp",
50  ]
51
52  configs = [ "//build/config/compiler:exceptions" ]
53
54  deps = [
55    "${RINGTONE_ROOT_PATH}/services:ringtone_data_extension",
56    "${RINGTONE_ROOT_PATH}/services:ringtone_setting",
57    "${RINGTONE_ROOT_PATH}/services:ringtone_utils",
58    "${RINGTONE_ROOT_PATH}/services:ringtonerestore",
59  ]
60
61  external_deps = [
62    "ability_base:zuri",
63    "ability_runtime:ability_context_native",
64    "ability_runtime:ability_manager",
65    "ability_runtime:abilitykit_native",
66    "ability_runtime:app_context",
67    "ability_runtime:app_manager",
68    "ability_runtime:extensionkit_native",
69    "ability_runtime:runtime",
70    "access_token:libaccesstoken_sdk",
71    "access_token:libnativetoken",
72    "access_token:libtoken_setproc",
73    "bundle_framework:appexecfwk_core",
74    "c_utils:utils",
75    "common_event_service:cesfwk_innerkits",
76    "data_share:datashare_common",
77    "data_share:datashare_consumer",
78    "data_share:datashare_provider",
79    "init:libbegetutil",
80    "ipc:ipc_single",
81    "libxml2:libxml2",
82    "media_library:media_library",
83    "napi:ace_napi",
84    "os_account:os_account_innerkits",
85    "player_framework:media_client",
86    "preferences:native_preferences",
87    "relational_store:native_rdb",
88    "relational_store:rdb_data_share_adapter",
89    "samgr:samgr_proxy",
90  ]
91
92  sanitize = {
93    cfi = true
94    cfi_cross_dso = true
95    debug = false
96  }
97
98  resource_config_file =
99      "${RINGTONE_ROOT_PATH}/test/unittest/resources/ohos_test.xml"
100
101  if (is_standard_system) {
102    external_deps += [ "hilog:libhilog" ]
103  } else {
104    external_deps += [ "hilog:libhilog" ]
105  }
106}
107