1# Copyright (c) 2023 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("../../../windowmanager_aafwk.gni")
16module_out_path = "window_manager/window_scene"
17
18group("unittest") {
19  testonly = true
20
21  deps = [
22    ":ws_dual_display_fold_policy_test",
23    ":ws_dual_display_sensor_fold_state_manager_test",
24    ":ws_fold_screen_controller_test",
25    ":ws_fold_screen_sensor_manager_test",
26    ":ws_fold_screen_state_machine_test",
27    ":ws_multi_screen_manager_test",
28    ":ws_screen_cutout_controller_test",
29    ":ws_screen_property_test",
30    ":ws_screen_rotation_property_test",
31    ":ws_screen_scene_config_test",
32    ":ws_screen_session_ability_connection_test",
33    ":ws_screen_session_manager_client_proxy_test",
34    ":ws_screen_session_manager_client_stub_test",
35    ":ws_screen_session_manager_client_test",
36    ":ws_screen_session_manager_lite_proxy_test",
37    ":ws_screen_session_manager_lite_stub_test",
38    ":ws_screen_session_manager_lite_test",
39    ":ws_screen_session_manager_proxy_test",
40    ":ws_screen_session_manager_stub_test",
41    ":ws_screen_session_manager_test",
42    ":ws_screen_session_manager_test2",
43    ":ws_screen_session_publish_test",
44    ":ws_screen_session_test",
45    ":ws_screen_setting_helper_test",
46    ":ws_screen_snapshot_picker_connection_test",
47    ":ws_sensor_fold_state_manager_test",
48    ":ws_session_display_power_controller_test",
49    ":ws_setting_observer_test",
50    ":ws_setting_provider_test",
51    ":ws_single_display_fold_policy_test",
52    ":ws_single_display_pocket_fold_policy_test",
53    ":ws_single_display_sensor_fold_state_manager_test",
54    ":ws_single_display_sensor_pocket_fold_state_manager_test",
55  ]
56}
57
58ohos_unittest("ws_setting_observer_test") {
59  module_out_path = module_out_path
60
61  sources = [ "setting_observer_test.cpp" ]
62
63  deps = [ ":ws_unittest_common" ]
64
65  external_deps = [
66    "ability_runtime:ability_manager",
67    "ability_runtime:dataobs_manager",
68    "c_utils:utils",
69    "hilog:libhilog",
70  ]
71}
72
73ohos_unittest("ws_setting_provider_test") {
74  module_out_path = module_out_path
75
76  sources = [ "setting_provider_test.cpp" ]
77
78  deps = [ ":ws_unittest_common" ]
79
80  external_deps = [
81    "c_utils:utils",
82    "data_share:datashare_consumer",
83    "hilog:libhilog",
84  ]
85}
86
87ohos_unittest("ws_single_display_fold_policy_test") {
88  module_out_path = module_out_path
89
90  sources = [ "single_display_fold_policy_test.cpp" ]
91
92  deps = [ ":ws_unittest_common" ]
93
94  external_deps = [
95    "ability_runtime:app_manager",
96    "c_utils:utils",
97    "hilog:libhilog",
98  ]
99}
100
101ohos_unittest("ws_single_display_pocket_fold_policy_test") {
102  module_out_path = module_out_path
103
104  sources = [ "single_display_pocket_fold_policy_test.cpp" ]
105
106  deps = [ ":ws_unittest_common" ]
107
108  external_deps = [
109    "ability_runtime:app_manager",
110    "c_utils:utils",
111    "hilog:libhilog",
112  ]
113}
114
115ohos_unittest("ws_sensor_fold_state_manager_test") {
116  module_out_path = module_out_path
117
118  sources = [ "sensor_fold_state_manager_test.cpp" ]
119
120  deps = [ ":ws_unittest_common" ]
121
122  external_deps = [
123    "ability_runtime:app_manager",
124    "c_utils:utils",
125    "hilog:libhilog",
126    "init:libbegetutil",
127  ]
128}
129
130ohos_unittest("ws_dual_display_fold_policy_test") {
131  module_out_path = module_out_path
132
133  sources = [ "dual_display_fold_policy_test.cpp" ]
134
135  deps = [ ":ws_unittest_common" ]
136
137  external_deps = [
138    "ability_runtime:app_manager",
139    "c_utils:utils",
140    "hilog:libhilog",
141    "init:libbegetutil",
142  ]
143}
144
145ohos_unittest("ws_dual_display_sensor_fold_state_manager_test") {
146  module_out_path = module_out_path
147
148  sources = [ "dual_display_sensor_fold_state_manager_test.cpp" ]
149
150  deps = [ ":ws_unittest_common" ]
151
152  external_deps = [
153    "ability_runtime:app_manager",
154    "c_utils:utils",
155    "hilog:libhilog",
156    "init:libbegetutil",
157  ]
158}
159
160ohos_unittest("ws_fold_screen_sensor_manager_test") {
161  module_out_path = module_out_path
162
163  sources = [ "fold_screen_sensor_manager_test.cpp" ]
164
165  deps = [
166    ":ws_unittest_common",
167    "${window_base_path}/window_scene/interfaces/innerkits:libwsutils",
168  ]
169
170  external_deps = [
171    "ability_runtime:app_manager",
172    "c_utils:utils",
173    "hilog:libhilog",
174    "init:libbegetutil",
175  ]
176
177  defines = []
178  if (defined(global_parts_info) && defined(global_parts_info.sensors_sensor)) {
179    external_deps += [ "sensor:sensor_interface_native" ]
180    defines += [ "SENSOR_ENABLE" ]
181  }
182}
183
184ohos_unittest("ws_screen_session_publish_test") {
185  module_out_path = module_out_path
186
187  sources = [ "screen_session_publish_test.cpp" ]
188
189  deps = [ ":ws_unittest_common" ]
190
191  external_deps = [
192    "ability_runtime:app_manager",
193    "c_utils:utils",
194    "common_event_service:cesfwk_innerkits",
195    "hilog:libhilog",
196    "init:libbegetutil",
197  ]
198}
199
200ohos_unittest("ws_screen_setting_helper_test") {
201  module_out_path = module_out_path
202
203  sources = [ "screen_setting_helper_test.cpp" ]
204
205  deps = [ ":ws_unittest_common" ]
206
207  external_deps = [
208    "ability_runtime:app_manager",
209    "ability_runtime:dataobs_manager",
210    "c_utils:utils",
211    "hilog:libhilog",
212    "init:libbegetutil",
213  ]
214}
215
216ohos_unittest("ws_screen_session_manager_lite_test") {
217  module_out_path = module_out_path
218
219  sources = [
220    "${window_base_path}/wmserver/src/zidl/mock_session_manager_service_proxy.cpp",
221    "screen_session_manager_lite_test.cpp",
222  ]
223
224  deps = [
225    ":ws_unittest_common",
226    "${window_base_path}/dm_lite:libdm_lite",
227    "${window_base_path}/wmserver:sms",
228  ]
229
230  external_deps = [
231    "ability_runtime:app_manager",
232    "c_utils:utils",
233    "hilog:libhilog",
234  ]
235}
236
237ohos_unittest("ws_multi_screen_manager_test") {
238  module_out_path = module_out_path
239
240  sources = [ "multi_screen_manager_test.cpp" ]
241
242  deps = [ ":ws_unittest_common" ]
243
244  external_deps = [
245    "c_utils:utils",
246    "hilog:libhilog",
247    "hitrace:hitrace_meter",
248  ]
249}
250
251ohos_unittest("ws_screen_session_test") {
252  module_out_path = module_out_path
253
254  include_dirs = [ "${window_base_path}/window_scene/session/screen/include" ]
255  sources = [ "screen_session_test.cpp" ]
256
257  deps = [
258    ":ws_unittest_common",
259    "${window_base_path}/window_scene/interfaces/innerkits:libwsutils",
260    "${window_base_path}/window_scene/session:screen_session",
261  ]
262
263  external_deps = [ "c_utils:utils" ]
264}
265
266ohos_unittest("ws_screen_session_ability_connection_test") {
267  module_out_path = module_out_path
268
269  include_dirs = [ "${window_base_path}/window_scene/session/screen/include" ]
270  sources = [ "screen_session_ability_connection_test.cpp" ]
271
272  deps = [
273    ":ws_unittest_common",
274    "${window_base_path}/window_scene/interfaces/innerkits:libwsutils",
275    "${window_base_path}/window_scene/session:screen_session",
276  ]
277
278  external_deps = [
279    "ability_base:base",
280    "ability_base:want",
281    "ability_runtime:abilitykit_native",
282    "ability_runtime:extension_manager",
283    "c_utils:utils",
284    "ipc:ipc_core",
285  ]
286}
287
288ohos_unittest("ws_screen_snapshot_picker_connection_test") {
289  module_out_path = module_out_path
290
291  include_dirs = [ "${window_base_path}/window_scene/session/screen/include" ]
292  sources = [ "screen_snapshot_picker_connection_test.cpp" ]
293
294  deps = [
295    ":ws_unittest_common",
296    "${window_base_path}/window_scene/session:screen_session",
297  ]
298
299  external_deps = [
300    "ability_runtime:abilitykit_native",
301    "c_utils:utils",
302  ]
303}
304
305ohos_unittest("ws_screen_property_test") {
306  module_out_path = module_out_path
307
308  include_dirs = [ "${window_base_path}/window_scene/session/screen/include" ]
309  sources = [ "screen_property_test.cpp" ]
310
311  deps = [
312    ":ws_unittest_common",
313    "${window_base_path}/window_scene/session:screen_session",
314  ]
315
316  external_deps = [
317    "c_utils:utils",
318    "graphic_2d:librender_service_client",
319  ]
320}
321
322ohos_unittest("ws_screen_cutout_controller_test") {
323  module_out_path = module_out_path
324
325  sources = [ "screen_cutout_controller_test.cpp" ]
326
327  deps = [ ":ws_unittest_common" ]
328  external_deps = [
329    "ability_runtime:app_manager",
330    "c_utils:utils",
331    "hilog:libhilog",
332  ]
333}
334
335ohos_unittest("ws_screen_scene_config_test") {
336  module_out_path = module_out_path
337
338  sources = [ "screen_scene_config_test.cpp" ]
339
340  deps = [
341    ":ws_unittest_common",
342    "${window_base_path}/window_scene/interfaces/innerkits:libwsutils",
343  ]
344
345  external_deps = [
346    "c_utils:utils",
347    "hilog:libhilog",
348  ]
349}
350
351ohos_unittest("ws_screen_session_manager_client_proxy_test") {
352  module_out_path = module_out_path
353
354  sources = [ "screen_session_manager_client_proxy_test.cpp" ]
355
356  deps = [ ":ws_unittest_common" ]
357}
358
359ohos_unittest("ws_screen_session_manager_client_stub_test") {
360  module_out_path = module_out_path
361
362  include_dirs = [ "${window_base_path}/window_scene/screen_session_manager_client/include/zidl" ]
363
364  sources = [ "screen_session_manager_client_stub_test.cpp" ]
365
366  deps = [ ":ws_unittest_common" ]
367}
368
369ohos_unittest("ws_screen_session_manager_client_test") {
370  module_out_path = module_out_path
371
372  sources = [ "screen_session_manager_client_test.cpp" ]
373
374  deps = [
375    ":ws_unittest_common",
376    "${window_base_path}/window_scene/interfaces/innerkits:libwsutils",
377  ]
378}
379
380ohos_unittest("ws_screen_session_manager_lite_proxy_test") {
381  module_out_path = module_out_path
382
383  sources = [
384    "${window_base_path}/window_scene/screen_session_manager/src/zidl/screen_session_manager_lite_proxy.cpp",
385    "screen_session_manager_lite_proxy_test.cpp",
386  ]
387
388  deps = [
389    ":ws_unittest_common",
390    "${window_base_path}/dm_lite:libdm_lite",
391    "${window_base_path}/wmserver:sms",
392  ]
393}
394
395ohos_unittest("ws_screen_session_manager_lite_stub_test") {
396  module_out_path = module_out_path
397
398  sources = [ "screen_session_manager_lite_stub_test.cpp" ]
399
400  deps = [
401    ":ws_unittest_common",
402    "${window_base_path}/wmserver:sms",
403  ]
404}
405
406ohos_unittest("ws_screen_session_manager_stub_test") {
407  module_out_path = module_out_path
408
409  sources = [ "screen_session_manager_stub_test.cpp" ]
410
411  deps = [
412    ":ws_unittest_common",
413    "${window_base_path}/window_scene/interfaces/innerkits:libwsutils",
414  ]
415
416  external_deps = [
417    "ability_runtime:app_manager",
418    "c_utils:utils",
419    "hilog:libhilog",
420  ]
421}
422
423ohos_unittest("ws_screen_session_manager_proxy_test") {
424  module_out_path = module_out_path
425
426  sources = [ "screen_session_manager_proxy_test.cpp" ]
427
428  deps = [
429    ":ws_unittest_common",
430    "${window_base_path}/window_scene/interfaces/innerkits:libwsutils",
431  ]
432
433  external_deps = [
434    "ability_runtime:app_manager",
435    "c_utils:utils",
436    "hilog:libhilog",
437  ]
438}
439
440ohos_unittest("ws_screen_session_manager_test") {
441  module_out_path = module_out_path
442
443  sources = [ "screen_session_manager_test.cpp" ]
444
445  deps = [
446    ":ws_unittest_common",
447    "${window_base_path}/window_scene/interfaces/innerkits:libwsutils",
448  ]
449
450  external_deps = [
451    "ability_runtime:ability_context_native",
452    "ability_runtime:app_manager",
453    "ability_runtime:runtime",
454    "c_utils:utils",
455    "hilog:libhilog",
456  ]
457}
458
459ohos_unittest("ws_screen_session_manager_test2") {
460  module_out_path = module_out_path
461
462  sources = [ "screen_session_manager_test2.cpp" ]
463
464  deps = [ ":ws_unittest_common" ]
465
466  external_deps = [
467    "c_utils:utils",
468    "hilog:libhilog",
469    "init:libbegetutil",
470  ]
471}
472
473ohos_unittest("ws_fold_screen_controller_test") {
474  module_out_path = module_out_path
475
476  sources = [ "fold_screen_controller_test.cpp" ]
477
478  deps = [ ":ws_unittest_common" ]
479
480  external_deps = [
481    "ability_runtime:app_manager",
482    "c_utils:utils",
483    "hilog:libhilog",
484  ]
485}
486
487ohos_unittest("ws_screen_rotation_property_test") {
488  module_out_path = module_out_path
489
490  sources = [ "screen_rotation_property_test.cpp" ]
491
492  deps = [ ":ws_unittest_common" ]
493
494  external_deps = [
495    "ability_runtime:app_manager",
496    "c_utils:utils",
497    "hilog:libhilog",
498  ]
499  defines = []
500  if (defined(global_parts_info) && defined(global_parts_info.sensors_sensor)) {
501    external_deps += [ "sensor:sensor_interface_native" ]
502    defines += [ "SENSOR_ENABLE" ]
503  }
504}
505
506ohos_unittest("ws_screen_session_dumper_test") {
507  module_out_path = module_out_path
508
509  sources = [ "screen_session_dumper_test.cpp" ]
510
511  deps = [ ":ws_unittest_common" ]
512
513  external_deps = [
514    "c_utils:utils",
515    "hilog:libhilog",
516  ]
517}
518
519ohos_unittest("ws_session_display_power_controller_test") {
520  module_out_path = module_out_path
521
522  sources = [ "session_display_power_controller_test.cpp" ]
523
524  deps = [ ":ws_unittest_common" ]
525
526  external_deps = [
527    "ability_runtime:app_manager",
528    "c_utils:utils",
529    "hilog:libhilog",
530  ]
531}
532
533ohos_unittest("ws_fold_screen_state_machine_test") {
534  module_out_path = module_out_path
535
536  sources = [ "fold_screen_state_machine_test.cpp" ]
537
538  deps = [ ":ws_unittest_common" ]
539
540  external_deps = [
541    "ability_runtime:app_manager",
542    "c_utils:utils",
543    "hilog:libhilog",
544  ]
545}
546
547ohos_unittest("ws_single_display_sensor_fold_state_manager_test") {
548  module_out_path = module_out_path
549
550  sources = [ "single_display_sensor_fold_state_manager_test.cpp" ]
551
552  deps = [ ":ws_unittest_common" ]
553
554  external_deps = [
555    "c_utils:utils",
556    "hilog:libhilog",
557  ]
558}
559
560ohos_unittest("ws_single_display_sensor_pocket_fold_state_manager_test") {
561  module_out_path = module_out_path
562
563  sources = [ "single_display_sensor_pocket_fold_state_manager_test.cpp" ]
564
565  deps = [ ":ws_unittest_common" ]
566
567  external_deps = [
568    "ability_runtime:app_manager",
569    "c_utils:utils",
570    "hilog:libhilog",
571  ]
572}
573
574## Build ws_unittest_common.a {{{
575config("ws_unittest_common_public_config") {
576  include_dirs = [
577    "${window_base_path}/test/common/mock",
578
579    # for WMError Code
580    "${window_base_path}/dm/include",
581    "${window_base_path}/dmserver/include",
582    "${window_base_path}/interfaces/innerkits/dm",
583    "${window_base_path}/interfaces/innerkits/wm",
584    "${window_base_path}/window_scene/screen_session_manager_client/include",
585    "${window_base_path}/window_scene/screen_session_manager/include",
586    "${window_base_path}/window_scene/session_manager/include",
587    "${window_base_path}/window_scene/session_manager_service/include",
588    "${window_base_path}/window_scene/common/include",
589    "${window_base_path}/window_scene",
590    "${window_base_path}/window_scene/test",
591    "${window_base_path}/window_scene/intention_event/service/event_stage/include",
592    "//third_party/googletest/googlemock/include",
593
594    # for window_manager_interface
595    "${window_base_path}/wmserver/include",
596    "${window_base_path}/wmserver/include/zidl",
597    "${graphic_base_path}/graphic_2d/rosen/modules/animation/window_animation/include",
598    "${multimodalinput_path}/input/interfaces/native/innerkits/event/include",
599    "${multimodalinput_path}/input/util/common/include",
600    "${ability_runtime_inner_api_path}/ability_manager/include",
601    "${window_base_path}/wm/include",
602    "${window_base_path}/wm/include/zidl",
603
604    # for session
605    "${window_base_path}/window_scene/session/container/include/zidl",
606
607    # for session_manager
608    "${multimodalinput_path}/input/interfaces/native/innerkits/event/include",
609    "${window_base_path}/window_scene/interfaces/include",
610    "${resourceschedule_path}/ffrt/interfaces/kits",
611    "${ability_runtime_inner_api_path}/ability_manager/include",
612    "${ability_runtime_inner_api_path}/session_handler/include",
613
614    "${window_base_path}/wm/include",
615    "${window_base_path}/wm/include/zidl",
616
617    # for window_manager_hilog
618    "${window_base_path}/utils/include",
619
620    "${accessibility_path}/interfaces/innerkits/common/include/",
621    "${accessibility_path}/common/interface/include/parcel/",
622  ]
623}
624
625ohos_static_library("ws_unittest_common") {
626  visibility = [ ":*" ]
627  testonly = true
628
629  public_configs = [
630    ":ws_unittest_common_public_config",
631    "${window_base_path}/resources/config/build:coverage_flags",
632    "${window_base_path}/resources/config/build:testcase_flags",
633  ]
634
635  deps = [
636    "${window_base_path}/dm:libdm",
637    "${window_base_path}/utils:libwmutil",
638    "${window_base_path}/utils:libwmutil_base",
639    "${window_base_path}/window_scene/common:window_scene_common",
640    "${window_base_path}/window_scene/intention_event/service:intention_event_anr_manager",
641    "${window_base_path}/window_scene/screen_session_manager:screen_session_manager",
642    "${window_base_path}/window_scene/screen_session_manager_client:screen_session_manager_client",
643    "${window_base_path}/window_scene/session:scene_session",
644    "${window_base_path}/window_scene/session:screen_session",
645    "${window_base_path}/window_scene/session_manager:scene_session_manager",
646    "${window_base_path}/window_scene/session_manager:session_manager",
647    "${window_base_path}/window_scene/session_manager:session_manager_lite",
648    "${window_base_path}/wm:libwm",
649    "//third_party/googletest:gmock",
650    "//third_party/googletest:gtest_main",
651    "//third_party/libxml2:libxml2",
652  ]
653
654  public_deps = [
655    "${arkui_path}/napi:ace_napi",
656    "${graphic_base_path}/graphic_2d/rosen/modules/render_service_client:librender_service_client",
657    "${window_base_path}/utils:libwmutil",
658    "${window_base_path}/utils:libwmutil_base",
659  ]
660
661  external_deps = [
662    "ability_base:configuration",
663    "accessibility:accessibility_common",
664    "accessibility:accessibility_interface",
665    "c_utils:utils",
666    "hilog:libhilog",
667    "input:libmmi-client",
668    "ipc:ipc_single",
669  ]
670
671  public_external_deps = [
672    "ability_base:session_info",
673    "ability_base:want",
674  ]
675  defines = []
676  if (defined(global_parts_info) && defined(global_parts_info.sensors_sensor)) {
677    external_deps += [ "sensor:sensor_interface_native" ]
678    defines += [ "SENSOR_ENABLE" ]
679  }
680
681  part_name = "window_manager"
682  subsystem_name = "window"
683}
684## Build ws_unittest_common.a }}}
685