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("//base/print/print_fwk/print.gni")
15import("//build/test.gni")
16
17module_output_path = "print_fwk/service_test"
18
19ohos_unittest("print_service_test") {
20  module_out_path = module_output_path
21  include_dirs = [
22    "mock",
23    "../fwk_inner_napi_test/mock",
24    "${print_path}/frameworks/innerkitsimpl/print_impl/include",
25    "${print_path}/frameworks/models/print_models/include",
26    "${print_path}/interfaces/kits/napi/print_napi/include",
27    "${print_path}/services/print_service/include",
28    "${print_utils_path}/include",
29    "//third_party/node/src",
30  ]
31
32  sanitize = {
33    cfi = true
34    cfi_cross_dso = true
35    debug = false
36    blocklist = "${print_path}/cfi_blocklist.txt"
37  }
38
39  sources = [
40    "print_bms_death_recipient_test.cpp",
41    "print_cups_attribute_test.cpp",
42    "print_security_guard_info_test.cpp",
43    "print_security_guard_manager_test.cpp",
44    "print_service_converter_test.cpp",
45    "print_service_helper_test.cpp",
46    "print_system_data_test.cpp",
47    "print_user_data_test.cpp",
48  ]
49
50  deps = [
51    "${print_path}/etc/init:printservice.rc",
52    "${print_path}/frameworks/innerkitsimpl/print_impl:print_client",
53    "${print_path}/frameworks/kits/extension:print_extension_framework",
54    "${print_path}/frameworks/kits/extension:print_extension_module",
55    "${print_path}/frameworks/models/print_models:print_models",
56    "${print_path}/interfaces/kits/jsnapi/print_extension:printextensionability_napi",
57    "${print_path}/interfaces/kits/jsnapi/print_extensionctx:printextensioncontext_napi",
58    "${print_path}/interfaces/kits/napi/print_napi:print_napi",
59    "${print_path}/profile:print_sa_profiles",
60    "${print_path}/services/print_service:print_service",
61    "//third_party/googletest:gmock_main",
62    "//third_party/jsoncpp:jsoncpp",
63  ]
64
65  if (cups_enable) {
66    include_dirs += [ "//third_party/cups/cups-2.4.0" ]
67    cflags_cc = [ "-DCUPS_ENABLE" ]
68    deps += [
69      "//third_party/cups:third_party_cups",
70      "//third_party/cups-filters:third_party_cupsfilters",
71    ]
72  }
73
74  if (ipp_over_usb_enable) {
75    include_dirs += [ "//third_party/cpp-httplib" ]
76    sources += [
77      "print_http_request_process_test.cpp",
78      "print_http_server_manager_test.cpp",
79      "print_ipp_over_usb_manager_test.cpp",
80      "print_usb_manager_test.cpp",
81    ]
82    cflags_cc += [ "-DCPPHTTPLIB_NO_EXCEPTIONS" ]
83    cflags_cc += [ "-DIPPOVERUSB_ENABLE" ]
84  }
85
86  external_deps = [
87    "ability_base:base",
88    "ability_base:want",
89    "ability_base:zuri",
90    "ability_runtime:ability_manager",
91    "ability_runtime:abilitykit_native",
92    "access_token:libaccesstoken_sdk",
93    "access_token:libnativetoken",
94    "access_token:libtoken_setproc",
95    "bundle_framework:appexecfwk_base",
96    "bundle_framework:appexecfwk_core",
97    "c_utils:utils",
98    "drivers_interface_usb:libusb_proxy_1.0",
99    "hilog:libhilog",
100    "ipc:ipc_core",
101    "napi:ace_napi",
102    "safwk:system_ability_fwk",
103    "samgr:samgr_proxy",
104    "usb_manager:usbsrv_client",
105  ]
106}
107
108ohos_unittest("scan_service_test") {
109  module_out_path = module_output_path
110  include_dirs = [
111    "mock",
112    "../fwk_inner_napi_test/mock",
113    "${print_path}/frameworks/innerkitsimpl/scan_impl/include",
114    "${print_path}/interfaces/kits/napi/scan_napi/include",
115    "${print_path}/services/scan_service/include",
116    "${print_utils_path}/include",
117    "//third_party/node/src",
118  ]
119
120  sources = [
121    "scan_callback_proxy_test.cpp",
122    "scan_mdns_service_test.cpp",
123    "scan_service_ability_test.cpp",
124    "scan_service_stub_test.cpp",
125  ]
126
127  deps = [
128    "${print_path}/etc/init:scanservice.rc",
129    "${print_path}/frameworks/innerkitsimpl/scan_impl:scan_client",
130    "${print_path}/interfaces/kits/napi/scan_napi:scan_napi",
131    "${print_path}/profile:scan_sa_profiles",
132    "${print_path}/services/scan_service:scan_service",
133    "//third_party/googletest:gmock_main",
134    "//third_party/jsoncpp:jsoncpp",
135  ]
136
137  external_deps = [
138    "ability_base:base",
139    "ability_base:want",
140    "ability_base:zuri",
141    "ability_runtime:ability_manager",
142    "ability_runtime:abilitykit_native",
143    "access_token:libaccesstoken_sdk",
144    "bundle_framework:appexecfwk_base",
145    "bundle_framework:appexecfwk_core",
146    "c_utils:utils",
147    "drivers_interface_usb:libusb_proxy_1.0",
148    "hilog:libhilog",
149    "ipc:ipc_core",
150    "napi:ace_napi",
151    "safwk:system_ability_fwk",
152    "samgr:samgr_proxy",
153    "usb_manager:usbsrv_client",
154  ]
155}
156
157group("unittest") {
158  testonly = true
159
160  deps = []
161
162  deps += [ ":print_service_test" ]
163  deps += [ ":scan_service_test" ]
164}
165