1# Copyright (c) 2021 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/aafwk/standard/aafwk.gni") 16 17module_output_path = "aafwk_standard/tools" 18 19config("tools_aa_config_mock") { 20 include_dirs = [ 21 "${aafwk_path}/tools/test/mock", 22 "//third_party/googletest/googlemock/include", 23 ] 24} 25 26tools_aa_mock_sources = 27 [ "${aafwk_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 "${aafwk_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 "appexecfwk_standard:appexecfwk_base", 50 "hiviewdfx_hilog_native:libhilog", 51 "ipc:ipc_core", 52 ] 53} 54 55ohos_unittest("aa_command_start_test") { 56 module_out_path = module_output_path 57 58 sources = [ "aa_command_start_test.cpp" ] 59 sources += tools_aa_mock_sources 60 61 configs = [ ":tools_aa_config_mock" ] 62 63 cflags = [] 64 if (target_cpu == "arm") { 65 cflags += [ "-DBINDER_IPC_32BIT" ] 66 } 67 68 deps = [ 69 "${aafwk_path}/tools/aa:tools_aa_source_set", 70 "//third_party/googletest:gmock_main", 71 "//third_party/googletest:gtest_main", 72 ] 73 74 external_deps = [ 75 "appexecfwk_standard:appexecfwk_base", 76 "hiviewdfx_hilog_native:libhilog", 77 "ipc:ipc_core", 78 ] 79} 80 81ohos_unittest("aa_command_stop_service_test") { 82 module_out_path = module_output_path 83 84 sources = [ "aa_command_stop_service_test.cpp" ] 85 sources += tools_aa_mock_sources 86 87 configs = [ ":tools_aa_config_mock" ] 88 89 cflags = [] 90 if (target_cpu == "arm") { 91 cflags += [ "-DBINDER_IPC_32BIT" ] 92 } 93 94 deps = [ 95 "${aafwk_path}/tools/aa:tools_aa_source_set", 96 "//third_party/googletest:gmock_main", 97 "//third_party/googletest:gtest_main", 98 ] 99 100 external_deps = [ 101 "appexecfwk_standard:appexecfwk_base", 102 "hiviewdfx_hilog_native:libhilog", 103 "ipc:ipc_core", 104 ] 105} 106 107ohos_unittest("aa_command_dump_test") { 108 module_out_path = module_output_path 109 110 sources = [ "aa_command_dump_test.cpp" ] 111 sources += tools_aa_mock_sources 112 113 configs = [ ":tools_aa_config_mock" ] 114 115 cflags = [] 116 if (target_cpu == "arm") { 117 cflags += [ "-DBINDER_IPC_32BIT" ] 118 } 119 120 deps = [ 121 "${aafwk_path}/tools/aa:tools_aa_source_set", 122 "//third_party/googletest:gmock_main", 123 "//third_party/googletest:gtest_main", 124 ] 125 126 external_deps = [ 127 "appexecfwk_standard:appexecfwk_base", 128 "hiviewdfx_hilog_native:libhilog", 129 "ipc:ipc_core", 130 ] 131} 132 133ohos_unittest("aa_command_screen_test") { 134 module_out_path = module_output_path 135 136 sources = [ "aa_command_screen_test.cpp" ] 137 sources += tools_aa_mock_sources 138 139 configs = [ ":tools_aa_config_mock" ] 140 141 cflags = [] 142 if (target_cpu == "arm") { 143 cflags += [ "-DBINDER_IPC_32BIT" ] 144 } 145 146 deps = [ 147 "${aafwk_path}/tools/aa:tools_aa_source_set", 148 "//third_party/googletest:gmock_main", 149 "//third_party/googletest:gtest_main", 150 ] 151 152 external_deps = [ 153 "appexecfwk_standard:appexecfwk_base", 154 "hiviewdfx_hilog_native:libhilog", 155 "ipc:ipc_core", 156 ] 157} 158 159group("unittest") { 160 testonly = true 161 162 deps = [ 163 ":aa_command_dump_test", 164 ":aa_command_screen_test", 165 ":aa_command_start_test", 166 ":aa_command_stop_service_test", 167 ":aa_command_test", 168 ] 169} 170