xref: /aosp_15_r20/external/openscreen/cast/common/BUILD.gn (revision 3f982cf4871df8771c9d4abe6e9a6f8d829b2736)
1# Copyright 2019 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_overrides/build.gni")
6import("//third_party/protobuf/proto_library.gni")
7import("../../testing/libfuzzer/fuzzer_test.gni")
8
9if (!build_with_chromium) {
10  declare_args() {
11    # Whether or not self-signed certificates are enabled for the receiver
12    # and sender implementations.
13    cast_allow_developer_certificate = false
14  }
15}
16
17config("certificate_config") {
18  defines = []
19
20  # TODO(jophba): remove once arg is in Chrome.
21  if (!build_with_chromium) {
22    if (cast_allow_developer_certificate) {
23      defines += [ "CAST_ALLOW_DEVELOPER_CERTIFICATE" ]
24    }
25  }
26}
27
28source_set("certificate") {
29  sources = [
30    "certificate/cast_cert_validator.cc",
31    "certificate/cast_cert_validator.h",
32    "certificate/cast_cert_validator_internal.cc",
33    "certificate/cast_cert_validator_internal.h",
34    "certificate/cast_crl.cc",
35    "certificate/cast_crl.h",
36    "certificate/cast_trust_store.cc",
37    "certificate/cast_trust_store.h",
38    "certificate/types.cc",
39    "certificate/types.h",
40  ]
41  public_deps = [ "../../third_party/boringssl" ]
42
43  configs += [ ":certificate_config" ]
44
45  deps = [
46    "../../platform",
47    "../../third_party/abseil",
48    "../../util",
49    "certificate/proto:certificate_proto",
50  ]
51}
52
53source_set("channel") {
54  sources = [
55    "channel/cast_socket.cc",
56    "channel/cast_socket_message_port.cc",
57    "channel/cast_socket_message_port.h",
58    "channel/connection_namespace_handler.cc",
59    "channel/connection_namespace_handler.h",
60    "channel/message_framer.cc",
61    "channel/message_framer.h",
62    "channel/message_util.cc",
63    "channel/message_util.h",
64    "channel/namespace_router.cc",
65    "channel/namespace_router.h",
66    "channel/virtual_connection.h",
67    "channel/virtual_connection_router.cc",
68    "channel/virtual_connection_router.h",
69  ]
70
71  deps = [ "certificate/proto:certificate_proto" ]
72
73  public_deps = [
74    ":public",
75    "../../platform",
76    "../../third_party/abseil",
77    "../../util",
78    "channel/proto:channel_proto",
79  ]
80}
81
82source_set("public") {
83  sources = [
84    "public/cast_socket.h",
85    "public/message_port.h",
86    "public/receiver_info.cc",
87    "public/receiver_info.h",
88  ]
89
90  deps = [
91    "../../discovery:public",
92    "../../platform",
93    "../../third_party/abseil",
94    "../../util",
95  ]
96}
97
98if (!build_with_chromium) {
99  source_set("discovery_e2e_test") {
100    testonly = true
101
102    if (!is_mac) {
103      sources = [ "discovery/e2e_test/tests.cc" ]
104    }
105
106    deps = [
107      ":public",
108      "../../discovery:dnssd",
109      "../../discovery:public",
110      "../../platform:standalone_impl",
111      "../../testing/util",
112      "../../third_party/googletest:gtest",
113    ]
114  }
115}
116
117source_set("test_helpers") {
118  testonly = true
119
120  sources = [
121    "certificate/testing/test_helpers.cc",
122    "certificate/testing/test_helpers.h",
123    "channel/testing/fake_cast_socket.h",
124    "channel/testing/mock_cast_message_handler.h",
125    "channel/testing/mock_socket_error_handler.h",
126    "public/testing/discovery_utils.cc",
127    "public/testing/discovery_utils.h",
128  ]
129  public_deps = [
130    ":certificate",
131    ":channel",
132    ":public",
133    "../../discovery:public",
134    "../../platform:test",
135    "../../testing/util",
136    "../../third_party/abseil",
137    "../../third_party/boringssl",
138    "../../third_party/googletest:gmock",
139    "../../third_party/googletest:gtest",
140  ]
141  deps = [
142    "../../platform",
143    "../../platform:test",
144  ]
145}
146
147source_set("unittests") {
148  testonly = true
149  sources = [
150    "certificate/cast_cert_validator_unittest.cc",
151    "certificate/cast_crl_unittest.cc",
152    "channel/cast_socket_unittest.cc",
153    "channel/connection_namespace_handler_unittest.cc",
154    "channel/message_framer_unittest.cc",
155    "channel/namespace_router_unittest.cc",
156    "channel/virtual_connection_router_unittest.cc",
157    "public/receiver_info_unittest.cc",
158  ]
159
160  deps = [
161    ":certificate",
162    ":channel",
163    ":public",
164    ":test_helpers",
165    "../../platform",
166    "../../platform:test",
167    "../../testing/util",
168    "../../third_party/boringssl",
169    "../../third_party/googletest:gmock",
170    "../../third_party/googletest:gtest",
171    "../../util",
172    "certificate/proto:certificate_unittest_proto",
173    "channel/proto:channel_proto",
174  ]
175
176  data = [ "../../test/data/cast/common/certificate/" ]
177}
178
179openscreen_fuzzer_test("message_framer_fuzzer") {
180  sources = [ "channel/message_framer_fuzzer.cc" ]
181  deps = [ ":channel" ]
182
183  seed_corpus = "channel/message_framer_fuzzer_seeds"
184
185  # NOTE: 65536 is max _body_ size.
186  libfuzzer_options = [ "max_len=65600" ]
187}
188