blob: 9964e590a4616f27ffe6e3affe9826bf67bbab42 [file] [log] [blame]
[email protected]7603bbd12013-08-13 17:33:371# Copyright (c) 2012 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
phosek636bceb32015-10-27 03:36:485import("//build/config/nacl/config.gni")
qsrfb5251d12015-01-21 15:57:226import("//testing/test.gni")
ochangcc11d0e2016-04-26 19:58:267import("//tools/ipc_fuzzer/ipc_fuzzer.gni")
qsrfb5251d12015-01-21 15:57:228
sdefresne8e7dcd42016-04-19 17:41:209assert(!is_ios)
10
[email protected]7603bbd12013-08-13 17:33:3711component("ipc") {
12 sources = [
erikchende9412b82015-07-27 18:26:1413 "attachment_broker.cc",
erikchen151b2f92015-06-16 20:20:5114 "attachment_broker.h",
erikcheneece6c32015-07-07 22:13:1115 "attachment_broker_messages.h",
erikchen484c00842015-07-28 23:25:4416 "attachment_broker_privileged.cc",
17 "attachment_broker_privileged.h",
erikchenb3481e22015-10-06 19:59:3918 "attachment_broker_privileged_mac.cc",
19 "attachment_broker_privileged_mac.h",
erikchenc04ab34c2015-07-27 20:28:2020 "attachment_broker_privileged_win.cc",
21 "attachment_broker_privileged_win.h",
erikchen484c00842015-07-28 23:25:4422 "attachment_broker_unprivileged.cc",
23 "attachment_broker_unprivileged.h",
erikchenb3481e22015-10-06 19:59:3924 "attachment_broker_unprivileged_mac.cc",
25 "attachment_broker_unprivileged_mac.h",
erikchen484c00842015-07-28 23:25:4426 "attachment_broker_unprivileged_win.cc",
27 "attachment_broker_unprivileged_win.h",
erikchen151b2f92015-06-16 20:20:5128 "brokerable_attachment.cc",
29 "brokerable_attachment.h",
erikchen3ee5d55e32015-10-09 23:20:4930 "brokerable_attachment_mac.cc",
erikchena5085cda2015-09-15 17:26:2731 "brokerable_attachment_win.cc",
mdempsky8a519042016-02-09 05:41:4732 "export_template.h",
erikcheneece6c32015-07-07 22:13:1133 "handle_attachment_win.cc",
erikchen151b2f92015-06-16 20:20:5134 "handle_attachment_win.h",
erikchen959039d2015-08-11 21:17:4735 "handle_win.cc",
36 "handle_win.h",
[email protected]7603bbd12013-08-13 17:33:3737 "ipc_channel.cc",
38 "ipc_channel.h",
scottmg7c7296f42015-02-28 02:23:0939 "ipc_channel_common.cc",
[email protected]64860882014-08-04 23:44:1740 "ipc_channel_factory.cc",
41 "ipc_channel_factory.h",
[email protected]7603bbd12013-08-13 17:33:3742 "ipc_channel_handle.h",
43 "ipc_channel_nacl.cc",
44 "ipc_channel_nacl.h",
45 "ipc_channel_posix.cc",
46 "ipc_channel_posix.h",
47 "ipc_channel_proxy.cc",
48 "ipc_channel_proxy.h",
49 "ipc_channel_reader.cc",
50 "ipc_channel_reader.h",
51 "ipc_channel_win.cc",
52 "ipc_channel_win.h",
53 "ipc_descriptors.h",
erikchena09b9be72015-08-10 19:22:3354 "ipc_endpoint.cc",
55 "ipc_endpoint.h",
[email protected]7603bbd12013-08-13 17:33:3756 "ipc_export.h",
erikcheneece6c32015-07-07 22:13:1157 "ipc_handle_win.cc",
58 "ipc_handle_win.h",
[email protected]7603bbd12013-08-13 17:33:3759 "ipc_listener.h",
60 "ipc_logging.cc",
61 "ipc_logging.h",
62 "ipc_message.cc",
63 "ipc_message.h",
morrita98b7aaa2015-01-26 22:42:5464 "ipc_message_attachment.cc",
65 "ipc_message_attachment.h",
morrita4b5c28e22015-01-14 21:17:0666 "ipc_message_attachment_set.cc",
67 "ipc_message_attachment_set.h",
erikcheneece6c32015-07-07 22:13:1168 "ipc_message_generator.cc",
69 "ipc_message_generator.h",
[email protected]7603bbd12013-08-13 17:33:3770 "ipc_message_macros.h",
71 "ipc_message_start.h",
mdempsky8a519042016-02-09 05:41:4772 "ipc_message_templates.h",
73 "ipc_message_templates_impl.h",
[email protected]7603bbd12013-08-13 17:33:3774 "ipc_message_utils.cc",
75 "ipc_message_utils.h",
[email protected]7603bbd12013-08-13 17:33:3776 "ipc_platform_file.cc",
77 "ipc_platform_file.h",
morrita1aa788c2015-01-31 05:45:4278 "ipc_platform_file_attachment_posix.cc",
79 "ipc_platform_file_attachment_posix.h",
[email protected]7603bbd12013-08-13 17:33:3780 "ipc_sender.h",
81 "ipc_switches.cc",
82 "ipc_switches.h",
83 "ipc_sync_channel.cc",
84 "ipc_sync_channel.h",
85 "ipc_sync_message.cc",
86 "ipc_sync_message.h",
87 "ipc_sync_message_filter.cc",
88 "ipc_sync_message_filter.h",
erikchen1c1e6652015-10-01 18:51:3289 "mach_port_attachment_mac.cc",
90 "mach_port_attachment_mac.h",
91 "mach_port_mac.cc",
92 "mach_port_mac.h",
[email protected]74122042014-04-25 00:07:3093 "message_filter.cc",
94 "message_filter.h",
95 "message_filter_router.cc",
96 "message_filter_router.h",
markdittmer638a1492016-02-19 01:11:5097 "message_router.cc",
98 "message_router.h",
[email protected]7603bbd12013-08-13 17:33:3799 "param_traits_log_macros.h",
100 "param_traits_macros.h",
101 "param_traits_read_macros.h",
102 "param_traits_write_macros.h",
erikchen87351da2015-09-15 19:11:09103 "placeholder_brokerable_attachment.cc",
104 "placeholder_brokerable_attachment.h",
[email protected]7603bbd12013-08-13 17:33:37105 "struct_constructor_macros.h",
106 "struct_destructor_macros.h",
107 "unix_domain_socket_util.cc",
108 "unix_domain_socket_util.h",
109 ]
110
phosek636bceb32015-10-27 03:36:48111 if (is_nacl && !is_nacl_nonsfi) {
dpranke6065cf72015-02-26 03:30:58112 sources -= [
113 "ipc_channel.cc",
114 "ipc_channel_posix.cc",
115 "unix_domain_socket_util.cc",
116 ]
117 } else {
[email protected]7603bbd12013-08-13 17:33:37118 sources -= [
119 "ipc_channel_nacl.cc",
120 "ipc_channel_nacl.h",
121 ]
[email protected]517d5282014-04-02 17:03:30122 }
[email protected]7603bbd12013-08-13 17:33:37123
phosek636bceb32015-10-27 03:36:48124 if (is_win || is_ios || is_nacl_nonsfi) {
scottmg34fb7e52014-12-03 23:27:24125 sources -= [ "unix_domain_socket_util.cc" ]
[email protected]7603bbd12013-08-13 17:33:37126 }
127
128 defines = [ "IPC_IMPLEMENTATION" ]
129
brettwb7f2c302015-12-08 01:29:21130 public_deps = [
131 ":param_traits",
132 ]
[email protected]7603bbd12013-08-13 17:33:37133 deps = [
134 "//base",
scottmg34fb7e52014-12-03 23:27:24135
[email protected]7603bbd12013-08-13 17:33:37136 # TODO(viettrungluu): Needed for base/lazy_instance.h, which is suspect.
137 "//base/third_party/dynamic_annotations",
138 ]
Sergey Ulanov384a29c92015-09-14 17:11:35139
erikchen3ee5d55e32015-10-09 23:20:49140 if (is_win || is_mac) {
141 # On Windows HandleAttachmentWin needs to generate random IDs.
142 # On Mac MachPortAttachmentMac needs to generate random IDs.
Sergey Ulanov384a29c92015-09-14 17:11:35143 deps += [ "//crypto" ]
144 }
ochangcc11d0e2016-04-26 19:58:26145
146 if (enable_ipc_fuzzer) {
147 public_configs = [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ]
148 }
[email protected]7603bbd12013-08-13 17:33:37149}
150
brettwb7f2c302015-12-08 01:29:21151# This is provided as a separate target so other targets can provide param
152# traits implementations without necessarily linking to all of IPC.
153source_set("param_traits") {
154 public = [
155 "ipc_param_traits.h",
156 ]
157}
158
pkotwicza553a3b2015-10-16 22:29:46159test("ipc_tests") {
160 sources = [
161 "attachment_broker_mac_unittest.cc",
162 "attachment_broker_privileged_mac_unittest.cc",
163 "attachment_broker_privileged_win_unittest.cc",
pkotwicza553a3b2015-10-16 22:29:46164 "ipc_channel_posix_unittest.cc",
165 "ipc_channel_proxy_unittest.cc",
166 "ipc_channel_reader_unittest.cc",
167 "ipc_channel_unittest.cc",
168 "ipc_fuzzing_tests.cc",
169 "ipc_message_attachment_set_posix_unittest.cc",
170 "ipc_message_unittest.cc",
171 "ipc_message_utils_unittest.cc",
172 "ipc_send_fds_test.cc",
173 "ipc_sync_channel_unittest.cc",
174 "ipc_sync_message_unittest.cc",
175 "ipc_sync_message_unittest.h",
176 "ipc_test_message_generator.cc",
177 "ipc_test_message_generator.h",
178 "ipc_test_messages.h",
179 "sync_socket_unittest.cc",
180 "unix_domain_socket_util_unittest.cc",
181 ]
182
183 if (is_win || is_ios) {
184 sources -= [ "unix_domain_socket_util_unittest.cc" ]
dpranke177c1e22015-07-22 23:07:43185 }
186
brettwa59908d22016-01-21 19:16:48187 if (is_android) {
188 # These multiprocess tests don't work on Android.
189 sources -= [ "ipc_channel_unittest.cc" ]
190 }
191
pkotwicza553a3b2015-10-16 22:29:46192 # TODO(brettw) hook up Android testing.
193 #if (is_android && gtest_target_type == "shared_library") {
194 # deps += "/testing/android/native_test.gyp:native_testNative_code"
195 #}
[email protected]7603bbd12013-08-13 17:33:37196
pkotwicza553a3b2015-10-16 22:29:46197 deps = [
198 ":ipc",
199 ":test_support",
200 "//base",
201 "//base:i18n",
202 "//base/test:run_all_unittests",
203 "//base/test:test_support",
204 "//crypto",
205 "//testing/gtest",
206 ]
kerrneldc059fe2016-04-12 16:39:06207
208 if (is_mac) {
209 deps += [ "//sandbox/mac:seatbelt" ]
210 }
pkotwicza553a3b2015-10-16 22:29:46211}
[email protected]5a8d5162014-04-12 01:19:16212
pkotwicza553a3b2015-10-16 22:29:46213test("ipc_perftests") {
214 sources = [
215 "ipc_perftests.cc",
216 ]
[email protected]5a8d5162014-04-12 01:19:16217
pkotwicza553a3b2015-10-16 22:29:46218 # TODO(brettw) hook up Android testing.
219 #if (is_android && gtest_target_type == "shared_library") {
220 # deps += "/testing/android/native_test.gyp:native_testNative_code"
221 #}
[email protected]517d5282014-04-02 17:03:30222
pkotwicza553a3b2015-10-16 22:29:46223 deps = [
224 ":ipc",
225 ":test_support",
226 "//base",
227 "//base:i18n",
228 "//base/test:test_support",
229 "//base/test:test_support_perf",
230 "//testing/gtest",
231 ]
[email protected]7603bbd12013-08-13 17:33:37232}
233
brettw298955fc2015-08-25 23:47:52234source_set("test_support") {
Brett Wilson0c8745a2014-09-08 22:59:49235 testonly = true
[email protected]7603bbd12013-08-13 17:33:37236 sources = [
237 "ipc_multiprocess_test.cc",
238 "ipc_multiprocess_test.h",
morrita373af03b2014-09-09 19:35:24239 "ipc_perftest_support.cc",
240 "ipc_perftest_support.h",
brettw013b729f2015-01-12 08:03:47241 "ipc_security_test_util.cc",
242 "ipc_security_test_util.h",
[email protected]64860882014-08-04 23:44:17243 "ipc_test_base.cc",
244 "ipc_test_base.h",
[email protected]64860882014-08-04 23:44:17245 "ipc_test_channel_listener.cc",
brettw013b729f2015-01-12 08:03:47246 "ipc_test_channel_listener.h",
247 "ipc_test_sink.cc",
248 "ipc_test_sink.h",
erikchen89d74232015-10-12 18:24:01249 "test_util_mac.cc",
250 "test_util_mac.h",
[email protected]7603bbd12013-08-13 17:33:37251 ]
brettwb7f2c302015-12-08 01:29:21252 public_deps = [
[email protected]7603bbd12013-08-13 17:33:37253 ":ipc",
brettwb7f2c302015-12-08 01:29:21254 ]
255 deps = [
[email protected]7603bbd12013-08-13 17:33:37256 "//base",
brettwe75311d2015-02-17 23:56:46257 "//base/test:test_support",
[email protected]23e197d2013-12-31 12:14:01258 "//testing/gtest",
[email protected]7603bbd12013-08-13 17:33:37259 ]
260}