1# Copyright 2014 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 5import("//build/config/nacl/config.gni") 6import("//testing/test.gni") 7import("../../../mojo/public/tools/bindings/mojom.gni") 8 9if (is_android) { 10 import("//build/config/android/config.gni") 11 import("//build/config/android/rules.gni") 12} 13 14component("system") { 15 output_name = "mojo_system_impl" 16 17 sources = [ 18 "atomic_flag.h", 19 "awakable.h", 20 "awakable_list.cc", 21 "awakable_list.h", 22 "broker.h", 23 "broker_host.h", 24 "broker_host_posix.cc", 25 "broker_posix.cc", 26 "channel.cc", 27 "channel.h", 28 "channel_posix.cc", 29 "channel_win.cc", 30 "configuration.cc", 31 "configuration.h", 32 "core.cc", 33 "core.h", 34 "data_pipe_consumer_dispatcher.cc", 35 "data_pipe_consumer_dispatcher.h", 36 "data_pipe_control_message.cc", 37 "data_pipe_control_message.h", 38 "data_pipe_producer_dispatcher.cc", 39 "data_pipe_producer_dispatcher.h", 40 "dispatcher.cc", 41 "dispatcher.h", 42 "handle_signals_state.h", 43 "handle_table.cc", 44 "handle_table.h", 45 "mapping_table.cc", 46 "mapping_table.h", 47 "message_for_transit.cc", 48 "message_for_transit.h", 49 "message_pipe_dispatcher.cc", 50 "message_pipe_dispatcher.h", 51 "node_channel.cc", 52 "node_channel.h", 53 "node_controller.cc", 54 "node_controller.h", 55 "options_validation.h", 56 "platform_handle_dispatcher.cc", 57 "platform_handle_dispatcher.h", 58 "ports_message.cc", 59 "ports_message.h", 60 "request_context.cc", 61 "request_context.h", 62 "shared_buffer_dispatcher.cc", 63 "shared_buffer_dispatcher.h", 64 "wait_set_dispatcher.cc", 65 "wait_set_dispatcher.h", 66 "waiter.cc", 67 "waiter.h", 68 "watcher.cc", 69 "watcher.h", 70 "watcher_set.cc", 71 "watcher_set.h", 72 ] 73 74 defines = [ "MOJO_SYSTEM_IMPL_IMPLEMENTATION" ] 75 76 public_deps = [ 77 "//mojo/edk/embedder", 78 "//mojo/edk/embedder:delegates", 79 "//mojo/edk/embedder:platform", 80 "//mojo/edk/system/ports", 81 "//mojo/public/c/system", 82 "//mojo/public/cpp/system", 83 ] 84 85 deps = [ 86 "//base", 87 ] 88 89 if (!is_nacl) { 90 deps += [ "//crypto" ] 91 } 92 93 if (is_win) { 94 cflags = [ "/wd4324" ] # Structure was padded due to __declspec(align()), 95 # which is uninteresting. 96 } 97 98 if (is_mac && !is_ios) { 99 sources += [ 100 "mach_port_relay.cc", 101 "mach_port_relay.h", 102 ] 103 } 104 105 if (is_nacl && !is_nacl_nonsfi) { 106 sources -= [ 107 "broker_host_posix.cc", 108 "broker_posix.cc", 109 "channel_posix.cc", 110 ] 111 } 112 113 # Use target_os == "chromeos" instead of is_chromeos because we need to 114 # build NaCl targets (i.e. IRT) for ChromeOS the same as the rest of ChromeOS. 115 if (is_android || target_os == "chromeos") { 116 defines += [ "MOJO_EDK_LEGACY_PROTOCOL" ] 117 } 118 119 allow_circular_includes_from = [ "//mojo/edk/embedder" ] 120} 121 122group("tests") { 123 testonly = true 124 deps = [ 125 ":mojo_system_unittests", 126 ] 127 128 if (!is_ios) { 129 deps += [ ":mojo_message_pipe_perftests" ] 130 } 131} 132 133source_set("test_utils") { 134 testonly = true 135 136 sources = [ 137 "test_utils.cc", 138 "test_utils.h", 139 ] 140 141 public_deps = [ 142 "//mojo/public/c/system", 143 "//mojo/public/cpp/system", 144 ] 145 146 deps = [ 147 "//base", 148 "//base/test:test_support", 149 "//mojo/edk/test:test_support", 150 "//testing/gtest:gtest", 151 ] 152} 153 154test("mojo_system_unittests") { 155 sources = [ 156 "awakable_list_unittest.cc", 157 "core_test_base.cc", 158 "core_test_base.h", 159 "core_unittest.cc", 160 "message_pipe_unittest.cc", 161 "options_validation_unittest.cc", 162 "platform_handle_dispatcher_unittest.cc", 163 "shared_buffer_dispatcher_unittest.cc", 164 "shared_buffer_unittest.cc", 165 "wait_set_dispatcher_unittest.cc", 166 "waiter_test_utils.cc", 167 "waiter_test_utils.h", 168 "waiter_unittest.cc", 169 "watch_unittest.cc", 170 ] 171 172 if (!is_ios) { 173 sources += [ 174 "data_pipe_unittest.cc", 175 "multiprocess_message_pipe_unittest.cc", 176 "platform_wrapper_unittest.cc", 177 ] 178 } 179 180 deps = [ 181 ":test_utils", 182 "//base", 183 "//base/test:test_support", 184 "//mojo/edk/embedder:embedder_unittests", 185 "//mojo/edk/system", 186 "//mojo/edk/system/ports:tests", 187 "//mojo/edk/test:run_all_unittests", 188 "//mojo/edk/test:test_support", 189 "//testing/gtest", 190 ] 191 192 allow_circular_includes_from = [ "//mojo/edk/embedder:embedder_unittests" ] 193} 194 195if (!is_ios) { 196 test("mojo_message_pipe_perftests") { 197 sources = [ 198 "message_pipe_perftest.cc", 199 ] 200 201 deps = [ 202 ":test_utils", 203 "//base", 204 "//base/test:test_support", 205 "//mojo/edk/system", 206 "//mojo/edk/test:run_all_perftests", 207 "//mojo/edk/test:test_support", 208 "//testing/gtest", 209 ] 210 } 211} 212