1# Copyright (c) 2020-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# http://www.apache.org/licenses/LICENSE-2.0 6# Unless required by applicable law or agreed to in writing, software 7# distributed under the License is distributed on an "AS IS" BASIS, 8# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9# See the License for the specific language governing permissions and 10# limitations under the License. 11 12import("//build/test.gni") 13import("../wallpaper.gni") 14 15ohos_unittest("wallpaper_test") { 16 testonly = true 17 resource_config_file = 18 "${wallpaper_path}/test/unittest/resource/ohos_test.xml" 19 module_out_path = "wallpaper_mgr/wallpaper_mgr/wallpaper_test" 20 sources = [ "unittest/wallpaper_test.cpp" ] 21 22 sanitize = { 23 cfi = true 24 cfi_cross_dso = true 25 debug = false 26 } 27 include_dirs = [ "${wallpaper_path}/services/include" ] 28 deps = [ 29 "${utils_path}:wallpaper_utils", 30 "${wallpaper_path}/frameworks/native:wallpapermanager_static", 31 "${wallpaper_path}/services:wallpaper_service_static", 32 ] 33 external_deps = [ 34 "ability_base:want", 35 "ability_runtime:ability_manager", 36 "ability_runtime:abilitykit_native", 37 "access_token:libaccesstoken_sdk", 38 "access_token:libnativetoken", 39 "access_token:libtoken_setproc", 40 "access_token:libtokenid_sdk", 41 "c_utils:utils", 42 "common_event_service:cesfwk_innerkits", 43 "hilog:libhilog", 44 "hisysevent:libhisysevent", 45 "hitrace:hitrace_meter", 46 "image_framework:image", 47 "image_framework:image_native", 48 "ipc:ipc_single", 49 "os_account:os_account_innerkits", 50 "player_framework:media_client", 51 "safwk:system_ability_fwk", 52 "samgr:samgr_proxy", 53 "window_manager:libwm", 54 "window_manager:libwsutils", 55 ] 56} 57 58ohos_unittest("wallpaper_permission_test") { 59 testonly = true 60 resource_config_file = 61 "${wallpaper_path}/test/unittest/resource/ohos_test.xml" 62 module_out_path = "wallpaper_mgr/wallpaper_mgr/wallpaper_permission_test" 63 sources = [ "unittest/wallpaper_permission_test.cpp" ] 64 65 include_dirs = [] 66 deps = [ "${wallpaper_path}/frameworks/native:wallpapermanager_static" ] 67 external_deps = [ 68 "access_token:libtokenid_sdk", 69 "c_utils:utils", 70 "common_event_service:cesfwk_innerkits", 71 "hilog:libhilog", 72 "image_framework:image", 73 "image_framework:image_native", 74 "ipc:ipc_single", 75 "player_framework:media_client", 76 "safwk:system_ability_fwk", 77 "samgr:samgr_proxy", 78 "window_manager:libwm", 79 ] 80} 81 82ohos_unittest("wallpaper_dfx_test") { 83 testonly = true 84 module_out_path = "wallpaper_mgr/wallpaper_mgr/wallpaper_dfx_test" 85 sources = [ "unittest/wallpaper_dfx_test.cpp" ] 86 87 include_dirs = [] 88 deps = [ 89 "${utils_path}:wallpaper_utils", 90 "${wallpaper_path}/frameworks/native:wallpapermanager_static", 91 "${wallpaper_path}/services:wallpaper_service_static", 92 ] 93 external_deps = [ 94 "c_utils:utils", 95 "hilog:libhilog", 96 "hisysevent:libhisysevent", 97 "hitrace:hitrace_meter", 98 "player_framework:media_client", 99 ] 100} 101 102ohos_unittest("wallpaper_cjson_mock_test") { 103 testonly = true 104 resource_config_file = 105 "${wallpaper_path}/test/unittest/resource/ohos_test.xml" 106 module_out_path = "wallpaper_mgr/wallpaper_mgr/wallpaper_cjson_mock_test" 107 sources = [ 108 "unittest/wallpaper_cjson_mock_test.cpp", 109 "unittest/mock/wallpaper_cjson_mock.cpp" 110 ] 111 112 defines = [ 113 "private=public", 114 ] 115 116 include_dirs = [ 117 "${wallpaper_path}/services/include", 118 "${wallpaper_path}/test/unittest/mock", 119 ] 120 deps = [ 121 "${utils_path}:wallpaper_utils", 122 "${wallpaper_path}/frameworks/native:wallpapermanager_static", 123 "${wallpaper_path}/services:wallpaper_service_static", 124 ] 125 external_deps = [ 126 "ability_base:want", 127 "ability_runtime:ability_manager", 128 "ability_runtime:abilitykit_native", 129 "access_token:libaccesstoken_sdk", 130 "access_token:libnativetoken", 131 "access_token:libtoken_setproc", 132 "access_token:libtokenid_sdk", 133 "c_utils:utils", 134 "common_event_service:cesfwk_innerkits", 135 "cJSON:cjson", 136 "googletest:gmock_main", 137 "hilog:libhilog", 138 "hisysevent:libhisysevent", 139 "hitrace:hitrace_meter", 140 "image_framework:image", 141 "image_framework:image_native", 142 "ipc:ipc_single", 143 "os_account:os_account_innerkits", 144 "player_framework:media_client", 145 "safwk:system_ability_fwk", 146 "samgr:samgr_proxy", 147 "window_manager:libwm", 148 "window_manager:libwsutils", 149 ] 150} 151 152group("unittest") { 153 testonly = true 154 155 deps = [] 156 157 deps += [ 158 ":wallpaper_dfx_test", 159 ":wallpaper_permission_test", 160 ":wallpaper_test", 161 ":wallpaper_cjson_mock_test", 162 ] 163} 164