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/filemanagement/dfs_service/distributedfile.gni")
16
17ohos_unittest("dfsu_fd_guard_test") {
18  module_out_path = "filemanagement/dfs_service"
19
20  sources = [
21    "${utils_path}/system/src/dfsu_fd_guard.cpp",
22    "dfsu_fd_guard_test.cpp",
23  ]
24
25  include_dirs = [
26    "${utils_path}/system/include",
27    "${utils_path}/log/include",
28    "//foundation/multimedia/image_framework/mock/native/include/log/",
29  ]
30
31  deps = [
32    "${utils_path}:libdistributedfiledentry",
33    "${utils_path}:libdistributedfileutils",
34    "//third_party/googletest:gmock_main",
35    "//third_party/googletest:gtest_main",
36  ]
37
38  external_deps = [
39    "c_utils:utils",
40    "hilog:libhilog",
41  ]
42
43  defines = [ "private=public" ]
44  defines += [
45    "LOG_DOMAIN=0xD004307",
46    "LOG_TAG=\"CLOUDSYNC_SA\"",
47  ]
48  use_exceptions = true
49}
50
51ohos_unittest("dfsu_access_token_helper_test") {
52  module_out_path = "filemanagement/dfs_service"
53
54  sources = [
55    "${utils_path}/system/src/dfsu_access_token_helper.cpp",
56    "dfsu_access_token_helper_test.cpp",
57    "reimplement/accesstoken_kit.cpp",
58    "reimplement/accesstoken_kit_mock.cpp",
59    "reimplement/ipc_skeleton.cpp",
60  ]
61
62  include_dirs = [
63    "${distributedfile_path}/test/unittests/cloudsync_sa/system/reimplement",
64    "${communication_ipc_path}/ipc/ipc/native/c/adapter/access_token/include",
65    "${communication_ipc_path}/ipc/ipc/native/src/core/include",
66    "${communication_ipc_path}/ipc/utils/include",
67    "${image_framework_path}/interfaces/innerkits/include",
68    "${image_framework_path}/mock/native/include/log/",
69    "${utils_path}/system/include",
70    "${utils_path}/log/include",
71  ]
72
73  deps = [
74    "${utils_path}:libdistributedfiledentry",
75    "${utils_path}:libdistributedfileutils",
76    "//third_party/googletest:gmock_main",
77    "//third_party/googletest:gtest_main",
78  ]
79
80  external_deps = [
81    "ability_base:want",
82    "ability_base:zuri",
83    "ability_runtime:uri_permission_mgr",
84    "access_token:libaccesstoken_sdk",
85    "access_token:libtokenid_sdk",
86    "c_utils:utils",
87    "hilog:libhilog",
88    "hisysevent:libhisysevent",
89    "ipc:ipc_core",
90    "preferences:native_preferences",
91  ]
92
93  defines = [ "private=public" ]
94  defines += [
95    "LOG_DOMAIN=0xD004307",
96    "LOG_TAG=\"CLOUDSYNC_SA\"",
97  ]
98  use_exceptions = true
99}
100
101ohos_unittest("dfsu_mount_argument_descriptors_test") {
102  module_out_path = "filemanagement/dfs_service"
103
104  sources = [
105    "${utils_path}/system/src/dfsu_mount_argument_descriptors.cpp",
106    "dfsu_mount_argument_descriptors_test.cpp",
107  ]
108
109  include_dirs = [
110    "${utils_path}/system/include",
111    "${utils_path}/log/include",
112    "//foundation/multimedia/image_framework/mock/native/include/log/",
113  ]
114
115  deps = [
116    "${utils_path}:libdistributedfiledentry",
117    "${utils_path}:libdistributedfileutils",
118    "//third_party/googletest:gmock_main",
119    "//third_party/googletest:gtest_main",
120  ]
121
122  external_deps = [
123    "c_utils:utils",
124    "hilog:libhilog",
125  ]
126
127  defines = [ "private=public" ]
128  defines += [
129    "LOG_DOMAIN=0xD004307",
130    "LOG_TAG=\"CLOUDSYNC_SA\"",
131  ]
132  use_exceptions = true
133}
134group("utils_system_src_test") {
135  testonly = true
136  deps = [
137    ":dfsu_access_token_helper_test",
138    ":dfsu_fd_guard_test",
139    ":dfsu_mount_argument_descriptors_test",
140  ]
141}
142