1# Copyright (c) 2022-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/user_file_service/filemanagement_aafwk.gni") 16 17ohos_unittest("medialibrary_file_access_test") { 18 module_out_path = "filemanagement/user_file_service" 19 20 sources = [ "medialibrary_file_access_test.cpp" ] 21 22 include_dirs = [ 23 "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", 24 "${user_file_service_path}/interfaces/inner_api/file_access/include", 25 "//third_party/googletest/googlemock/include/gmock", 26 "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx/", 27 ] 28 29 configs = [ "//build/config/compiler:exceptions" ] 30 31 deps = [ 32 "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", 33 "${ability_runtime_path}/frameworks/native/appkit:app_context", 34 "${user_file_service_path}/interfaces/inner_api/file_access:file_access_extension_ability_kit", 35 "//third_party/googletest:gmock_main", 36 ] 37 38 external_deps = [ 39 "ability_base:want", 40 "ability_base:zuri", 41 "ability_runtime:ability_context_native", 42 "ability_runtime:ability_manager", 43 "ability_runtime:app_manager", 44 "ability_runtime:runtime", 45 "ability_runtime:wantagent_innerkits", 46 "access_token:libaccesstoken_sdk", 47 "access_token:libnativetoken", 48 "access_token:libtoken_setproc", 49 "c_utils:utils", 50 "image_framework:image_native", 51 "ipc:ipc_core", 52 "ipc_js:rpc", 53 "samgr:samgr_proxy", 54 ] 55 56 resource_config_file = 57 "${user_file_service_path}/test/unittest/resources/ohos_test.xml" 58} 59 60ohos_unittest("external_file_access_test") { 61 module_out_path = "filemanagement/user_file_service" 62 63 sources = [ 64 "external_file_access_test.cpp", 65 "external_notify_test.cpp", 66 ] 67 68 include_dirs = [ 69 "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", 70 "//third_party/googletest/googlemock/include/gmock", 71 "${user_file_service_path}/interfaces/inner_api/file_access/include", 72 "${user_file_service_path}/services/native/file_access_service/include", 73 ] 74 75 configs = [ "//build/config/compiler:exceptions" ] 76 77 deps = [ 78 "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", 79 "${ability_runtime_path}/frameworks/native/appkit:app_context", 80 "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx", 81 "${user_file_service_path}/interfaces/inner_api/file_access:file_access_extension_ability_kit", 82 "${user_file_service_path}/services:file_access_service", 83 "//third_party/googletest:gmock_main", 84 ] 85 86 external_deps = [ 87 "ability_base:want", 88 "ability_base:zuri", 89 "ability_runtime:ability_context_native", 90 "ability_runtime:ability_manager", 91 "ability_runtime:app_manager", 92 "ability_runtime:runtime", 93 "ability_runtime:wantagent_innerkits", 94 "access_token:libaccesstoken_sdk", 95 "access_token:libnativetoken", 96 "access_token:libtoken_setproc", 97 "c_utils:utils", 98 "hilog:libhilog", 99 "ipc:ipc_core", 100 "ipc_js:rpc", 101 "samgr:samgr_proxy", 102 ] 103} 104 105ohos_unittest("abnormal_file_access_test") { 106 module_out_path = "filemanagement/user_file_service" 107 108 sources = [ "abnormal_file_access_test.cpp" ] 109 110 include_dirs = [ 111 "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", 112 "//third_party/googletest/googlemock/include/gmock", 113 "${user_file_service_path}/interfaces/inner_api/file_access/include", 114 ] 115 116 configs = [ "//build/config/compiler:exceptions" ] 117 118 deps = [ 119 "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", 120 "${ability_runtime_path}/frameworks/native/appkit:app_context", 121 "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx", 122 "${user_file_service_path}/interfaces/inner_api/file_access:file_access_extension_ability_kit", 123 "//third_party/googletest:gmock_main", 124 ] 125 126 external_deps = [ 127 "ability_base:want", 128 "ability_base:zuri", 129 "ability_runtime:ability_context_native", 130 "ability_runtime:ability_manager", 131 "ability_runtime:app_manager", 132 "ability_runtime:runtime", 133 "ability_runtime:wantagent_innerkits", 134 "access_token:libaccesstoken_sdk", 135 "access_token:libnativetoken", 136 "access_token:libtoken_setproc", 137 "c_utils:utils", 138 "hilog:libhilog", 139 "ipc:ipc_core", 140 "samgr:samgr_proxy", 141 ] 142} 143 144group("user_file_service_unit_test") { 145 testonly = true 146 147 deps = [ 148 ":abnormal_file_access_test", 149 ":external_file_access_test", 150 ] 151} 152