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