1# Copyright (c) 2022-2025 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/ability/ability_runtime/ability_runtime.gni") 16 17module_output_path = "ability_runtime/ability_runtime/tools" 18 19ability_delegator_mock_sources = 20 [ "${ability_runtime_path}/tools/test/mock/mock_ability_manager_stub.cpp" ] 21 22config("tools_ability_delegator_config") { 23 include_dirs = [ 24 "${ability_runtime_path}/tools/test/mock", 25 "${ability_runtime_path}/tools/aa/include", 26 ] 27} 28 29ohos_unittest("ability_command_test") { 30 module_out_path = module_output_path 31 32 configs = [ ":tools_ability_delegator_config" ] 33 34 sources = [ "ability_command_test.cpp" ] 35 sources += ability_delegator_mock_sources 36 37 deps = [ 38 "${ability_runtime_path}/tools/aa:tools_aa_source_set", 39 "${ability_runtime_services_path}/abilitymgr:abilityms", 40 ] 41 42 external_deps = [ 43 "ability_base:configuration", 44 "bundle_framework:appexecfwk_base", 45 "googletest:gmock_main", 46 "googletest:gtest_main", 47 "hilog:libhilog", 48 "ipc:ipc_core", 49 ] 50} 51 52ohos_unittest("ability_command_second_test") { 53 module_out_path = module_output_path 54 55 configs = [ ":tools_ability_delegator_config" ] 56 57 sources = [ "ability_command_second_test.cpp" ] 58 sources += ability_delegator_mock_sources 59 60 cflags = [ 61 "-Dprivate=public", 62 "-Dprotected=public", 63 ] 64 65 deps = [ 66 "${ability_runtime_path}/tools/aa:tools_aa_source_set", 67 "${ability_runtime_services_path}/abilitymgr:abilityms", 68 ] 69 70 external_deps = [ 71 "ability_base:configuration", 72 "bundle_framework:appexecfwk_base", 73 "googletest:gmock_main", 74 "googletest:gtest_main", 75 "hilog:libhilog", 76 "ipc:ipc_core", 77 ] 78} 79 80ohos_unittest("ability_command_third_test") { 81 module_out_path = module_output_path 82 83 configs = [ ":tools_ability_delegator_config" ] 84 85 sources = [ "ability_command_third_test.cpp" ] 86 sources += ability_delegator_mock_sources 87 88 cflags = [ 89 "-Dprivate=public", 90 "-Dprotected=public", 91 ] 92 93 deps = [ 94 "${ability_runtime_path}/tools/aa:tools_aa_source_set", 95 "${ability_runtime_services_path}/abilitymgr:abilityms", 96 ] 97 98 external_deps = [ 99 "ability_base:configuration", 100 "bundle_framework:appexecfwk_base", 101 "googletest:gmock_main", 102 "googletest:gtest_main", 103 "hilog:libhilog", 104 "ipc:ipc_core", 105 ] 106} 107 108ohos_unittest("test_observer_test") { 109 module_out_path = module_output_path 110 111 configs = [ ":tools_ability_delegator_config" ] 112 113 sources = [ "test_observer_test.cpp" ] 114 sources += ability_delegator_mock_sources 115 116 deps = [ 117 "${ability_runtime_path}/tools/aa:tools_aa_source_set", 118 "${ability_runtime_services_path}/abilitymgr:abilityms", 119 ] 120 121 external_deps = [ 122 "ability_base:configuration", 123 "bundle_framework:appexecfwk_base", 124 "googletest:gmock_main", 125 "googletest:gtest_main", 126 "hilog:libhilog", 127 "ipc:ipc_core", 128 ] 129} 130 131ohos_unittest("test_observer_proxy_test") { 132 module_out_path = module_output_path 133 134 sources = [ "test_observer_proxy_test.cpp" ] 135 136 deps = [ "${ability_runtime_path}/tools/aa:tools_aa_source_set" ] 137 138 external_deps = [ 139 "googletest:gmock_main", 140 "googletest:gtest_main", 141 "hilog:libhilog", 142 "ipc:ipc_core", 143 ] 144} 145 146ohos_unittest("test_observer_stub_test") { 147 module_out_path = module_output_path 148 149 sources = [ 150 "mock_test_observer_stub.cpp", 151 "test_observer_stub_test.cpp", 152 ] 153 154 deps = [ "${ability_runtime_path}/tools/aa:tools_aa_source_set" ] 155 156 external_deps = [ 157 "googletest:gmock_main", 158 "googletest:gtest_main", 159 "hilog:libhilog", 160 "ipc:ipc_core", 161 ] 162} 163 164ohos_unittest("shell_command_result_test") { 165 module_out_path = module_output_path 166 167 sources = [ "shell_command_result_test.cpp" ] 168 169 configs = [ ":tools_ability_delegator_config" ] 170 171 deps = [ "${ability_runtime_path}/tools/aa:tools_aa_source_set" ] 172 173 external_deps = [ 174 "ability_base:configuration", 175 "bundle_framework:appexecfwk_base", 176 "googletest:gmock_main", 177 "googletest:gtest_main", 178 "hilog:libhilog", 179 "ipc:ipc_core", 180 ] 181} 182 183group("unittest") { 184 testonly = true 185 186 deps = [ 187 ":ability_command_second_test", 188 ":ability_command_test", 189 ":ability_command_third_test", 190 ":shell_command_result_test", 191 ":test_observer_proxy_test", 192 ":test_observer_stub_test", 193 ":test_observer_test", 194 ] 195} 196