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("../../../tools/bindings/mojom.gni") 6 7group("test_data_deps") { 8 testonly = true 9 data_deps = [ 10 ":test_interfaces_js_data_deps", 11 ":test_associated_interfaces_js_data_deps", 12 ":validation_test_data", 13 ":validation_test_data_list", 14 ] 15} 16 17copy("validation_test_data") { 18 testonly = true 19 sources = [ 20 "data/validation", 21 ] 22 outputs = [ 23 "$root_gen_dir/layout_test_data/{{source_root_relative_dir}}/{{source_file_part}}", 24 ] 25} 26 27action_foreach("validation_test_data_list") { 28 testonly = true 29 script = "//mojo/public/tools/bindings/gen_data_files_list.py" 30 inputs = mojom_generator_sources 31 sources = [ 32 "data/validation", 33 ] 34 outputs = [ 35 "$root_gen_dir/layout_test_data/{{source_root_relative_dir}}/{{source_file_part}}_index.txt", 36 ] 37 args = [ 38 "-d", 39 rebase_path(sources[0], root_build_dir), 40 "-o", 41 rebase_path(outputs[0], root_build_dir), 42 ] 43} 44 45mojom("test_interfaces") { 46 testonly = true 47 sources = [ 48 "math_calculator.mojom", 49 "no_module.mojom", 50 "ping_service.mojom", 51 "rect.mojom", 52 "regression_tests.mojom", 53 "sample_factory.mojom", 54 "sample_interfaces.mojom", 55 "sample_service.mojom", 56 "scoping.mojom", 57 "serialization_test_structs.mojom", 58 "test_bad_messages.mojom", 59 "test_constants.mojom", 60 "test_data_view.mojom", 61 "test_name_generator.mojom", 62 "test_native_types.mojom", 63 "test_structs.mojom", 64 "test_sync_methods.mojom", 65 "test_unions.mojom", 66 "validation_test_interfaces.mojom", 67 ] 68 public_deps = [ 69 ":echo", 70 ":test_mojom_import", 71 ":test_mojom_import2", 72 ] 73 74 # TODO(crbug.com/714018): Convert the implementation to use OnceCallback. 75 use_once_callback = false 76 77 support_lazy_serialization = true 78 79 # Validation tests require precise message content matching, so we avoid 80 # scrambling message IDs for test interfaces. 81 scramble_message_ids = false 82} 83 84component("test_export_component") { 85 testonly = true 86 deps = [ 87 ":test_export", 88 ] 89} 90 91if (!is_ios) { 92 component("test_export_blink_component") { 93 testonly = true 94 deps = [ 95 ":test_export_blink", 96 ] 97 } 98} 99 100mojom("test_export") { 101 testonly = true 102 sources = [ 103 "test_export.mojom", 104 ] 105 export_class_attribute = "MOJO_TEST_EXPORT" 106 export_define = "MOJO_TEST_IMPLEMENTATION=1" 107 export_header = "mojo/public/cpp/bindings/tests/mojo_test_export.h" 108 if (!is_ios) { 109 export_class_attribute_blink = "MOJO_TEST_BLINK_EXPORT" 110 export_define_blink = "MOJO_TEST_BLINK_IMPLEMENTATION=1" 111 export_header_blink = 112 "mojo/public/cpp/bindings/tests/mojo_test_blink_export.h" 113 } 114 visibility = [ ":test_export_component" ] 115 if (!is_ios) { 116 visibility_blink = [ ":test_export_blink_component" ] 117 } 118} 119 120mojom("test_exported_import") { 121 testonly = true 122 sources = [ 123 "test_import.mojom", 124 ] 125 public_deps = [ 126 ":test_export", 127 ] 128 129 overridden_deps = [ ":test_export" ] 130 component_deps = [ ":test_export_component" ] 131 if (!is_ios) { 132 overridden_deps_blink = [ ":test_export" ] 133 component_deps_blink = [ ":test_export_blink_component" ] 134 } 135} 136 137# Used to test that it is okay to call mojom::Foo::Serialize()/Deserialize() 138# even if the mojom target is linked into another component. 139# 140# We don't use |test_export_component| for this test because 141# //mojo/public/cpp/bindings/tests depends on both |test_export_component| and 142# |test_exported_import| and therefore actually get the shared cpp sources of 143# test_export.mojom from |test_exported_import|. 144component("test_export_component2") { 145 testonly = true 146 public_deps = [ 147 ":test_export2", 148 ] 149} 150 151mojom("test_export2") { 152 testonly = true 153 sources = [ 154 "test_export2.mojom", 155 ] 156 export_class_attribute = "MOJO_TEST_EXPORT" 157 export_define = "MOJO_TEST_IMPLEMENTATION=1" 158 export_header = "mojo/public/cpp/bindings/tests/mojo_test_export.h" 159 visibility = [ ":test_export_component2" ] 160} 161 162mojom("test_mojom_import") { 163 testonly = true 164 sources = [ 165 "sample_import.mojom", 166 ] 167} 168 169mojom("test_mojom_import_wrapper") { 170 testonly = true 171 public_deps = [ 172 ":test_mojom_import", 173 ] 174} 175 176mojom("test_mojom_import_wrapper_wrapper") { 177 testonly = true 178 public_deps = [ 179 ":test_mojom_import_wrapper", 180 ] 181} 182 183mojom("test_mojom_import2") { 184 testonly = true 185 sources = [ 186 "sample_import2.mojom", 187 ] 188 public_deps = [ 189 ":test_mojom_import", 190 ":test_mojom_import_wrapper_wrapper", 191 ] 192} 193 194mojom("test_struct_traits_interfaces") { 195 testonly = true 196 sources = [ 197 "struct_with_traits.mojom", 198 ] 199 200 # TODO(crbug.com/714018): Convert the implementation to use OnceCallback. 201 use_once_callback = false 202 203 support_lazy_serialization = true 204} 205 206mojom("test_associated_interfaces") { 207 # These files are not included in the test_interfaces target because 208 # associated interfaces are not supported by all bindings languages yet. 209 testonly = true 210 sources = [ 211 "test_associated_interfaces.mojom", 212 "validation_test_associated_interfaces.mojom", 213 ] 214 215 public_deps = [ 216 ":test_interfaces", 217 ] 218 219 # TODO(crbug.com/714018): Convert the implementation to use OnceCallback. 220 use_once_callback = false 221 222 # Validation tests require precise message content matching, so we avoid 223 # scrambling message IDs for test interfaces. 224 scramble_message_ids = false 225} 226 227mojom("versioning_test_service_interfaces") { 228 testonly = true 229 sources = [ 230 "versioning_test_service.mojom", 231 ] 232} 233 234mojom("versioning_test_client_interfaces") { 235 testonly = true 236 sources = [ 237 "versioning_test_client.mojom", 238 ] 239} 240 241mojom("test_wtf_types") { 242 testonly = true 243 244 sources = [ 245 "test_wtf_types.mojom", 246 ] 247 248 # TODO(crbug.com/714018): Convert the implementation to use OnceCallback. 249 use_once_callback = false 250} 251 252mojom("test_no_sources") { 253 testonly = true 254 255 public_deps = [ 256 ":test_interfaces", 257 ] 258} 259 260mojom("echo") { 261 testonly = true 262 sources = [ 263 "echo.mojom", 264 "echo_import/echo_import.mojom", 265 ] 266} 267