• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("//foundation/arkui/napi/napi.gni")
15
16import("//build/config/components/ace_engine/ace_gen_obj.gni")
17import("//build/test.gni")
18import("//foundation/arkui/napi/test/unittest/ut.gni")
19
20ohos_unittest("test_ark_unittest_base") {
21  module_out_path = module_output_path
22
23  include_dirs = common_include
24
25  cflags = [ "-g3" ]
26
27  sources = [
28    "engine/test_ark.cpp",
29    "test_napi.cpp",
30    "test_napi_context.cpp",
31    "test_sendable_napi.cpp",
32  ]
33
34  defines = [ "NAPI_TEST" ]
35
36  deps = [ "../..:ace_napi" ]
37
38  external_deps = [
39    "bounds_checking_function:libsec_shared",
40    "c_utils:utils",
41    "ets_runtime:libark_jsruntime",
42    "eventhandler:libeventhandler",
43  ]
44
45  external_deps += [
46    "googletest:gtest",
47    "googletest:gtest_main",
48    "hilog:libhilog",
49    "libuv:uv",
50  ]
51}
52
53ohos_unittest("test_ark_unittest_threadsafe") {
54  module_out_path = module_output_path
55
56  include_dirs = common_include
57
58  cflags = [ "-g3" ]
59
60  sources = [
61    "engine/test_ark.cpp",
62    "test_napi_threadsafe.cpp",
63  ]
64
65  defines = [ "NAPI_TEST" ]
66
67  deps = [ "../..:ace_napi" ]
68
69  external_deps = [
70    "bounds_checking_function:libsec_shared",
71    "c_utils:utils",
72    "ets_runtime:libark_jsruntime",
73  ]
74
75  external_deps += [
76    "eventhandler:libeventhandler",
77    "googletest:gtest",
78    "googletest:gtest_main",
79    "hilog:libhilog",
80    "libuv:uv",
81  ]
82}
83
84ohos_unittest("test_unittest_sendevent") {
85  module_out_path = module_output_path
86
87  include_dirs = [
88    "./common",
89    "./engine",
90    "../../interfaces/inner_api",
91    "../../interfaces/kits",
92    "../../native_engine",
93  ]
94
95  cflags = [ "-g3" ]
96
97  sources = [
98    "engine/test_ark.cpp",
99    "test_napi_sendevent.cpp",
100  ]
101
102  defines = [ "NAPI_TEST" ]
103
104  deps = [ "../..:ace_napi" ]
105
106  external_deps = [
107    "c_utils:utils",
108    "ets_runtime:libark_jsruntime",
109    "eventhandler:libeventhandler",
110    "googletest:gtest",
111    "googletest:gtest_main",
112    "hilog:libhilog",
113    "libuv:uv",
114  ]
115}
116
117ohos_unittest("test_worker_manager") {
118  module_out_path = module_output_path
119
120  cflags = [ "-g3" ]
121
122  sources = [ "test_worker_manager.cpp" ]
123
124  defines = [ "NAPI_TEST" ]
125
126  deps = [ "../..:ace_napi" ]
127
128  external_deps = [
129    "googletest:gtest",
130    "googletest:gtest_main",
131    "hilog:libhilog",
132  ]
133}
134
135ohos_unittest("test_ark_unittest_errorcode") {
136  module_out_path = module_output_path
137
138  include_dirs = common_include
139
140  cflags = [ "-g3" ]
141
142  sources = [
143    "engine/test_ark.cpp",
144    "test_napi_errorcode.cpp",
145    "test_napi_pendingexception.cpp",
146  ]
147
148  defines = [ "NAPI_TEST" ]
149
150  deps = [ "../..:ace_napi" ]
151
152  external_deps = [
153    "bounds_checking_function:libsec_shared",
154    "c_utils:utils",
155    "ets_runtime:libark_jsruntime",
156    "eventhandler:libeventhandler",
157  ]
158
159  external_deps += [
160    "googletest:gtest",
161    "googletest:gtest_main",
162    "hilog:libhilog",
163    "libuv:uv",
164  ]
165}
166
167group("unittest") {
168  testonly = true
169  deps = [
170    ":test_ark_unittest_base",
171    ":test_ark_unittest_errorcode",
172    ":test_ark_unittest_threadsafe",
173    ":test_unittest_sendevent",
174    ":test_worker_manager",
175  ]
176  if (target_cpu == "arm64" || target_cpu == "x86_64") {
177    deps += [ "cj_native:cj_native_unittest" ]
178  }
179}
180