[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 1 | # 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 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 5 | import("//build/config/nacl/config.gni") |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 6 | import("//testing/test.gni") |
ochang | cc11d0e | 2016-04-26 19:58:26 | [diff] [blame] | 7 | import("//tools/ipc_fuzzer/ipc_fuzzer.gni") |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 8 | |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 9 | component("ipc") { |
| 10 | sources = [ |
erikchen | de9412b8 | 2015-07-27 18:26:14 | [diff] [blame] | 11 | "attachment_broker.cc", |
erikchen | 151b2f9 | 2015-06-16 20:20:51 | [diff] [blame] | 12 | "attachment_broker.h", |
erikchen | eece6c3 | 2015-07-07 22:13:11 | [diff] [blame] | 13 | "attachment_broker_messages.h", |
erikchen | 484c0084 | 2015-07-28 23:25:44 | [diff] [blame] | 14 | "attachment_broker_privileged.cc", |
| 15 | "attachment_broker_privileged.h", |
erikchen | b3481e2 | 2015-10-06 19:59:39 | [diff] [blame] | 16 | "attachment_broker_privileged_mac.cc", |
| 17 | "attachment_broker_privileged_mac.h", |
erikchen | c04ab34c | 2015-07-27 20:28:20 | [diff] [blame] | 18 | "attachment_broker_privileged_win.cc", |
| 19 | "attachment_broker_privileged_win.h", |
erikchen | 484c0084 | 2015-07-28 23:25:44 | [diff] [blame] | 20 | "attachment_broker_unprivileged.cc", |
| 21 | "attachment_broker_unprivileged.h", |
erikchen | b3481e2 | 2015-10-06 19:59:39 | [diff] [blame] | 22 | "attachment_broker_unprivileged_mac.cc", |
| 23 | "attachment_broker_unprivileged_mac.h", |
erikchen | 484c0084 | 2015-07-28 23:25:44 | [diff] [blame] | 24 | "attachment_broker_unprivileged_win.cc", |
| 25 | "attachment_broker_unprivileged_win.h", |
erikchen | 151b2f9 | 2015-06-16 20:20:51 | [diff] [blame] | 26 | "brokerable_attachment.cc", |
| 27 | "brokerable_attachment.h", |
erikchen | 3ee5d55e3 | 2015-10-09 23:20:49 | [diff] [blame] | 28 | "brokerable_attachment_mac.cc", |
erikchen | a5085cda | 2015-09-15 17:26:27 | [diff] [blame] | 29 | "brokerable_attachment_win.cc", |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 30 | "export_template.h", |
erikchen | eece6c3 | 2015-07-07 22:13:11 | [diff] [blame] | 31 | "handle_attachment_win.cc", |
erikchen | 151b2f9 | 2015-06-16 20:20:51 | [diff] [blame] | 32 | "handle_attachment_win.h", |
erikchen | 959039d | 2015-08-11 21:17:47 | [diff] [blame] | 33 | "handle_win.cc", |
| 34 | "handle_win.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 35 | "ipc_channel.cc", |
| 36 | "ipc_channel.h", |
scottmg | 7c7296f4 | 2015-02-28 02:23:09 | [diff] [blame] | 37 | "ipc_channel_common.cc", |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 38 | "ipc_channel_factory.cc", |
| 39 | "ipc_channel_factory.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 40 | "ipc_channel_handle.h", |
| 41 | "ipc_channel_nacl.cc", |
| 42 | "ipc_channel_nacl.h", |
| 43 | "ipc_channel_posix.cc", |
| 44 | "ipc_channel_posix.h", |
| 45 | "ipc_channel_proxy.cc", |
| 46 | "ipc_channel_proxy.h", |
| 47 | "ipc_channel_reader.cc", |
| 48 | "ipc_channel_reader.h", |
| 49 | "ipc_channel_win.cc", |
| 50 | "ipc_channel_win.h", |
| 51 | "ipc_descriptors.h", |
erikchen | a09b9be7 | 2015-08-10 19:22:33 | [diff] [blame] | 52 | "ipc_endpoint.cc", |
| 53 | "ipc_endpoint.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 54 | "ipc_export.h", |
erikchen | eece6c3 | 2015-07-07 22:13:11 | [diff] [blame] | 55 | "ipc_handle_win.cc", |
| 56 | "ipc_handle_win.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 57 | "ipc_listener.h", |
| 58 | "ipc_logging.cc", |
| 59 | "ipc_logging.h", |
| 60 | "ipc_message.cc", |
| 61 | "ipc_message.h", |
morrita | 98b7aaa | 2015-01-26 22:42:54 | [diff] [blame] | 62 | "ipc_message_attachment.cc", |
| 63 | "ipc_message_attachment.h", |
morrita | 4b5c28e2 | 2015-01-14 21:17:06 | [diff] [blame] | 64 | "ipc_message_attachment_set.cc", |
| 65 | "ipc_message_attachment_set.h", |
erikchen | eece6c3 | 2015-07-07 22:13:11 | [diff] [blame] | 66 | "ipc_message_generator.cc", |
| 67 | "ipc_message_generator.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 68 | "ipc_message_macros.h", |
| 69 | "ipc_message_start.h", |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 70 | "ipc_message_templates.h", |
| 71 | "ipc_message_templates_impl.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 72 | "ipc_message_utils.cc", |
| 73 | "ipc_message_utils.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 74 | "ipc_platform_file.cc", |
| 75 | "ipc_platform_file.h", |
morrita | 1aa788c | 2015-01-31 05:45:42 | [diff] [blame] | 76 | "ipc_platform_file_attachment_posix.cc", |
| 77 | "ipc_platform_file_attachment_posix.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 78 | "ipc_sender.h", |
| 79 | "ipc_switches.cc", |
| 80 | "ipc_switches.h", |
| 81 | "ipc_sync_channel.cc", |
| 82 | "ipc_sync_channel.h", |
| 83 | "ipc_sync_message.cc", |
| 84 | "ipc_sync_message.h", |
| 85 | "ipc_sync_message_filter.cc", |
| 86 | "ipc_sync_message_filter.h", |
erikchen | 1c1e665 | 2015-10-01 18:51:32 | [diff] [blame] | 87 | "mach_port_attachment_mac.cc", |
| 88 | "mach_port_attachment_mac.h", |
| 89 | "mach_port_mac.cc", |
| 90 | "mach_port_mac.h", |
[email protected] | 7412204 | 2014-04-25 00:07:30 | [diff] [blame] | 91 | "message_filter.cc", |
| 92 | "message_filter.h", |
| 93 | "message_filter_router.cc", |
| 94 | "message_filter_router.h", |
markdittmer | 638a149 | 2016-02-19 01:11:50 | [diff] [blame] | 95 | "message_router.cc", |
| 96 | "message_router.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 97 | "param_traits_log_macros.h", |
| 98 | "param_traits_macros.h", |
| 99 | "param_traits_read_macros.h", |
| 100 | "param_traits_write_macros.h", |
erikchen | 87351da | 2015-09-15 19:11:09 | [diff] [blame] | 101 | "placeholder_brokerable_attachment.cc", |
| 102 | "placeholder_brokerable_attachment.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 103 | "struct_constructor_macros.h", |
| 104 | "struct_destructor_macros.h", |
| 105 | "unix_domain_socket_util.cc", |
| 106 | "unix_domain_socket_util.h", |
| 107 | ] |
| 108 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 109 | if (is_nacl && !is_nacl_nonsfi) { |
dpranke | 6065cf7 | 2015-02-26 03:30:58 | [diff] [blame] | 110 | sources -= [ |
| 111 | "ipc_channel.cc", |
| 112 | "ipc_channel_posix.cc", |
| 113 | "unix_domain_socket_util.cc", |
| 114 | ] |
| 115 | } else { |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 116 | sources -= [ |
| 117 | "ipc_channel_nacl.cc", |
| 118 | "ipc_channel_nacl.h", |
| 119 | ] |
[email protected] | 517d528 | 2014-04-02 17:03:30 | [diff] [blame] | 120 | } |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 121 | |
eugenebut | c5e0329 | 2016-05-13 21:48:03 | [diff] [blame] | 122 | if (is_win || is_nacl_nonsfi) { |
scottmg | 34fb7e5 | 2014-12-03 23:27:24 | [diff] [blame] | 123 | sources -= [ "unix_domain_socket_util.cc" ] |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | defines = [ "IPC_IMPLEMENTATION" ] |
| 127 | |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 128 | public_deps = [ |
| 129 | ":param_traits", |
| 130 | ] |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 131 | deps = [ |
| 132 | "//base", |
scottmg | 34fb7e5 | 2014-12-03 23:27:24 | [diff] [blame] | 133 | |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 134 | # TODO(viettrungluu): Needed for base/lazy_instance.h, which is suspect. |
| 135 | "//base/third_party/dynamic_annotations", |
| 136 | ] |
Sergey Ulanov | 384a29c9 | 2015-09-14 17:11:35 | [diff] [blame] | 137 | |
erikchen | 3ee5d55e3 | 2015-10-09 23:20:49 | [diff] [blame] | 138 | if (is_win || is_mac) { |
| 139 | # On Windows HandleAttachmentWin needs to generate random IDs. |
| 140 | # On Mac MachPortAttachmentMac needs to generate random IDs. |
Sergey Ulanov | 384a29c9 | 2015-09-14 17:11:35 | [diff] [blame] | 141 | deps += [ "//crypto" ] |
| 142 | } |
ochang | cc11d0e | 2016-04-26 19:58:26 | [diff] [blame] | 143 | |
| 144 | if (enable_ipc_fuzzer) { |
| 145 | public_configs = [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ] |
| 146 | } |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 147 | } |
| 148 | |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 149 | # This is provided as a separate target so other targets can provide param |
| 150 | # traits implementations without necessarily linking to all of IPC. |
| 151 | source_set("param_traits") { |
| 152 | public = [ |
| 153 | "ipc_param_traits.h", |
| 154 | ] |
| 155 | } |
| 156 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame^] | 157 | if (!is_ios) { |
| 158 | test("ipc_tests") { |
| 159 | sources = [ |
| 160 | "attachment_broker_mac_unittest.cc", |
| 161 | "attachment_broker_privileged_mac_unittest.cc", |
| 162 | "attachment_broker_privileged_win_unittest.cc", |
| 163 | "ipc_channel_posix_unittest.cc", |
| 164 | "ipc_channel_proxy_unittest.cc", |
| 165 | "ipc_channel_reader_unittest.cc", |
| 166 | "ipc_fuzzing_tests.cc", |
| 167 | "ipc_message_attachment_set_posix_unittest.cc", |
| 168 | "ipc_message_unittest.cc", |
| 169 | "ipc_message_utils_unittest.cc", |
| 170 | "ipc_sync_channel_unittest.cc", |
| 171 | "ipc_sync_message_unittest.cc", |
| 172 | "ipc_sync_message_unittest.h", |
| 173 | "ipc_test_message_generator.cc", |
| 174 | "ipc_test_message_generator.h", |
| 175 | "ipc_test_messages.h", |
| 176 | "run_all_unittests.cc", |
| 177 | "sync_socket_unittest.cc", |
| 178 | ] |
pkotwicz | a553a3b | 2015-10-16 22:29:46 | [diff] [blame] | 179 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame^] | 180 | if (!is_win && !is_ios) { |
| 181 | sources += [ "unix_domain_socket_util_unittest.cc" ] |
| 182 | } |
| 183 | |
| 184 | if (!is_android) { |
| 185 | sources += [ "ipc_channel_unittest.cc" ] |
| 186 | } |
| 187 | |
| 188 | if (!is_ios) { |
| 189 | sources += [ "ipc_send_fds_test.cc" ] |
| 190 | } |
| 191 | |
| 192 | # 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 | #} |
| 196 | |
| 197 | deps = [ |
| 198 | ":ipc", |
| 199 | ":test_support", |
| 200 | "//base", |
| 201 | "//base:i18n", |
| 202 | "//base/test:test_support", |
| 203 | "//crypto", |
| 204 | "//testing/gtest", |
| 205 | ] |
| 206 | |
| 207 | if (is_mac) { |
| 208 | deps += [ "//sandbox/mac:seatbelt" ] |
| 209 | } |
dpranke | 177c1e2 | 2015-07-22 23:07:43 | [diff] [blame] | 210 | } |
| 211 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame^] | 212 | test("ipc_perftests") { |
| 213 | sources = [ |
| 214 | "ipc_perftests.cc", |
| 215 | ] |
| 216 | |
| 217 | # TODO(brettw) hook up Android testing. |
| 218 | #if (is_android && gtest_target_type == "shared_library") { |
| 219 | # deps += "/testing/android/native_test.gyp:native_testNative_code" |
| 220 | #} |
| 221 | |
| 222 | deps = [ |
| 223 | ":ipc", |
| 224 | ":test_support", |
| 225 | "//base", |
| 226 | "//base:i18n", |
| 227 | "//base/test:test_support", |
| 228 | "//base/test:test_support_perf", |
| 229 | "//testing/gtest", |
| 230 | ] |
brettw | a59908d2 | 2016-01-21 19:16:48 | [diff] [blame] | 231 | } |
| 232 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame^] | 233 | source_set("test_support") { |
| 234 | testonly = true |
| 235 | sources = [ |
| 236 | "ipc_multiprocess_test.cc", |
| 237 | "ipc_multiprocess_test.h", |
| 238 | "ipc_perftest_support.cc", |
| 239 | "ipc_perftest_support.h", |
| 240 | "ipc_security_test_util.cc", |
| 241 | "ipc_security_test_util.h", |
| 242 | "ipc_test_base.cc", |
| 243 | "ipc_test_base.h", |
| 244 | "ipc_test_channel_listener.cc", |
| 245 | "ipc_test_channel_listener.h", |
| 246 | "ipc_test_sink.cc", |
| 247 | "ipc_test_sink.h", |
| 248 | "test_util_mac.cc", |
| 249 | "test_util_mac.h", |
| 250 | ] |
| 251 | public_deps = [ |
| 252 | ":ipc", |
| 253 | ] |
| 254 | deps = [ |
| 255 | "//base", |
| 256 | "//base/test:test_support", |
| 257 | "//testing/gtest", |
| 258 | ] |
kerrnel | dc059fe | 2016-04-12 16:39:06 | [diff] [blame] | 259 | } |
pkotwicz | a553a3b | 2015-10-16 22:29:46 | [diff] [blame] | 260 | } |