• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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/storage_service/storage_service_aafwk.gni")
16
17ROOT_DIR = "${storage_daemon_path}"
18
19ohos_unittest("storage_daemon_test") {
20  module_out_path = "storage_service/storage_daemon"
21
22  defines = [
23    "STORAGE_LOG_TAG = \"StorageDaemon\"",
24    "LOG_DOMAIN = 0xD004301",
25  ]
26
27  if (storage_service_user_crypto_manager) {
28    defines += [ "USER_CRYPTO_MANAGER" ]
29  }
30
31  if (storage_service_external_storage_manager) {
32    defines += [ "EXTERNAL_STORAGE_MANAGER" ]
33  }
34
35  cflags_cc = [ "-Wno-unused-const-variable" ]
36
37  include_dirs = [
38    "$ROOT_DIR/include",
39    "$ROOT_DIR/utils",
40    "$ROOT_DIR/../storage_manager/include",
41    "${storage_interface_path}/innerkits/storage_manager/native",
42    "${storage_service_common_path}/include",
43  ]
44
45  sources = [
46    "$ROOT_DIR/crypto/test/key_manager_mock.cpp",
47    "$ROOT_DIR/disk/src/disk_config.cpp",
48    "$ROOT_DIR/disk/src/disk_info.cpp",
49    "$ROOT_DIR/disk/src/disk_manager.cpp",
50    "$ROOT_DIR/ipc/src/storage_daemon.cpp",
51    "$ROOT_DIR/ipc/src/storage_daemon_stub.cpp",
52    "$ROOT_DIR/ipc/src/storage_manager_client.cpp",
53    "$ROOT_DIR/ipc/test/storage_daemon_test.cpp",
54    "$ROOT_DIR/quota/quota_manager.cpp",
55    "$ROOT_DIR/user/src/mount_manager.cpp",
56    "$ROOT_DIR/user/src/user_manager.cpp",
57    "$ROOT_DIR/utils/test/common/help_utils.cpp",
58    "$ROOT_DIR/volume/src/external_volume_info.cpp",
59    "$ROOT_DIR/volume/src/process.cpp",
60    "$ROOT_DIR/volume/src/volume_info.cpp",
61    "$ROOT_DIR/volume/src/volume_manager.cpp",
62  ]
63
64  deps = [
65    "${storage_daemon_path}:storage_common_utils",
66    "//third_party/googletest:gtest_main",
67  ]
68
69  external_deps = [
70    "ability_base:base",
71    "ability_base:want",
72    "ability_base:zuri",
73    "access_token:libaccesstoken_sdk",
74    "app_file_service:fileshare_native",
75    "bundle_framework:appexecfwk_core",
76    "c_utils:utils",
77    "dfs_service:cloud_daemon_kit_inner",
78    "hilog:libhilog",
79    "huks:libhukssdk",
80    "init:libbegetutil",
81    "ipc:ipc_core",
82    "ipc:libdbinder",
83    "safwk:system_ability_fwk",
84    "samgr:samgr_proxy",
85  ]
86
87  use_exceptions = true
88}
89
90ohos_unittest("storage_daemon_proxy_test") {
91  module_out_path = "storage_service/storage_daemon"
92
93  defines = [
94    "STORAGE_LOG_TAG = \"StorageDaemon\"",
95    "LOG_DOMAIN = 0xD004301",
96  ]
97
98  include_dirs = [
99    "$ROOT_DIR/include",
100    "${storage_service_common_path}/include",
101  ]
102
103  sources = [
104    "$ROOT_DIR/ipc/src/storage_daemon_proxy.cpp",
105    "$ROOT_DIR/ipc/test/storage_daemon_proxy_test.cpp",
106  ]
107
108  deps = [
109    "//third_party/googletest:gmock_main",
110    "//third_party/googletest:gtest_main",
111  ]
112
113  external_deps = [
114    "c_utils:utils",
115    "hilog:libhilog",
116    "ipc:ipc_core",
117    "ipc:libdbinder",
118    "safwk:system_ability_fwk",
119    "samgr:samgr_proxy",
120  ]
121}
122
123ohos_unittest("storage_daemon_stub_test") {
124  module_out_path = "storage_service/storage_daemon"
125
126  defines = [
127    "STORAGE_LOG_TAG = \"StorageDaemon\"",
128    "LOG_DOMAIN = 0xD004301",
129  ]
130
131  if (storage_service_user_crypto_manager) {
132    defines += [ "USER_CRYPTO_MANAGER" ]
133  }
134
135  include_dirs = [
136    "$ROOT_DIR/include",
137    "$ROOT_DIR/ipc/test/",
138    "${storage_service_common_path}/include",
139  ]
140
141  sources = [
142    "$ROOT_DIR/ipc/src/storage_daemon_proxy.cpp",
143    "$ROOT_DIR/ipc/src/storage_daemon_stub.cpp",
144    "$ROOT_DIR/ipc/test/storage_daemon_stub_test.cpp",
145    "$ROOT_DIR/user/src/user_manager.cpp",
146    "$ROOT_DIR/utils/mount_argument_utils.cpp",
147  ]
148
149  deps = [
150    "${storage_daemon_path}:storage_common_utils",
151    "//third_party/googletest:gmock_main",
152    "//third_party/googletest:gtest_main",
153  ]
154
155  external_deps = [
156    "access_token:libaccesstoken_sdk",
157    "bundle_framework:appexecfwk_core",
158    "c_utils:utils",
159    "hilog:libhilog",
160    "huks:libhukssdk",
161    "init:libbegetutil",
162    "ipc:ipc_core",
163    "ipc:libdbinder",
164    "safwk:system_ability_fwk",
165    "samgr:samgr_proxy",
166  ]
167}
168
169group("storage_daemon_ipc_test") {
170  testonly = true
171  deps = [
172    ":storage_daemon_proxy_test",
173    ":storage_daemon_stub_test",
174    ":storage_daemon_test",
175  ]
176}
177