1# Copyright (c) 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_runtime/abilitymgr" 18 19config("coverage_flags") { 20 cflags = [ "--coverage" ] 21 ldflags = [ "--coverage" ] 22} 23 24ohos_unittest("quickfix_callback_test") { 25 module_out_path = module_output_path 26 27 include_dirs = [ 28 "${ability_runtime_native_path}/runtime", 29 "${ability_runtime_native_path}/runtime/utils/include", 30 ] 31 32 sources = [ "js_quickfix_callback_test.cpp" ] 33 34 configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ] 35 deps = [] 36 37 external_deps = [ 38 "ability_runtime:runtime", 39 "c_utils:utils", 40 ] 41} 42 43ohos_unittest("runtime_test") { 44 module_out_path = module_output_path 45 46 include_dirs = [ 47 "${ability_runtime_native_path}/runtime", 48 "${ability_runtime_native_path}/runtime/utils/include", 49 "${ability_base_kits_path}/extractortool/include", 50 "//third_party/zlib/contrib/minizip", 51 "//third_party/zlib", 52 ] 53 54 sources = [ 55 # add mock file 56 "js_module_reader_test.cpp", 57 ] 58 59 configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ] 60 deps = [] 61 62 external_deps = [ 63 "ability_base:extractortool", 64 "ability_runtime:runtime", 65 "c_utils:utils", 66 ] 67} 68 69ohos_unittest("js_runtime_test") { 70 module_out_path = module_output_path 71 72 include_dirs = [ 73 "${ability_runtime_native_path}/runtime", 74 "${ability_runtime_native_path}/runtime/utils/include", 75 "//third_party/zlib/contrib/minizip", 76 "//third_party/zlib", 77 ] 78 79 sources = [ 80 # add mock file 81 "js_runtime_test.cpp", 82 ] 83 84 configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ] 85 deps = [ 86 "//third_party/googletest:gmock_main", 87 "//third_party/googletest:gtest_main", 88 ] 89 90 external_deps = [ 91 "ability_runtime:js_environment", 92 "ability_runtime:runtime", 93 "bundle_framework:appexecfwk_core", 94 "c_utils:utils", 95 "ets_runtime:libark_jsruntime", 96 "eventhandler:libeventhandler", 97 "hilog:libhilog", 98 "ipc:ipc_core", 99 "napi:ace_napi", 100 ] 101} 102 103ohos_unittest("hdc_register_test") { 104 module_out_path = module_output_path 105 106 include_dirs = [ 107 "${ability_runtime_native_path}/runtime", 108 "${ability_runtime_native_path}/runtime/utils/include", 109 "//third_party/zlib/contrib/minizip", 110 "//third_party/zlib", 111 ] 112 113 sources = [ 114 # add mock file 115 "${ability_runtime_native_path}/runtime/hdc_register.cpp", 116 "hdc_register_test.cpp", 117 ] 118 119 configs = [ 120 "${ability_runtime_services_path}/abilitymgr:abilityms_config", 121 ":coverage_flags", 122 ] 123 deps = [ 124 "//third_party/googletest:gmock_main", 125 "//third_party/googletest:gtest_main", 126 ] 127 128 external_deps = [ 129 "ability_runtime:js_environment", 130 "ability_runtime:runtime", 131 "bundle_framework:appexecfwk_core", 132 "c_utils:utils", 133 "eventhandler:libeventhandler", 134 "hilog:libhilog", 135 "ipc:ipc_core", 136 "napi:ace_napi", 137 ] 138} 139 140ohos_unittest("ohos_js_environment_test") { 141 module_out_path = module_output_path 142 143 include_dirs = [ "${ability_runtime_native_path}/runtime" ] 144 145 sources = [ "ohos_js_environment_test.cpp" ] 146 147 configs = [] 148 149 deps = [ 150 "//third_party/googletest:gmock_main", 151 "//third_party/googletest:gtest_main", 152 ] 153 154 external_deps = [ 155 "ability_runtime:js_environment", 156 "ability_runtime:runtime", 157 "c_utils:utils", 158 "ets_runtime:libark_jsruntime", 159 "eventhandler:libeventhandler", 160 "hilog:libhilog", 161 "napi:ace_napi", 162 ] 163} 164 165group("unittest") { 166 testonly = true 167 168 deps = [ 169 ":hdc_register_test", 170 ":js_runtime_test", 171 ":ohos_js_environment_test", 172 ":runtime_test", 173 ] 174} 175