Home | History | Annotate | Download | only in system
      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 
      5 import("//build/config/nacl/config.gni")
      6 import("//testing/test.gni")
      7 import("../../../mojo/public/tools/bindings/mojom.gni")
      8 
      9 if (is_android) {
     10   import("//build/config/android/config.gni")
     11   import("//build/config/android/rules.gni")
     12 }
     13 
     14 component("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.cc",
     24     "broker_host.h",
     25     "broker_posix.cc",
     26     "broker_win.cc",
     27     "channel.cc",
     28     "channel.h",
     29     "channel_posix.cc",
     30     "channel_win.cc",
     31     "configuration.cc",
     32     "configuration.h",
     33     "core.cc",
     34     "core.h",
     35     "data_pipe_consumer_dispatcher.cc",
     36     "data_pipe_consumer_dispatcher.h",
     37     "data_pipe_control_message.cc",
     38     "data_pipe_control_message.h",
     39     "data_pipe_producer_dispatcher.cc",
     40     "data_pipe_producer_dispatcher.h",
     41     "dispatcher.cc",
     42     "dispatcher.h",
     43     "handle_signals_state.h",
     44     "handle_table.cc",
     45     "handle_table.h",
     46     "mapping_table.cc",
     47     "mapping_table.h",
     48     "message_for_transit.cc",
     49     "message_for_transit.h",
     50     "message_pipe_dispatcher.cc",
     51     "message_pipe_dispatcher.h",
     52     "node_channel.cc",
     53     "node_channel.h",
     54     "node_controller.cc",
     55     "node_controller.h",
     56     "options_validation.h",
     57     "platform_handle_dispatcher.cc",
     58     "platform_handle_dispatcher.h",
     59     "ports_message.cc",
     60     "ports_message.h",
     61     "request_context.cc",
     62     "request_context.h",
     63     "shared_buffer_dispatcher.cc",
     64     "shared_buffer_dispatcher.h",
     65     "wait_set_dispatcher.cc",
     66     "wait_set_dispatcher.h",
     67     "waiter.cc",
     68     "waiter.h",
     69     "watcher.cc",
     70     "watcher.h",
     71     "watcher_set.cc",
     72     "watcher_set.h",
     73   ]
     74 
     75   defines = [ "MOJO_SYSTEM_IMPL_IMPLEMENTATION" ]
     76 
     77   public_deps = [
     78     "//mojo/edk/embedder",
     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.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 
    122 group("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 
    133 source_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 
    154 test("mojo_system_unittests") {
    155   sources = [
    156     "awakable_list_unittest.cc",
    157     "channel_unittest.cc",
    158     "core_test_base.cc",
    159     "core_test_base.h",
    160     "core_unittest.cc",
    161     "message_pipe_unittest.cc",
    162     "options_validation_unittest.cc",
    163     "platform_handle_dispatcher_unittest.cc",
    164     "shared_buffer_dispatcher_unittest.cc",
    165     "shared_buffer_unittest.cc",
    166     "wait_set_dispatcher_unittest.cc",
    167     "waiter_test_utils.cc",
    168     "waiter_test_utils.h",
    169     "waiter_unittest.cc",
    170     "watch_unittest.cc",
    171   ]
    172 
    173   if (!is_ios) {
    174     sources += [
    175       "data_pipe_unittest.cc",
    176       "multiprocess_message_pipe_unittest.cc",
    177       "platform_wrapper_unittest.cc",
    178     ]
    179   }
    180 
    181   deps = [
    182     ":test_utils",
    183     "//base",
    184     "//base/test:test_support",
    185     "//mojo/edk/embedder:embedder_unittests",
    186     "//mojo/edk/system",
    187     "//mojo/edk/system/ports:tests",
    188     "//mojo/edk/test:run_all_unittests",
    189     "//mojo/edk/test:test_support",
    190     "//testing/gmock",
    191     "//testing/gtest",
    192   ]
    193 
    194   allow_circular_includes_from = [ "//mojo/edk/embedder:embedder_unittests" ]
    195 }
    196 
    197 if (!is_ios) {
    198   test("mojo_message_pipe_perftests") {
    199     sources = [
    200       "message_pipe_perftest.cc",
    201     ]
    202 
    203     deps = [
    204       ":test_utils",
    205       "//base",
    206       "//base/test:test_support",
    207       "//mojo/edk/system",
    208       "//mojo/edk/test:run_all_perftests",
    209       "//mojo/edk/test:test_support",
    210       "//testing/gtest",
    211     ]
    212   }
    213 }
    214