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("//base/inputmethod/imf/inputmethod.gni")
15import("//build/test.gni")
16
17config("module_private_config") {
18  visibility = [ ":*" ]
19
20  include_dirs = [
21    "${inputmethod_path}/services/include",
22    "${inputmethod_path}/test/common",
23    "${inputmethod_path}/services/adapter/settings_data_provider/common/include",
24  ]
25}
26
27module_output_path = "imf/cpp"
28
29ohos_unittest("InputMethodControllerTest") {
30  branch_protector_ret = "pac_ret"
31  sanitize = {
32    cfi = true
33    cfi_cross_dso = true
34    debug = false
35    blocklist = "./inputmethod_blocklist.txt"
36  }
37  module_out_path = module_output_path
38
39  sources = [
40    "${inputmethod_path}/services/src/input_type_manager.cpp",
41    "src/ime_event_monitor_manager_test.cpp",
42    "src/input_method_controller_test.cpp",
43  ]
44
45  configs = [ ":module_private_config" ]
46
47  deps = [
48    "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
49    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
50    "${inputmethod_path}/services:inputmethod_service_static",
51    "${inputmethod_path}/test/common:inputmethod_test_common",
52    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
53    "//third_party/googletest:gtest_main",
54  ]
55
56  external_deps = [
57    "ability_base:want",
58    "ability_runtime:ability_context_native",
59    "ability_runtime:ability_manager",
60    "access_token:libaccesstoken_sdk",
61    "bundle_framework:appexecfwk_core",
62    "c_utils:utils",
63    "config_policy:configpolicy_util",
64    "data_share:datashare_common",
65    "data_share:datashare_consumer",
66    "eventhandler:libeventhandler",
67    "hilog:libhilog",
68    "input:libmmi-client",
69    "ipc:ipc_single",
70    "napi:ace_napi",
71    "safwk:system_ability_fwk",
72    "samgr:samgr_proxy",
73    "window_manager:libdm",
74  ]
75
76  if (window_manager_use_sceneboard) {
77    external_deps += [ "window_manager:libwm_lite" ]
78  } else {
79    external_deps += [ "window_manager:libwm" ]
80  }
81}
82
83ohos_unittest("InputMethodAttachTest") {
84  branch_protector_ret = "pac_ret"
85  sanitize = {
86    cfi = true
87    cfi_cross_dso = true
88    debug = false
89  }
90  module_out_path = module_output_path
91
92  sources = [ "src/input_method_attach_test.cpp" ]
93
94  configs = [ ":module_private_config" ]
95
96  deps = [
97    "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
98    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
99    "${inputmethod_path}/services:inputmethod_service_static",
100    "${inputmethod_path}/services/json:imf_json_static",
101    "${inputmethod_path}/test/common:inputmethod_test_common",
102    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
103    "//third_party/googletest:gmock",
104    "//third_party/googletest:gtest_main",
105  ]
106
107  external_deps = [
108    "ability_base:want",
109    "ability_runtime:ability_context_native",
110    "ability_runtime:ability_manager",
111    "access_token:libaccesstoken_sdk",
112    "bundle_framework:appexecfwk_core",
113    "c_utils:utils",
114    "data_share:datashare_common",
115    "data_share:datashare_consumer",
116    "hilog:libhilog",
117    "input:libmmi-client",
118    "napi:ace_napi",
119    "window_manager:libdm",
120  ]
121
122  if (window_manager_use_sceneboard) {
123    external_deps += [ "window_manager:libwm_lite" ]
124  } else {
125    external_deps += [ "window_manager:libwm" ]
126  }
127}
128ohos_unittest("InputMethodAbilityTest") {
129  branch_protector_ret = "pac_ret"
130  sanitize = {
131    cfi = true
132    cfi_cross_dso = true
133    debug = false
134  }
135  module_out_path = module_output_path
136
137  sources = [
138    "${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_agent_stub.cpp",
139    "${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_core_proxy.cpp",
140    "${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_core_stub.cpp",
141    "${inputmethod_path}/services/src/input_control_channel_proxy.cpp",
142    "src/input_method_ability_exception_test.cpp",
143    "src/input_method_ability_test.cpp",
144  ]
145
146  configs = [ ":module_private_config" ]
147
148  deps = [
149    "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
150    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
151    "${inputmethod_path}/services:inputmethod_service_static",
152    "${inputmethod_path}/services/json:imf_json_static",
153    "${inputmethod_path}/test/common:inputmethod_test_common",
154    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
155    "//third_party/googletest:gtest_main",
156  ]
157
158  external_deps = [
159    "ability_base:want",
160    "ability_runtime:ability_context_native",
161    "ability_runtime:ability_manager",
162    "access_token:libaccesstoken_sdk",
163    "bundle_framework:appexecfwk_core",
164    "c_utils:utils",
165    "data_share:datashare_common",
166    "data_share:datashare_consumer",
167    "graphic_2d:librender_service_client",
168    "graphic_2d:window_animation",
169    "hilog:libhilog",
170    "input:libmmi-client",
171    "ipc:ipc_single",
172    "memmgr:memmgrclient",
173    "napi:ace_napi",
174    "os_account:os_account_innerkits",
175    "window_manager:libdm",
176    "window_manager:libwsutils",
177  ]
178
179  if (window_manager_use_sceneboard) {
180    external_deps += [ "window_manager:libwm_lite" ]
181  } else {
182    external_deps += [ "window_manager:libwm" ]
183  }
184}
185
186ohos_unittest("InputMethodServiceTest") {
187  branch_protector_ret = "pac_ret"
188  sanitize = {
189    cfi = true
190    cfi_cross_dso = true
191    debug = false
192  }
193  module_out_path = module_output_path
194
195  sources = [ "src/input_method_service_test.cpp" ]
196
197  configs = [ ":module_private_config" ]
198
199  deps = [
200    "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
201    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
202    "${inputmethod_path}/services:inputmethod_service",
203    "${inputmethod_path}/test/common:inputmethod_test_common",
204    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
205    "//third_party/cJSON:cjson",
206    "//third_party/googletest:gtest_main",
207  ]
208
209  external_deps = [
210    "ability_base:want",
211    "ability_runtime:ability_context_native",
212    "ability_runtime:ability_manager",
213    "access_token:libaccesstoken_sdk",
214    "c_utils:utils",
215    "hilog:libhilog",
216    "input:libmmi-client",
217    "ipc:ipc_single",
218    "napi:ace_napi",
219    "window_manager:libdm",
220  ]
221
222  if (window_manager_use_sceneboard) {
223    external_deps += [ "window_manager:libwm_lite" ]
224  } else {
225    external_deps += [ "window_manager:libwm" ]
226  }
227}
228
229ohos_unittest("InputMethodDfxTest") {
230  branch_protector_ret = "pac_ret"
231  sanitize = {
232    cfi = true
233    cfi_cross_dso = true
234    debug = false
235  }
236  module_out_path = module_output_path
237
238  sources = [ "src/input_method_dfx_test.cpp" ]
239
240  configs = [ ":module_private_config" ]
241
242  deps = [
243    "${inputmethod_path}/common:inputmethod_common",
244    "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
245    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
246    "${inputmethod_path}/services:inputmethod_service_static",
247    "${inputmethod_path}/test/common:inputmethod_test_common",
248    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
249    "//third_party/googletest:gtest_main",
250  ]
251
252  external_deps = [
253    "ability_base:want",
254    "ability_runtime:ability_context_native",
255    "ability_runtime:ability_manager",
256    "access_token:libaccesstoken_sdk",
257    "bundle_framework:appexecfwk_core",
258    "c_utils:utils",
259    "data_share:datashare_common",
260    "data_share:datashare_consumer",
261    "eventhandler:libeventhandler",
262    "hilog:libhilog",
263    "hisysevent:libhisysevent",
264    "hisysevent:libhisyseventmanager",
265    "input:libmmi-client",
266    "ipc:ipc_single",
267    "napi:ace_napi",
268    "window_manager:libdm",
269  ]
270
271  if (window_manager_use_sceneboard) {
272    external_deps += [ "window_manager:libwm_lite" ]
273  } else {
274    external_deps += [ "window_manager:libwm" ]
275  }
276}
277
278ohos_unittest("InputMethodPanelTest") {
279  branch_protector_ret = "pac_ret"
280  sanitize = {
281    cfi = true
282    cfi_cross_dso = true
283    debug = false
284  }
285  module_out_path = module_output_path
286
287  sources = [ "src/input_method_panel_test.cpp" ]
288
289  configs = [ ":module_private_config" ]
290
291  deps = [
292    "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
293    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
294    "${inputmethod_path}/services:inputmethod_service_static",
295    "${inputmethod_path}/test/common:inputmethod_test_common",
296    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
297    "//third_party/googletest:gtest_main",
298  ]
299
300  external_deps = [
301    "ability_base:want",
302    "ability_runtime:ability_context_native",
303    "ability_runtime:ability_manager",
304    "access_token:libaccesstoken_sdk",
305    "bundle_framework:appexecfwk_core",
306    "c_utils:utils",
307    "common_event_service:cesfwk_innerkits",
308    "data_share:datashare_common",
309    "data_share:datashare_consumer",
310    "eventhandler:libeventhandler",
311    "graphic_2d:librender_service_client",
312    "graphic_2d:window_animation",
313    "hilog:libhilog",
314    "input:libmmi-client",
315    "napi:ace_napi",
316    "os_account:os_account_innerkits",
317    "window_manager:libdm",
318    "window_manager:libwsutils",
319  ]
320
321  if (window_manager_use_sceneboard) {
322    external_deps += [ "window_manager:libwm_lite" ]
323  } else {
324    external_deps += [ "window_manager:libwm" ]
325  }
326}
327
328ohos_unittest("InputMethodSwitchTest") {
329  branch_protector_ret = "pac_ret"
330  sanitize = {
331    cfi = true
332    cfi_cross_dso = true
333    debug = false
334  }
335  module_out_path = module_output_path
336
337  sources = [ "src/input_method_switch_test.cpp" ]
338
339  configs = [ ":module_private_config" ]
340
341  deps = [
342    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
343    "${inputmethod_path}/services:inputmethod_service",
344    "${inputmethod_path}/services/adapter/settings_data_provider:settings_data_static",
345    "${inputmethod_path}/test/common:inputmethod_test_common",
346    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
347    "//third_party/cJSON:cjson",
348    "//third_party/googletest:gtest_main",
349  ]
350
351  external_deps = [
352    "access_token:libaccesstoken_sdk",
353    "bundle_framework:appexecfwk_core",
354    "c_utils:utils",
355    "data_share:datashare_common",
356    "data_share:datashare_consumer",
357    "hilog:libhilog",
358    "input:libmmi-client",
359  ]
360
361  if (window_manager_use_sceneboard) {
362    external_deps += [ "window_manager:libwm_lite" ]
363  } else {
364    external_deps += [ "window_manager:libwm" ]
365  }
366}
367
368ohos_unittest("InputMethodPrivateMemberTest") {
369  branch_protector_ret = "pac_ret"
370  sanitize = {
371    cfi = true
372    cfi_cross_dso = true
373    debug = false
374  }
375  module_out_path = module_output_path
376
377  sources = [
378    "${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_agent_stub.cpp",
379    "${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_core_stub.cpp",
380    "${inputmethod_path}/services/adapter/ime_connection_manager/src/ime_connection.cpp",
381    "${inputmethod_path}/services/src/input_control_channel_proxy.cpp",
382    "src/input_method_private_member_test.cpp",
383  ]
384
385  configs = [ ":module_private_config" ]
386
387  deps = [
388    "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
389    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
390    "${inputmethod_path}/services:inputmethod_service_static",
391    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
392    "//third_party/googletest:gtest_main",
393  ]
394
395  external_deps = [
396    "ability_runtime:ability_manager",
397    "access_token:libaccesstoken_sdk",
398    "bundle_framework:appexecfwk_base",
399    "bundle_framework:appexecfwk_core",
400    "c_utils:utils",
401    "data_share:datashare_common",
402    "data_share:datashare_consumer",
403    "hilog:libhilog",
404    "input:libmmi-client",
405    "ipc:ipc_core",
406    "ipc:ipc_single",
407    "napi:ace_napi",
408    "os_account:os_account_innerkits",
409    "window_manager:libdm",
410  ]
411
412  if (window_manager_use_sceneboard) {
413    external_deps += [ "window_manager:libwm_lite" ]
414  } else {
415    external_deps += [ "window_manager:libwm" ]
416  }
417}
418
419ohos_unittest("InputMethodEditorTest") {
420  branch_protector_ret = "pac_ret"
421  sanitize = {
422    cfi = true
423    cfi_cross_dso = true
424    debug = false
425  }
426  module_out_path = module_output_path
427
428  sources = [ "src/input_method_editor_test.cpp" ]
429
430  configs = [ ":module_private_config" ]
431
432  deps = [
433    "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
434    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
435    "${inputmethod_path}/services:inputmethod_service_static",
436    "${inputmethod_path}/services/json:imf_json_static",
437    "${inputmethod_path}/test/common:inputmethod_test_common",
438    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
439    "//third_party/googletest:gtest_main",
440  ]
441
442  external_deps = [
443    "ability_base:want",
444    "ability_runtime:ability_context_native",
445    "ability_runtime:ability_manager",
446    "access_token:libaccesstoken_sdk",
447    "bundle_framework:appexecfwk_core",
448    "c_utils:utils",
449    "data_share:datashare_common",
450    "data_share:datashare_consumer",
451    "eventhandler:libeventhandler",
452    "hilog:libhilog",
453    "input:libmmi-client",
454    "ipc:ipc_single",
455    "napi:ace_napi",
456    "window_manager:libdm",
457  ]
458
459  if (window_manager_use_sceneboard) {
460    external_deps += [ "window_manager:libwm_lite" ]
461  } else {
462    external_deps += [ "window_manager:libwm" ]
463  }
464}
465
466ohos_unittest("NewImeSwitchTest") {
467  branch_protector_ret = "pac_ret"
468  sanitize = {
469    cfi = true
470    cfi_cross_dso = true
471    debug = false
472  }
473  module_out_path = module_output_path
474
475  sources = [ "src/newIme_switch_test.cpp" ]
476
477  configs = [ ":module_private_config" ]
478
479  deps = [
480    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
481    "${inputmethod_path}/services:inputmethod_service",
482    "${inputmethod_path}/services/adapter/settings_data_provider:settings_data_static",
483    "${inputmethod_path}/test/common:inputmethod_test_common",
484    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
485    "//third_party/cJSON:cjson",
486    "//third_party/googletest:gtest_main",
487  ]
488
489  external_deps = [
490    "access_token:libaccesstoken_sdk",
491    "bundle_framework:appexecfwk_core",
492    "c_utils:utils",
493    "data_share:datashare_common",
494    "data_share:datashare_consumer",
495    "hilog:libhilog",
496    "input:libmmi-client",
497  ]
498
499  if (window_manager_use_sceneboard) {
500    external_deps += [ "window_manager:libwm_lite" ]
501  } else {
502    external_deps += [ "window_manager:libwm" ]
503  }
504}
505
506ohos_unittest("IdentityCheckerTest") {
507  branch_protector_ret = "pac_ret"
508  sanitize = {
509    cfi = true
510    cfi_cross_dso = true
511    debug = false
512    blocklist = "./inputmethod_blocklist.txt"
513  }
514  module_out_path = module_output_path
515
516  sources = [
517    "${inputmethod_path}/services/adapter/ime_connection_manager/src/ime_connection.cpp",
518    "src/identity_checker_test.cpp",
519  ]
520
521  configs = [ ":module_private_config" ]
522
523  deps = [
524    "${inputmethod_path}/services:inputmethod_service_static",
525    "${inputmethod_path}/test/common:inputmethod_test_common",
526    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
527    "//third_party/googletest:gtest_main",
528  ]
529
530  external_deps = [
531    "ability_base:want",
532    "ability_runtime:ability_context_native",
533    "ability_runtime:ability_manager",
534    "access_token:libaccesstoken_sdk",
535    "bundle_framework:appexecfwk_core",
536    "c_utils:utils",
537    "data_share:datashare_common",
538    "data_share:datashare_consumer",
539    "hilog:libhilog",
540    "input:libmmi-client",
541    "ipc:ipc_single",
542    "napi:ace_napi",
543    "window_manager:libdm",
544  ]
545
546  if (window_manager_use_sceneboard) {
547    external_deps += [ "window_manager:libwm_lite" ]
548  } else {
549    external_deps += [ "window_manager:libwm" ]
550  }
551}
552
553ohos_unittest("TextListenerInnerApiTest") {
554  branch_protector_ret = "pac_ret"
555  sanitize = {
556    cfi = true
557    cfi_cross_dso = true
558    debug = false
559  }
560  module_out_path = module_output_path
561
562  sources = [ "src/text_listener_inner_api_test.cpp" ]
563
564  configs = [ ":module_private_config" ]
565
566  deps = [
567    "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
568    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
569    "${inputmethod_path}/services:inputmethod_service",
570    "${inputmethod_path}/test/common:inputmethod_test_common",
571    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
572    "//third_party/googletest:gmock",
573    "//third_party/googletest:gtest_main",
574  ]
575
576  external_deps = [
577    "ability_base:want",
578    "ability_runtime:ability_context_native",
579    "ability_runtime:ability_manager",
580    "access_token:libaccesstoken_sdk",
581    "bundle_framework:appexecfwk_core",
582    "c_utils:utils",
583    "eventhandler:libeventhandler",
584    "hilog:libhilog",
585    "input:libmmi-client",
586    "ipc:ipc_single",
587    "napi:ace_napi",
588    "safwk:system_ability_fwk",
589    "samgr:samgr_proxy",
590  ]
591
592  if (window_manager_use_sceneboard) {
593    external_deps += [ "window_manager:libwm_lite" ]
594  } else {
595    external_deps += [ "window_manager:libwm" ]
596  }
597}
598
599ohos_unittest("ImeProxyTest") {
600  branch_protector_ret = "pac_ret"
601  sanitize = {
602    cfi = true
603    cfi_cross_dso = true
604    debug = false
605  }
606  module_out_path = module_output_path
607
608  sources = [ "src/ime_proxy_test.cpp" ]
609
610  configs = [ ":module_private_config" ]
611
612  deps = [
613    "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
614    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
615    "${inputmethod_path}/services:inputmethod_service",
616    "${inputmethod_path}/test/common:inputmethod_test_common",
617    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
618    "${inputmethod_path}/test/unittest/resource/bundle_dependencies/editorBox:editorBox",
619    "${inputmethod_path}/test/unittest/resource/bundle_dependencies/extImfBundle:extImf",
620    "${inputmethod_path}/test/unittest/resource/ohos_test:copy_ohos_test",
621    "//third_party/googletest:gtest_main",
622  ]
623
624  external_deps = [
625    "ability_base:want",
626    "ability_runtime:ability_context_native",
627    "ability_runtime:ability_manager",
628    "access_token:libaccesstoken_sdk",
629    "bundle_framework:appexecfwk_core",
630    "c_utils:utils",
631    "graphic_2d:librender_service_client",
632    "graphic_2d:window_animation",
633    "hilog:libhilog",
634    "input:libmmi-client",
635    "ipc:ipc_single",
636    "napi:ace_napi",
637    "window_manager:libdm",
638  ]
639
640  if (window_manager_use_sceneboard) {
641    external_deps += [ "window_manager:libwm_lite" ]
642  } else {
643    external_deps += [ "window_manager:libwm" ]
644  }
645}
646
647ohos_unittest("EnableImeDataParseTest") {
648  branch_protector_ret = "pac_ret"
649  sanitize = {
650    cfi = true
651    cfi_cross_dso = true
652    debug = false
653  }
654  module_out_path = module_output_path
655
656  include_dirs = [
657    "${inputmethod_path}/test/unittest/cpp_test/mock",
658    "${inputmethod_path}/services/adapter/settings_data_provider/include",
659    "${inputmethod_path}/services/adapter/settings_data_provider/common/include",
660    "${inputmethod_path}/frameworks/native/inputmethod_controller/include",
661  ]
662
663  sources = [
664    "${inputmethod_path}/services/adapter/settings_data_provider/common/src/settings_data_observer.cpp",
665    "${inputmethod_path}/services/adapter/settings_data_provider/common/src/settings_data_utils.cpp",
666    "${inputmethod_path}/services/adapter/settings_data_provider/src/enable_ime_data_parser.cpp",
667    "mock/datashare_helper.cpp",
668    "mock/global.cpp",
669    "mock/ime_info_inquirer.cpp",
670    "src/enable_ime_data_parse_test.cpp",
671  ]
672
673  deps = [
674    "${inputmethod_path}/services/json:imf_json_static",
675    "//third_party/cJSON:cjson",
676    "//third_party/googletest:gmock",
677    "//third_party/googletest:gtest_main",
678  ]
679
680  external_deps = [
681    "ability_base:zuri",
682    "ability_runtime:dataobs_manager",
683    "bundle_framework:appexecfwk_core",
684    "c_utils:utils",
685    "data_share:datashare_common",
686    "data_share:datashare_consumer",
687    "hilog:libhilog",
688    "samgr:samgr_proxy",
689  ]
690}
691
692ohos_unittest("SecurityModeParseTest") {
693  branch_protector_ret = "pac_ret"
694  sanitize = {
695    cfi = true
696    cfi_cross_dso = true
697    debug = false
698  }
699  module_out_path = module_output_path
700
701  include_dirs = [
702    "${inputmethod_path}/test/unittest/cpp_test/mock",
703    "${inputmethod_path}/services/include",
704    "${inputmethod_path}/services/identity_checker/include",
705    "${inputmethod_path}/services/adapter/ime_connection_manager/include",
706    "${inputmethod_path}/services/adapter/settings_data_provider/include",
707    "${inputmethod_path}/services/adapter/settings_data_provider/common/include",
708    "${inputmethod_path}/frameworks/native/inputmethod_controller/include",
709    "${inputmethod_path}/frameworks/native/inputmethod_ability/include",
710  ]
711
712  sources = [
713    "${inputmethod_path}/services/adapter/ime_connection_manager/src/ime_connection.cpp",
714    "${inputmethod_path}/services/adapter/settings_data_provider/common/src/settings_data_observer.cpp",
715    "${inputmethod_path}/services/adapter/settings_data_provider/common/src/settings_data_utils.cpp",
716    "${inputmethod_path}/services/adapter/settings_data_provider/src/security_mode_parser.cpp",
717    "mock/datashare_helper.cpp",
718    "src/security_mode_parser_test.cpp",
719  ]
720
721  deps = [
722    "${inputmethod_path}/services:inputmethod_service_static",
723    "//third_party/googletest:gmock",
724    "//third_party/googletest:gtest_main",
725  ]
726
727  external_deps = [
728    "ability_base:zuri",
729    "ability_runtime:ability_manager",
730    "ability_runtime:dataobs_manager",
731    "access_token:libaccesstoken_sdk",
732    "bundle_framework:appexecfwk_core",
733    "c_utils:utils",
734    "data_share:datashare_common",
735    "data_share:datashare_consumer",
736    "hilog:libhilog",
737    "input:libmmi-client",
738    "ipc:ipc_core",
739    "samgr:samgr_proxy",
740  ]
741}
742
743ohos_unittest("ImeFreezeManagerTest") {
744  branch_protector_ret = "pac_ret"
745  sanitize = {
746    cfi = true
747    cfi_cross_dso = true
748    debug = false
749  }
750  module_out_path = module_output_path
751
752  sources = [ "src/ime_freeze_manager_test.cpp" ]
753
754  configs = [ ":module_private_config" ]
755
756  deps = [
757    "${inputmethod_path}/services:inputmethod_service_static",
758    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
759    "//third_party/googletest:gtest_main",
760  ]
761
762  external_deps = [
763    "ability_runtime:ability_manager",
764    "access_token:libaccesstoken_sdk",
765    "bundle_framework:appexecfwk_base",
766    "bundle_framework:appexecfwk_core",
767    "c_utils:utils",
768    "data_share:datashare_common",
769    "data_share:datashare_consumer",
770    "eventhandler:libeventhandler",
771    "hilog:libhilog",
772    "input:libmmi-client",
773    "ipc:ipc_core",
774    "ipc:ipc_single",
775    "os_account:os_account_innerkits",
776  ]
777
778  if (window_manager_use_sceneboard) {
779    external_deps += [ "window_manager:libwm_lite" ]
780  } else {
781    external_deps += [ "window_manager:libwm" ]
782  }
783}
784
785ohos_unittest("JsonOperateTest") {
786  branch_protector_ret = "pac_ret"
787  sanitize = {
788    cfi = true
789    cfi_cross_dso = true
790    debug = false
791  }
792  module_out_path = module_output_path
793
794  sources = [ "src/json_operate_test.cpp" ]
795
796  deps = [
797    "${inputmethod_path}/services:inputmethod_service_static",
798    "${inputmethod_path}/services/adapter/settings_data_provider:settings_data_static",
799    "${inputmethod_path}/services/json:imf_json_static",
800    "//third_party/cJSON:cjson",
801    "//third_party/googletest:gtest_main",
802  ]
803
804  external_deps = [
805    "bundle_framework:appexecfwk_base",
806    "bundle_framework:appexecfwk_core",
807    "data_share:datashare_common",
808    "data_share:datashare_consumer",
809    "hilog:libhilog",
810    "ipc:ipc_single",
811  ]
812}
813
814ohos_unittest("VirtualListenerTest") {
815  branch_protector_ret = "pac_ret"
816  sanitize = {
817    cfi = true
818    cfi_cross_dso = true
819    debug = false
820  }
821  module_out_path = module_output_path
822
823  sources = [ "src/virtual_listener_test.cpp" ]
824
825  configs = [ ":module_private_config" ]
826
827  deps = [
828    "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
829    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
830    "${inputmethod_path}/services:inputmethod_service",
831    "${inputmethod_path}/test/common:inputmethod_test_common",
832    "//third_party/googletest:gmock",
833    "//third_party/googletest:gtest_main",
834  ]
835
836  external_deps = [
837    "ability_base:want",
838    "ability_runtime:ability_context_native",
839    "ability_runtime:ability_manager",
840    "access_token:libaccesstoken_sdk",
841    "bundle_framework:appexecfwk_core",
842    "c_utils:utils",
843    "eventhandler:libeventhandler",
844    "hilog:libhilog",
845    "input:libmmi-client",
846    "ipc:ipc_single",
847    "napi:ace_napi",
848    "safwk:system_ability_fwk",
849    "samgr:samgr_proxy",
850  ]
851
852  if (window_manager_use_sceneboard) {
853    external_deps += [ "window_manager:libwm_lite" ]
854  } else {
855    external_deps += [ "window_manager:libwm" ]
856  }
857}
858ohos_unittest("ImeSystemChannelTest") {
859  branch_protector_ret = "pac_ret"
860  sanitize = {
861    cfi = true
862    cfi_cross_dso = true
863    debug = false
864    blocklist = "./inputmethod_blocklist.txt"
865  }
866  module_out_path = module_output_path
867
868  sources = [ "src/ime_system_channel_test.cpp" ]
869
870  configs = [ ":module_private_config" ]
871
872  deps = [
873    "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
874    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
875    "${inputmethod_path}/services:inputmethod_service",
876    "${inputmethod_path}/test/common:inputmethod_test_common",
877    "${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
878    "//third_party/googletest:gtest_main",
879  ]
880
881  external_deps = [
882    "ability_base:want",
883    "ability_runtime:ability_context_native",
884    "ability_runtime:ability_manager",
885    "access_token:libaccesstoken_sdk",
886    "bundle_framework:appexecfwk_core",
887    "c_utils:utils",
888    "eventhandler:libeventhandler",
889    "hilog:libhilog",
890    "input:libmmi-client",
891    "ipc:ipc_single",
892    "napi:ace_napi",
893    "safwk:system_ability_fwk",
894    "samgr:samgr_proxy",
895  ]
896
897  if (window_manager_use_sceneboard) {
898    external_deps += [ "window_manager:libwm_lite" ]
899  } else {
900    external_deps += [ "window_manager:libwm" ]
901  }
902}
903
904if (defined(build_seccomp) && build_seccomp) {
905  ohos_unittest("InputMethodSeccompTest") {
906    module_out_path = module_output_path
907    sanitize = {
908      cfi = true
909      cfi_cross_dso = true
910      debug = false
911      blocklist = "./inputmethod_blocklist.txt"
912    }
913    sources = [ "src/input_method_ext_seccomp_test.cpp" ]
914    external_deps = [ "init:seccomp" ]
915  }
916} else {
917  group("InputMethodSeccompTest") {
918  }
919}
920
921ohos_unittest("ImeControllerCpaiTest") {
922  sanitize = {
923    cfi = true
924    cfi_cross_dso = true
925    debug = false
926    blocklist = "./inputmethod_blocklist.txt"
927  }
928  module_out_path = module_output_path
929
930  sources = [
931    "src/inputmethod_controller_capi_test.cpp",
932    "src/native_text_changed_listener_test.cpp",
933  ]
934  include_dirs = [
935    "${inputmethod_path}/interfaces/kits/c",
936    "${inputmethod_path}/frameworks/ndk/include",
937  ]
938
939  deps = [
940    "${inputmethod_path}/frameworks/ndk:ohinputmethod",
941    "${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
942  ]
943
944  external_deps = [
945    "googletest:gtest_main",
946    "input:libmmi-client",
947  ]
948}
949