[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 | |
davidsz | 041528a | 2017-05-12 09:19:23 | [diff] [blame] | 5 | import("//build/buildflag_header.gni") |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 6 | import("//build/config/nacl/config.gni") |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 7 | import("//mojo/public/tools/bindings/mojom.gni") |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 8 | import("//testing/test.gni") |
ochang | cc11d0e | 2016-04-26 19:58:26 | [diff] [blame] | 9 | import("//tools/ipc_fuzzer/ipc_fuzzer.gni") |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 10 | |
davidsz | 041528a | 2017-05-12 09:19:23 | [diff] [blame] | 11 | declare_args() { |
| 12 | # Enabling debug builds automatically sets enable_ipc_logging to true. |
| 13 | enable_ipc_logging = is_debug |
| 14 | } |
| 15 | |
| 16 | buildflag_header("ipc_features") { |
| 17 | header = "ipc_features.h" |
| 18 | |
| 19 | flags = [ "IPC_MESSAGE_LOG_ENABLED=$enable_ipc_logging" ] |
| 20 | } |
| 21 | |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 22 | component("ipc") { |
| 23 | sources = [ |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 24 | "export_template.h", |
erikchen | eece6c3 | 2015-07-07 22:13:11 | [diff] [blame] | 25 | "handle_attachment_win.cc", |
erikchen | 151b2f9 | 2015-06-16 20:20:51 | [diff] [blame] | 26 | "handle_attachment_win.h", |
erikchen | 959039d | 2015-08-11 21:17:47 | [diff] [blame] | 27 | "handle_win.cc", |
| 28 | "handle_win.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 29 | "ipc_channel.cc", |
| 30 | "ipc_channel.h", |
scottmg | 7c7296f4 | 2015-02-28 02:23:09 | [diff] [blame] | 31 | "ipc_channel_common.cc", |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 32 | "ipc_channel_factory.cc", |
| 33 | "ipc_channel_factory.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 34 | "ipc_channel_handle.h", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 35 | "ipc_channel_mojo.cc", |
| 36 | "ipc_channel_mojo.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 37 | "ipc_channel_nacl.cc", |
| 38 | "ipc_channel_nacl.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 39 | "ipc_channel_proxy.cc", |
| 40 | "ipc_channel_proxy.h", |
| 41 | "ipc_channel_reader.cc", |
| 42 | "ipc_channel_reader.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 43 | "ipc_export.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 44 | "ipc_listener.h", |
| 45 | "ipc_logging.cc", |
| 46 | "ipc_logging.h", |
| 47 | "ipc_message.cc", |
| 48 | "ipc_message.h", |
morrita | 98b7aaa | 2015-01-26 22:42:54 | [diff] [blame] | 49 | "ipc_message_attachment.cc", |
| 50 | "ipc_message_attachment.h", |
morrita | 4b5c28e2 | 2015-01-14 21:17:06 | [diff] [blame] | 51 | "ipc_message_attachment_set.cc", |
| 52 | "ipc_message_attachment_set.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 53 | "ipc_message_macros.h", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 54 | "ipc_message_pipe_reader.cc", |
| 55 | "ipc_message_pipe_reader.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 56 | "ipc_message_start.h", |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 57 | "ipc_message_templates.h", |
| 58 | "ipc_message_templates_impl.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 59 | "ipc_message_utils.cc", |
| 60 | "ipc_message_utils.h", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 61 | "ipc_mojo_bootstrap.cc", |
| 62 | "ipc_mojo_bootstrap.h", |
| 63 | "ipc_mojo_handle_attachment.cc", |
| 64 | "ipc_mojo_handle_attachment.h", |
| 65 | "ipc_mojo_message_helper.cc", |
| 66 | "ipc_mojo_message_helper.h", |
| 67 | "ipc_mojo_param_traits.cc", |
| 68 | "ipc_mojo_param_traits.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 69 | "ipc_platform_file.cc", |
| 70 | "ipc_platform_file.h", |
morrita | 1aa788c | 2015-01-31 05:45:42 | [diff] [blame] | 71 | "ipc_platform_file_attachment_posix.cc", |
| 72 | "ipc_platform_file_attachment_posix.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 73 | "ipc_sender.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 74 | "ipc_sync_channel.cc", |
| 75 | "ipc_sync_channel.h", |
| 76 | "ipc_sync_message.cc", |
| 77 | "ipc_sync_message.h", |
| 78 | "ipc_sync_message_filter.cc", |
| 79 | "ipc_sync_message_filter.h", |
erikchen | 1c1e665 | 2015-10-01 18:51:32 | [diff] [blame] | 80 | "mach_port_attachment_mac.cc", |
| 81 | "mach_port_attachment_mac.h", |
| 82 | "mach_port_mac.cc", |
| 83 | "mach_port_mac.h", |
[email protected] | 7412204 | 2014-04-25 00:07:30 | [diff] [blame] | 84 | "message_filter.cc", |
| 85 | "message_filter.h", |
| 86 | "message_filter_router.cc", |
| 87 | "message_filter_router.h", |
markdittmer | 638a149 | 2016-02-19 01:11:50 | [diff] [blame] | 88 | "message_router.cc", |
| 89 | "message_router.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 90 | "param_traits_log_macros.h", |
| 91 | "param_traits_macros.h", |
| 92 | "param_traits_read_macros.h", |
| 93 | "param_traits_write_macros.h", |
| 94 | "struct_constructor_macros.h", |
| 95 | "struct_destructor_macros.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 96 | ] |
| 97 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 98 | if (is_nacl && !is_nacl_nonsfi) { |
sammc | cde36206 | 2016-11-23 02:33:57 | [diff] [blame] | 99 | sources -= [ "ipc_channel.cc" ] |
dpranke | 6065cf7 | 2015-02-26 03:30:58 | [diff] [blame] | 100 | } else { |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 101 | sources -= [ |
| 102 | "ipc_channel_nacl.cc", |
| 103 | "ipc_channel_nacl.h", |
| 104 | ] |
[email protected] | 517d528 | 2014-04-02 17:03:30 | [diff] [blame] | 105 | } |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 106 | |
Scott Graham | 3eebff0 | 2017-06-30 01:07:10 | [diff] [blame] | 107 | if (is_fuchsia) { |
| 108 | sources += [ |
| 109 | "handle_attachment_fuchsia.cc", |
| 110 | "handle_attachment_fuchsia.h", |
| 111 | "handle_fuchsia.cc", |
| 112 | "handle_fuchsia.h", |
| 113 | ] |
| 114 | } |
| 115 | |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 116 | defines = [ "IPC_IMPLEMENTATION" ] |
| 117 | |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 118 | public_deps = [ |
davidsz | 041528a | 2017-05-12 09:19:23 | [diff] [blame] | 119 | ":ipc_features", |
rockot | a628d0b | 2017-02-09 08:40:15 | [diff] [blame] | 120 | ":mojom", |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 121 | ":param_traits", |
leon.han | f870ab5 | 2016-07-14 15:03:48 | [diff] [blame] | 122 | "//mojo/public/cpp/bindings", |
rockot | 6d7be62 | 2016-06-15 18:25:19 | [diff] [blame] | 123 | "//mojo/public/cpp/system", |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 124 | ] |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 125 | deps = [ |
| 126 | "//base", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 127 | ] |
Sergey Ulanov | 384a29c9 | 2015-09-14 17:11:35 | [diff] [blame] | 128 | |
erikchen | 3ee5d55e3 | 2015-10-09 23:20:49 | [diff] [blame] | 129 | if (is_win || is_mac) { |
| 130 | # On Windows HandleAttachmentWin needs to generate random IDs. |
| 131 | # On Mac MachPortAttachmentMac needs to generate random IDs. |
Sergey Ulanov | 384a29c9 | 2015-09-14 17:11:35 | [diff] [blame] | 132 | deps += [ "//crypto" ] |
| 133 | } |
ochang | cc11d0e | 2016-04-26 19:58:26 | [diff] [blame] | 134 | |
| 135 | if (enable_ipc_fuzzer) { |
| 136 | public_configs = [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ] |
| 137 | } |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 138 | } |
| 139 | |
Ken Rockot | fe0424e7 | 2017-05-13 02:29:08 | [diff] [blame] | 140 | mojom_component("mojom") { |
| 141 | output_prefix = "ipc_mojom" |
| 142 | macro_prefix = "IPC_MOJOM" |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 143 | sources = [ |
| 144 | "ipc.mojom", |
| 145 | ] |
| 146 | } |
| 147 | |
rockot | 7c6bf95 | 2016-07-14 00:34:11 | [diff] [blame] | 148 | mojom("test_interfaces") { |
| 149 | testonly = true |
| 150 | sources = [ |
| 151 | "ipc_test.mojom", |
| 152 | ] |
Ken Rockot | 474df014 | 2017-07-12 13:28:56 | [diff] [blame^] | 153 | support_lazy_serialization = true |
rockot | 7c6bf95 | 2016-07-14 00:34:11 | [diff] [blame] | 154 | } |
| 155 | |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 156 | # This is provided as a separate target so other targets can provide param |
| 157 | # traits implementations without necessarily linking to all of IPC. |
| 158 | source_set("param_traits") { |
| 159 | public = [ |
| 160 | "ipc_param_traits.h", |
| 161 | ] |
| 162 | } |
| 163 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 164 | if (!is_ios) { |
rockot | 6d7be62 | 2016-06-15 18:25:19 | [diff] [blame] | 165 | source_set("run_all_unittests") { |
| 166 | testonly = true |
| 167 | |
| 168 | sources = [ |
| 169 | "run_all_unittests.cc", |
| 170 | ] |
| 171 | |
| 172 | deps = [ |
| 173 | "//base", |
| 174 | "//base/test:test_support", |
| 175 | "//mojo/edk/system", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 176 | "//mojo/edk/test:test_support", |
rockot | 6d7be62 | 2016-06-15 18:25:19 | [diff] [blame] | 177 | ] |
| 178 | } |
| 179 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 180 | test("ipc_tests") { |
| 181 | sources = [ |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 182 | "ipc_channel_mojo_unittest.cc", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 183 | "ipc_channel_proxy_unittest.cc", |
| 184 | "ipc_channel_reader_unittest.cc", |
| 185 | "ipc_fuzzing_tests.cc", |
| 186 | "ipc_message_attachment_set_posix_unittest.cc", |
| 187 | "ipc_message_unittest.cc", |
| 188 | "ipc_message_utils_unittest.cc", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 189 | "ipc_mojo_bootstrap_unittest.cc", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 190 | "ipc_sync_channel_unittest.cc", |
| 191 | "ipc_sync_message_unittest.cc", |
| 192 | "ipc_sync_message_unittest.h", |
| 193 | "ipc_test_message_generator.cc", |
| 194 | "ipc_test_message_generator.h", |
| 195 | "ipc_test_messages.h", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 196 | "sync_socket_unittest.cc", |
| 197 | ] |
pkotwicz | a553a3b | 2015-10-16 22:29:46 | [diff] [blame] | 198 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 199 | if (!is_ios) { |
| 200 | sources += [ "ipc_send_fds_test.cc" ] |
| 201 | } |
| 202 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 203 | deps = [ |
| 204 | ":ipc", |
rockot | 6d7be62 | 2016-06-15 18:25:19 | [diff] [blame] | 205 | ":run_all_unittests", |
rockot | 7c6bf95 | 2016-07-14 00:34:11 | [diff] [blame] | 206 | ":test_interfaces", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 207 | ":test_support", |
| 208 | "//base", |
| 209 | "//base:i18n", |
| 210 | "//base/test:test_support", |
| 211 | "//crypto", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 212 | "//mojo/edk/system", |
| 213 | "//mojo/edk/test:test_support", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 214 | "//testing/gtest", |
| 215 | ] |
| 216 | |
| 217 | if (is_mac) { |
| 218 | deps += [ "//sandbox/mac:seatbelt" ] |
| 219 | } |
Scott Graham | f4b38b4 | 2017-06-19 23:09:33 | [diff] [blame] | 220 | |
| 221 | if (is_fuchsia) { |
| 222 | sources -= [ |
| 223 | # No AF_UNIX domain sockets on Fuchsia. |
| 224 | "sync_socket_unittest.cc", |
| 225 | ] |
| 226 | } |
dpranke | 177c1e2 | 2015-07-22 23:07:43 | [diff] [blame] | 227 | } |
| 228 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 229 | test("ipc_perftests") { |
| 230 | sources = [ |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 231 | "ipc_mojo_perftest.cc", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 232 | "run_all_perftests.cc", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 233 | ] |
| 234 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 235 | deps = [ |
| 236 | ":ipc", |
jam | ca86c9e | 2017-01-06 19:55:57 | [diff] [blame] | 237 | ":test_interfaces", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 238 | ":test_support", |
| 239 | "//base", |
| 240 | "//base:i18n", |
| 241 | "//base/test:test_support", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 242 | "//mojo/edk/system", |
| 243 | "//mojo/edk/test:test_support", |
jam | ca86c9e | 2017-01-06 19:55:57 | [diff] [blame] | 244 | "//mojo/edk/test:test_support_impl", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 245 | "//testing/gtest", |
| 246 | ] |
brettw | a59908d2 | 2016-01-21 19:16:48 | [diff] [blame] | 247 | } |
| 248 | |
brettw | 3871f52 | 2016-07-14 22:08:34 | [diff] [blame] | 249 | static_library("test_support") { |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 250 | testonly = true |
| 251 | sources = [ |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 252 | "ipc_security_test_util.cc", |
| 253 | "ipc_security_test_util.h", |
| 254 | "ipc_test_base.cc", |
| 255 | "ipc_test_base.h", |
| 256 | "ipc_test_channel_listener.cc", |
| 257 | "ipc_test_channel_listener.h", |
| 258 | "ipc_test_sink.cc", |
| 259 | "ipc_test_sink.h", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 260 | ] |
| 261 | public_deps = [ |
| 262 | ":ipc", |
| 263 | ] |
| 264 | deps = [ |
| 265 | "//base", |
| 266 | "//base/test:test_support", |
sammc | 4bcc4ed6 | 2016-10-27 10:13:59 | [diff] [blame] | 267 | "//mojo/edk/test:test_support", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 268 | "//testing/gtest", |
| 269 | ] |
kerrnel | dc059fe | 2016-04-12 16:39:06 | [diff] [blame] | 270 | } |
pkotwicz | a553a3b | 2015-10-16 22:29:46 | [diff] [blame] | 271 | } |