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 = "filemanagement/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 "c_utils:utils", 76 "dfs_service:cloud_daemon_kit_inner", 77 "hilog:libhilog", 78 "huks:libhukssdk", 79 "init:libbegetutil", 80 "ipc:ipc_core", 81 "ipc:libdbinder", 82 "safwk:system_ability_fwk", 83 "samgr:samgr_proxy", 84 ] 85} 86 87ohos_unittest("storage_daemon_proxy_test") { 88 module_out_path = "filemanagement/storage_service/storage_daemon" 89 90 defines = [ 91 "STORAGE_LOG_TAG = \"StorageDaemon\"", 92 "LOG_DOMAIN = 0xD004301", 93 ] 94 95 include_dirs = [ 96 "$ROOT_DIR/include", 97 "${storage_service_common_path}/include", 98 ] 99 100 sources = [ 101 "$ROOT_DIR/ipc/src/storage_daemon_proxy.cpp", 102 "$ROOT_DIR/ipc/test/storage_daemon_proxy_test.cpp", 103 ] 104 105 deps = [ 106 "//third_party/googletest:gmock_main", 107 "//third_party/googletest:gtest_main", 108 ] 109 110 external_deps = [ 111 "c_utils:utils", 112 "hilog:libhilog", 113 "ipc:ipc_core", 114 "ipc:libdbinder", 115 "safwk:system_ability_fwk", 116 "samgr:samgr_proxy", 117 ] 118} 119 120ohos_unittest("storage_daemon_stub_test") { 121 module_out_path = "filemanagement/storage_service/storage_daemon" 122 123 defines = [ 124 "STORAGE_LOG_TAG = \"StorageDaemon\"", 125 "LOG_DOMAIN = 0xD004301", 126 ] 127 128 if (storage_service_user_crypto_manager) { 129 defines += [ "USER_CRYPTO_MANAGER" ] 130 } 131 132 include_dirs = [ 133 "$ROOT_DIR/include", 134 "$ROOT_DIR/ipc/test/", 135 "${storage_service_common_path}/include", 136 ] 137 138 sources = [ 139 "$ROOT_DIR/ipc/src/storage_daemon_proxy.cpp", 140 "$ROOT_DIR/ipc/src/storage_daemon_stub.cpp", 141 "$ROOT_DIR/ipc/test/storage_daemon_stub_test.cpp", 142 "$ROOT_DIR/user/src/user_manager.cpp", 143 "$ROOT_DIR/utils/mount_argument_utils.cpp", 144 ] 145 146 deps = [ 147 "${storage_daemon_path}:storage_common_utils", 148 "//third_party/googletest:gmock_main", 149 "//third_party/googletest:gtest_main", 150 ] 151 152 external_deps = [ 153 "access_token:libaccesstoken_sdk", 154 "c_utils:utils", 155 "hilog:libhilog", 156 "huks:libhukssdk", 157 "init:libbegetutil", 158 "ipc:ipc_core", 159 "ipc:libdbinder", 160 "safwk:system_ability_fwk", 161 "samgr:samgr_proxy", 162 ] 163} 164 165group("storage_daemon_ipc_test") { 166 testonly = true 167 deps = [ 168 ":storage_daemon_proxy_test", 169 ":storage_daemon_stub_test", 170 ":storage_daemon_test", 171 ] 172} 173