Bypass QUIC proxy on ERR_MSG_TOO_BIG
[chromium-blink-merge.git] / net / BUILD.gn
blob9dd303e87256b5b28576a18cc83056f5355f3fc7
1 # Copyright (c) 2013 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.
5 import("//build/config/crypto.gni")
6 import("//build/config/features.gni")
7 import("//build/config/ui.gni")
8 import("//build/module_args/v8.gni")
9 import("//testing/test.gni")
10 import("//third_party/icu/config.gni")
11 import("//third_party/protobuf/proto_library.gni")
13 # TODO(cjhopman): //build/config/android/rules.gni also imports grit_rule.gni.
14 # Currently, that file can't be imported multiple times.  Make this always
15 # imported when http://crbug.com/393704 is fixed.
16 if (!is_android) {
17   import("//tools/grit/grit_rule.gni")
20 if (is_android) {
21   import("//build/config/android/config.gni")
22   import("//build/config/android/rules.gni")
23 } else if (is_mac) {
24   import("//build/config/mac/mac_sdk.gni")
27 # The list of net files is kept in net.gypi. Read it.
28 gypi_values = exec_script("//build/gypi_to_gn.py",
29                           [ rebase_path("net.gypi") ],
30                           "scope",
31                           [ "net.gypi" ])
33 # Disable Kerberos on ChromeOS, Android and iOS, at least for now. It needs
34 # configuration (krb5.conf and so on).
35 use_kerberos = !is_chromeos && !is_android && !is_ios
37 # The way the cache uses mmap() is inefficient on some Android devices. If
38 # this flag is set, we hackily avoid using mmap() in the disk cache. We are
39 # pretty confident that mmap-ing the index would not hurt any existing x86
40 # android devices, but we cannot be so sure about the variety of ARM devices.
41 # So enable it for x86 only for now.
42 posix_avoid_mmap = is_android && current_cpu != "x86"
44 # WebSockets and socket stream code are used everywhere except iOS.
45 enable_websockets = !is_ios
46 use_v8_in_net = !is_ios
47 enable_built_in_dns = !is_ios
48 disable_ftp_support = is_ios
50 declare_args() {
51   # Disables support for file URLs.  File URL support requires use of icu.
52   disable_file_support = false
55 config("net_config") {
56   defines = []
57   if (posix_avoid_mmap) {
58     defines += [ "POSIX_AVOID_MMAP" ]
59   }
60   if (disable_file_support) {
61     defines += [ "DISABLE_FILE_SUPPORT" ]
62   }
65 # net_internal_config is shared with net and net_small.
66 config("net_internal_config") {
67   defines = [
68     # TODO(GYP) Note that the GYP file supports linux_link_kerberos (defaults to
69     # 0) which implies that we run pkg_config on kerberos and link to that
70     # rather than setting this define which will dynamically open it. That
71     # doesn't seem to be set in the regular builds, so we're skipping this
72     # capability here.
73     "DLOPEN_KERBEROS",
74     "NET_IMPLEMENTATION",
75   ]
77   if (use_kerberos) {
78     defines += [ "USE_KERBEROS" ]
79     if (is_android) {
80       include_dirs = [ "/usr/include/kerberosV" ]
81     }
82   }
84   if (enable_built_in_dns) {
85     defines += [ "ENABLE_BUILT_IN_DNS" ]
86   }
89 # net_shared_* are settings shared between net and net_small
90 net_shared_sources =
91     gypi_values.net_nacl_common_sources + gypi_values.net_non_nacl_sources
93 net_shared_unfiltered_sources = []
95 net_shared_configs = [
96   ":net_internal_config",
97   "//build/config:precompiled_headers",
99   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
100   "//build/config/compiler:no_size_t_to_int_warning",
103 net_shared_public_deps = [
104   ":net_quic_proto",
105   "//crypto",
106   "//crypto:platform",
109 net_shared_deps = [
110   ":net_resources",
111   "//base",
112   "//base:prefs",
113   "//base/third_party/dynamic_annotations",
114   "//net/base/registry_controlled_domains",
115   "//sdch",
116   "//third_party/protobuf:protobuf_lite",
117   "//third_party/zlib",
120 if (!use_kerberos) {
121   net_shared_sources -= [
122     "http/http_auth_gssapi_posix.cc",
123     "http/http_auth_gssapi_posix.h",
124     "http/http_auth_handler_negotiate.cc",
125     "http/http_auth_handler_negotiate.h",
126   ]
129 if (is_posix) {
130   if (posix_avoid_mmap) {
131     net_shared_sources -= [ "disk_cache/blockfile/mapped_file_posix.cc" ]
132   } else {
133     net_shared_sources -=
134         [ "disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc" ]
135   }
138 if (!enable_built_in_dns) {
139   net_shared_sources -= [
140     "dns/address_sorter_posix.cc",
141     "dns/address_sorter_posix.h",
142     "dns/dns_client.cc",
143   ]
146 if (use_openssl) {
147   net_shared_sources -= [
148     "base/nss_memio.c",
149     "base/nss_memio.h",
150     "cert/ct_log_verifier_nss.cc",
151     "cert/ct_objects_extractor_nss.cc",
152     "cert/jwk_serializer_nss.cc",
153     "cert/scoped_nss_types.h",
154     "cert/x509_util_nss.cc",
155     "quic/crypto/aead_base_decrypter_nss.cc",
156     "quic/crypto/aead_base_encrypter_nss.cc",
157     "quic/crypto/aes_128_gcm_12_decrypter_nss.cc",
158     "quic/crypto/aes_128_gcm_12_encrypter_nss.cc",
159     "quic/crypto/chacha20_poly1305_decrypter_nss.cc",
160     "quic/crypto/chacha20_poly1305_encrypter_nss.cc",
161     "quic/crypto/channel_id_nss.cc",
162     "quic/crypto/p256_key_exchange_nss.cc",
163     "socket/nss_ssl_util.cc",
164     "socket/nss_ssl_util.h",
165     "socket/ssl_client_socket_nss.cc",
166     "socket/ssl_client_socket_nss.h",
167     "socket/ssl_server_socket_nss.cc",
168     "socket/ssl_server_socket_nss.h",
169   ]
170   if (is_ios) {
171     # Always removed for !ios below.
172     net_shared_sources -= [
173       "cert/cert_verify_proc_nss.cc",
174       "cert/cert_verify_proc_nss.h",
175     ]
176   }
177   if (is_win) {
178     net_shared_sources -= [ "cert/sha256_legacy_support_nss_win.cc" ]
179   }
180   if (!use_nss_certs && !is_ios) {
181     net_shared_sources -= [ "cert/x509_util_nss.h" ]
182   }
183 } else {
184   net_shared_sources -= [
185     "cert/ct_log_verifier_openssl.cc",
186     "cert/ct_objects_extractor_openssl.cc",
187     "cert/jwk_serializer_openssl.cc",
188     "cert/x509_util_openssl.cc",
189     "cert/x509_util_openssl.h",
190     "quic/crypto/aead_base_decrypter_openssl.cc",
191     "quic/crypto/aead_base_encrypter_openssl.cc",
192     "quic/crypto/aes_128_gcm_12_decrypter_openssl.cc",
193     "quic/crypto/aes_128_gcm_12_encrypter_openssl.cc",
194     "quic/crypto/chacha20_poly1305_decrypter_openssl.cc",
195     "quic/crypto/chacha20_poly1305_encrypter_openssl.cc",
196     "quic/crypto/channel_id_openssl.cc",
197     "quic/crypto/p256_key_exchange_openssl.cc",
198     "quic/crypto/scoped_evp_aead_ctx.cc",
199     "quic/crypto/scoped_evp_aead_ctx.h",
200     "socket/ssl_client_socket_openssl.cc",
201     "socket/ssl_client_socket_openssl.h",
202     "socket/ssl_server_socket_openssl.cc",
203     "socket/ssl_server_socket_openssl.h",
204     "ssl/openssl_ssl_util.cc",
205     "ssl/openssl_ssl_util.h",
206     "ssl/ssl_client_session_cache_openssl.cc",
207     "ssl/ssl_client_session_cache_openssl.h",
208     "ssl/ssl_platform_key.h",
209     "ssl/threaded_ssl_private_key.cc",
210     "ssl/threaded_ssl_private_key.h",
211   ]
212   if (is_mac) {
213     net_shared_sources -= [ "ssl/ssl_platform_key_mac.cc" ]
214   }
215   if (is_android) {
216     net_shared_sources -= [ "ssl/ssl_platform_key_android.cc" ]
217   }
218   if (is_win) {
219     net_shared_sources -= [
220       "cert/sha256_legacy_support_openssl_win.cc",
221       "ssl/ssl_platform_key_win.cc",
222     ]
223   }
224   if (use_nss_certs) {
225     net_shared_sources -= [
226       "ssl/client_key_store.cc",
227       "ssl/client_key_store.h",
228       "ssl/ssl_platform_key_nss.cc",
229     ]
230   }
233 if (!use_openssl_certs) {
234   net_shared_sources -= [
235     "base/crypto_module_openssl.cc",
236     "base/keygen_handler_openssl.cc",
237     "base/openssl_private_key_store.h",
238     "base/openssl_private_key_store_memory.cc",
239     "cert/cert_database_openssl.cc",
240     "cert/cert_verify_proc_openssl.cc",
241     "cert/cert_verify_proc_openssl.h",
242     "cert/test_root_certs_openssl.cc",
243     "cert/x509_certificate_openssl.cc",
244     "ssl/openssl_client_key_store.cc",
245     "ssl/openssl_client_key_store.h",
246   ]
247   if (is_android) {
248     net_shared_sources -= [ "base/openssl_private_key_store_android.cc" ]
249   }
250 } else {
251   if (is_android) {
252     # Android doesn't use these even when using OpenSSL.
253     net_shared_sources -= [
254       "base/openssl_private_key_store_memory.cc",
255       "cert/cert_database_openssl.cc",
256       "cert/cert_verify_proc_openssl.cc",
257       "cert/test_root_certs_openssl.cc",
258     ]
259   }
262 if (use_glib && !is_chromeos) {
263   net_shared_configs += [ "//build/config/linux:gconf" ]
264   net_shared_deps += [ "//build/linux:gio" ]
267 if (is_linux) {
268   net_shared_configs += [ "//build/config/linux:libresolv" ]
271 if (!use_nss_certs) {
272   net_shared_sources -= [
273     "base/crypto_module_nss.cc",
274     "base/keygen_handler_nss.cc",
275     "cert/cert_database_nss.cc",
276     "cert/nss_cert_database.cc",
277     "cert/nss_cert_database.h",
278     "cert/x509_certificate_nss.cc",
279     "ssl/client_cert_store_nss.cc",
280     "ssl/client_cert_store_nss.h",
281     "third_party/mozilla_security_manager/nsKeygenHandler.cpp",
282     "third_party/mozilla_security_manager/nsKeygenHandler.h",
283     "third_party/mozilla_security_manager/nsNSSCertificateDB.cpp",
284     "third_party/mozilla_security_manager/nsNSSCertificateDB.h",
285     "third_party/mozilla_security_manager/nsPKCS12Blob.cpp",
286     "third_party/mozilla_security_manager/nsPKCS12Blob.h",
287   ]
288   if (!is_ios) {
289     # These files are part of the partial implementation of NSS on iOS so
290     # keep them in that case (even though use_nss_certs is not set).
291     net_shared_sources -= [
292       "cert/cert_verify_proc_nss.cc",
293       "cert/cert_verify_proc_nss.h",
294       "cert/test_root_certs_nss.cc",
295       "cert/x509_util_nss_certs.cc",
296       "cert_net/nss_ocsp.cc",
297       "cert_net/nss_ocsp.h",
298     ]
299   }
300   if (is_chromeos) {
301     # These were already removed on non-ChromeOS.
302     net_shared_sources -= [
303       "cert/nss_cert_database_chromeos.cc",
304       "cert/nss_cert_database_chromeos.h",
305       "cert/nss_profile_filter_chromeos.cc",
306       "cert/nss_profile_filter_chromeos.h",
307     ]
308   }
309   net_shared_sources -= [
310     "ssl/client_key_store.cc",
311     "ssl/client_key_store.h",
312     "ssl/ssl_platform_key_nss.cc",
313   ]
314 } else if (use_openssl) {
315   # client_cert_store_nss.c requires NSS_CmpCertChainWCANames from NSS's
316   # libssl, but our bundled copy is not built in OpenSSL ports. Pull that file
317   # in directly.
318   net_shared_sources += [ "third_party/nss/ssl/cmpcert.c" ]
321 if (!enable_mdns) {
322   net_shared_sources -= [
323     "dns/mdns_cache.cc",
324     "dns/mdns_cache.h",
325     "dns/mdns_client.cc",
326     "dns/mdns_client.h",
327     "dns/mdns_client_impl.cc",
328     "dns/mdns_client_impl.h",
329     "dns/record_parsed.cc",
330     "dns/record_parsed.h",
331     "dns/record_rdata.cc",
332     "dns/record_rdata.h",
333   ]
336 if (is_win) {
337   net_shared_sources -= [
338     "http/http_auth_handler_ntlm_portable.cc",
339     "socket/socket_libevent.cc",
340     "socket/socket_libevent.h",
341     "socket/tcp_socket_libevent.cc",
342     "socket/tcp_socket_libevent.h",
343     "udp/udp_socket_libevent.cc",
344     "udp/udp_socket_libevent.h",
345   ]
346 } else {  # !is_win
347   net_shared_sources -= [
348     "base/winsock_init.cc",
349     "base/winsock_init.h",
350     "base/winsock_util.cc",
351     "base/winsock_util.h",
352     "proxy/proxy_resolver_winhttp.cc",
353     "proxy/proxy_resolver_winhttp.h",
354   ]
357 if (is_ios) {
358   # Add back some sources that were otherwise filtered out. iOS needs some Mac
359   # files.
360   net_shared_unfiltered_sources += [
361     "base/mac/url_conversions.h",
362     "base/mac/url_conversions.mm",
363     "base/network_change_notifier_mac.cc",
364     "base/network_config_watcher_mac.cc",
365     "base/network_interfaces_mac.cc",
366     "base/network_interfaces_mac.h",
367     "base/platform_mime_util_mac.mm",
368     "proxy/proxy_resolver_mac.cc",
369     "proxy/proxy_server_mac.cc",
370   ]
372   net_shared_sources -= [ "disk_cache/blockfile/file_posix.cc" ]
373   net_shared_deps += [
374     "//third_party/nss:nspr",
375     "//third_party/nss",
376     "//net/third_party/nss/ssl:libssl",
377   ]
380 if (is_ios || is_mac) {
381   net_shared_sources += gypi_values.net_base_mac_ios_sources
384 if (is_android) {
385   net_shared_deps += [ ":net_jni_headers" ]
387   # Add some Linux sources that were excluded by the filter, but which
388   # are needed.
389   net_shared_unfiltered_sources += [
390     "base/address_tracker_linux.cc",
391     "base/address_tracker_linux.h",
392     "base/network_interfaces_linux.cc",
393     "base/network_interfaces_linux.h",
394     "base/platform_mime_util_linux.cc",
395   ]
398 component("net") {
399   sources = net_shared_sources
401   # Add back some sources that were otherwise filtered out.
402   set_sources_assignment_filter([])
403   sources += net_shared_unfiltered_sources
404   set_sources_assignment_filter(sources_assignment_filter)
406   cflags = []
407   configs += net_shared_configs
408   public_configs = [ ":net_config" ]
410   public_deps = net_shared_public_deps + [ "//url" ]
411   deps = net_shared_deps
413   if (is_mac) {
414     libs = [
415       "Foundation.framework",
416       "Security.framework",
417       "SystemConfiguration.framework",
418       "resolv",
419     ]
420   }
422   if (is_ios) {
423     libs = [
424       "CFNetwork.framework",
425       "MobileCoreServices.framework",
426       "Security.framework",
427       "SystemConfiguration.framework",
428       "resolv",
429     ]
430   }
432   if (!disable_file_support) {
433     sources += gypi_values.net_file_support_sources
434   }
436   if (!disable_ftp_support) {
437     sources += gypi_values.net_ftp_support_sources
438   }
440   if (enable_websockets) {
441     sources += gypi_values.net_websockets_sources
442   }
444   # ICU support.
445   deps += [
446     "//base:i18n",
447     "//third_party/icu",
448   ]
449   sources += [
450     "base/filename_util_icu.cc",
451     "base/net_string_util_icu.cc",
452     "base/net_util_icu.cc",
453   ]
456 if (is_android) {
457   # Same as net, but with ICU, file, ftp, and websocket support stripped.
458   component("net_small") {
459     sources = net_shared_sources
461     # Add back some sources that were otherwise filtered out.
462     set_sources_assignment_filter([])
463     sources += net_shared_unfiltered_sources
464     set_sources_assignment_filter(sources_assignment_filter)
466     cflags = []
467     defines = []
468     configs += net_shared_configs
469     public_configs = [ ":net_config" ]
471     public_deps = net_shared_public_deps +
472                   [ "//url:url_lib_use_icu_alternatives_on_android" ]
473     deps = net_shared_deps + [ ":net_jni_headers" ]
475     defines += [
476       "DISABLE_FILE_SUPPORT",
477       "DISABLE_FTP_SUPPORT",
478       "USE_ICU_ALTERNATIVES_ON_ANDROID=1",
479     ]
481     # Use ICU alternative on Android.
482     sources += [
483       "base/net_string_util_icu_alternatives_android.cc",
484       "base/net_string_util_icu_alternatives_android.h",
485     ]
486   }
489 grit("net_resources") {
490   source = "base/net_resources.grd"
491   use_qualified_include = true
492   outputs = [
493     "grit/net_resources.h",
494     "net_resources.pak",
495   ]
498 proto_library("net_quic_proto") {
499   visibility = [
500     ":net",
501     ":net_small",
502   ]
504   sources = [
505     "quic/proto/cached_network_parameters.proto",
506     "quic/proto/source_address_token.proto",
507   ]
508   cc_generator_options = "dllexport_decl=NET_EXPORT_PRIVATE:"
509   cc_include = "net/base/net_export.h"
511   defines = [ "NET_IMPLEMENTATION" ]
513   extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
516 static_library("extras") {
517   sources = gypi_values.net_extras_sources
518   configs += [ "//build/config/compiler:wexit_time_destructors" ]
519   deps = [
520     ":net",
521     "//base",
522     "//sql:sql",
523   ]
526 static_library("http_server") {
527   sources = [
528     "server/http_connection.cc",
529     "server/http_connection.h",
530     "server/http_server.cc",
531     "server/http_server.h",
532     "server/http_server_request_info.cc",
533     "server/http_server_request_info.h",
534     "server/http_server_response_info.cc",
535     "server/http_server_response_info.h",
536     "server/web_socket.cc",
537     "server/web_socket.h",
538     "server/web_socket_encoder.cc",
539     "server/web_socket_encoder.h",
540   ]
541   configs += [
542     "//build/config/compiler:no_size_t_to_int_warning",
543     "//build/config/compiler:wexit_time_destructors",
544   ]
545   deps = [
546     ":net",
547     "//base",
548   ]
551 executable("dump_cache") {
552   testonly = true
553   sources = [
554     "tools/dump_cache/dump_cache.cc",
555     "tools/dump_cache/dump_files.cc",
556     "tools/dump_cache/dump_files.h",
557   ]
559   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
560   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
562   deps = [
563     ":net",
564     ":test_support",
565     "//base",
566     "//build/config/sanitizers:deps",
567   ]
570 source_set("test_support") {
571   testonly = true
572   sources = [
573     "base/load_timing_info_test_util.cc",
574     "base/load_timing_info_test_util.h",
575     "base/mock_file_stream.cc",
576     "base/mock_file_stream.h",
577     "base/test_completion_callback.cc",
578     "base/test_completion_callback.h",
579     "base/test_data_directory.cc",
580     "base/test_data_directory.h",
581     "cert/mock_cert_verifier.cc",
582     "cert/mock_cert_verifier.h",
583     "cookies/cookie_monster_store_test.cc",
584     "cookies/cookie_monster_store_test.h",
585     "cookies/cookie_store_test_callbacks.cc",
586     "cookies/cookie_store_test_callbacks.h",
587     "cookies/cookie_store_test_helpers.cc",
588     "cookies/cookie_store_test_helpers.h",
589     "disk_cache/disk_cache_test_base.cc",
590     "disk_cache/disk_cache_test_base.h",
591     "disk_cache/disk_cache_test_util.cc",
592     "disk_cache/disk_cache_test_util.h",
593     "dns/dns_test_util.cc",
594     "dns/dns_test_util.h",
595     "dns/mock_host_resolver.cc",
596     "dns/mock_host_resolver.h",
597     "dns/mock_mdns_socket_factory.cc",
598     "dns/mock_mdns_socket_factory.h",
599     "http/http_transaction_test_util.cc",
600     "http/http_transaction_test_util.h",
601     "log/test_net_log.cc",
602     "log/test_net_log.h",
603     "log/test_net_log_entry.cc",
604     "log/test_net_log_entry.h",
605     "log/test_net_log_util.cc",
606     "log/test_net_log_util.h",
607     "proxy/mock_proxy_resolver.cc",
608     "proxy/mock_proxy_resolver.h",
609     "proxy/mock_proxy_script_fetcher.cc",
610     "proxy/mock_proxy_script_fetcher.h",
611     "proxy/proxy_config_service_common_unittest.cc",
612     "proxy/proxy_config_service_common_unittest.h",
613     "socket/socket_test_util.cc",
614     "socket/socket_test_util.h",
615     "test/cert_test_util.cc",
616     "test/cert_test_util.h",
617     "test/cert_test_util_nss.cc",
618     "test/channel_id_test_util.cc",
619     "test/channel_id_test_util.h",
620     "test/ct_test_util.cc",
621     "test/ct_test_util.h",
622     "test/embedded_test_server/embedded_test_server.cc",
623     "test/embedded_test_server/embedded_test_server.h",
624     "test/embedded_test_server/http_connection.cc",
625     "test/embedded_test_server/http_connection.h",
626     "test/embedded_test_server/http_request.cc",
627     "test/embedded_test_server/http_request.h",
628     "test/embedded_test_server/http_response.cc",
629     "test/embedded_test_server/http_response.h",
630     "test/embedded_test_server/stream_listen_socket.cc",
631     "test/embedded_test_server/stream_listen_socket.h",
632     "test/embedded_test_server/tcp_listen_socket.cc",
633     "test/embedded_test_server/tcp_listen_socket.h",
634     "test/event_waiter.h",
635     "test/net_test_suite.cc",
636     "test/net_test_suite.h",
637     "test/python_utils.cc",
638     "test/python_utils.h",
639     "test/url_request/ssl_certificate_error_job.cc",
640     "test/url_request/ssl_certificate_error_job.h",
641     "test/url_request/url_request_failed_job.cc",
642     "test/url_request/url_request_failed_job.h",
643     "test/url_request/url_request_mock_data_job.cc",
644     "test/url_request/url_request_mock_data_job.h",
645     "test/url_request/url_request_slow_download_job.cc",
646     "test/url_request/url_request_slow_download_job.h",
647     "url_request/test_url_fetcher_factory.cc",
648     "url_request/test_url_fetcher_factory.h",
649     "url_request/url_request_test_util.cc",
650     "url_request/url_request_test_util.h",
651   ]
652   if (!is_ios) {
653     sources += [
654       "test/spawned_test_server/base_test_server.cc",
655       "test/spawned_test_server/base_test_server.h",
656       "test/spawned_test_server/local_test_server.cc",
657       "test/spawned_test_server/local_test_server.h",
658       "test/spawned_test_server/local_test_server_posix.cc",
659       "test/spawned_test_server/local_test_server_win.cc",
660       "test/spawned_test_server/spawned_test_server.h",
661     ]
662   }
664   configs += [
665     "//build/config:precompiled_headers",
667     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
668     "//build/config/compiler:no_size_t_to_int_warning",
669   ]
671   public_deps = [
672     "//base",
673     "//base/test:test_support",
674     "//crypto",
675     "//net",
676     "//net/tools/tld_cleanup",
677     "//testing/gmock",
678     "//testing/gtest",
679     "//url",
680   ]
682   if (!is_ios) {
683     public_deps += [ "//third_party/protobuf:py_proto" ]
684   }
686   if (use_nss_certs || is_ios) {
687     public_deps += [ "//crypto:platform" ]
688   }
690   if (is_android) {
691     sources += [
692       "test/spawned_test_server/remote_test_server.cc",
693       "test/spawned_test_server/remote_test_server.h",
694       "test/spawned_test_server/spawner_communicator.cc",
695       "test/spawned_test_server/spawner_communicator.h",
696     ]
697   }
699   if (use_v8_in_net) {
700     public_deps += [ ":net_with_v8" ]
701   }
703   if (!enable_mdns) {
704     sources -= [
705       "dns/mock_mdns_socket_factory.cc",
706       "dns/mock_mdns_socket_factory.h",
707     ]
708   }
710   if (!use_nss_certs) {
711     sources -= [ "test/cert_test_util_nss.cc" ]
712   }
714   if (!disable_file_support) {
715     sources += [
716       "test/url_request/url_request_mock_http_job.cc",
717       "test/url_request/url_request_mock_http_job.h",
718       "url_request/test_url_request_interceptor.cc",
719       "url_request/test_url_request_interceptor.h",
720     ]
721   }
724 source_set("balsa") {
725   sources = [
726     "tools/balsa/balsa_enums.h",
727     "tools/balsa/balsa_frame.cc",
728     "tools/balsa/balsa_frame.h",
729     "tools/balsa/balsa_headers.cc",
730     "tools/balsa/balsa_headers.h",
731     "tools/balsa/balsa_headers_token_utils.cc",
732     "tools/balsa/balsa_headers_token_utils.h",
733     "tools/balsa/balsa_visitor_interface.h",
734     "tools/balsa/http_message_constants.cc",
735     "tools/balsa/http_message_constants.h",
736     "tools/balsa/noop_balsa_visitor.h",
737     "tools/balsa/simple_buffer.cc",
738     "tools/balsa/simple_buffer.h",
739     "tools/balsa/split.cc",
740     "tools/balsa/split.h",
741     "tools/balsa/string_piece_utils.h",
742     "tools/quic/spdy_balsa_utils.cc",
743     "tools/quic/spdy_balsa_utils.h",
744   ]
745   deps = [
746     ":net",
747     "//base",
748     "//url",
749   ]
752 if (use_v8_in_net) {
753   component("net_with_v8") {
754     sources = [
755       "proxy/proxy_resolver_v8.cc",
756       "proxy/proxy_resolver_v8.h",
757       "proxy/proxy_resolver_v8_tracing.cc",
758       "proxy/proxy_resolver_v8_tracing.h",
759       "proxy/proxy_resolver_v8_tracing_wrapper.cc",
760       "proxy/proxy_resolver_v8_tracing_wrapper.h",
761       "proxy/proxy_service_v8.cc",
762       "proxy/proxy_service_v8.h",
763     ]
765     defines = [ "NET_IMPLEMENTATION" ]
766     configs += [
767       "//build/config/compiler:no_size_t_to_int_warning",
768       "//build/config/compiler:wexit_time_destructors",
769     ]
771     public_deps = [
772       ":net",
773     ]
774     deps = [
775       "//base",
776       "//gin",
777       "//url",
778       "//v8",
779     ]
780   }
783 if (use_v8_in_net && !is_android) {
784   source_set("net_browser_services") {
785     sources = [
786       "dns/mojo_host_resolver_impl.cc",
787       "dns/mojo_host_resolver_impl.h",
788       "proxy/in_process_mojo_proxy_resolver_factory.cc",
789       "proxy/in_process_mojo_proxy_resolver_factory.h",
790       "proxy/mojo_proxy_resolver_factory.h",
791       "proxy/proxy_resolver_factory_mojo.cc",
792       "proxy/proxy_resolver_factory_mojo.h",
793       "proxy/proxy_service_mojo.cc",
794       "proxy/proxy_service_mojo.h",
795     ]
797     public_deps = [
798       ":mojo_type_converters",
799       ":net",
800       "//base",
801       "//mojo/common",
802       "//net/interfaces",
803       "//third_party/mojo/src/mojo/public/cpp/bindings",
805       # NOTE(amistry): As long as we support in-process Mojo v8 PAC, we need
806       # this dependency since in_process_mojo_proxy_resolver_factory creates
807       # the utility process side Mojo services in the browser process.
808       # Ultimately, this will go away when we only support out-of-process.
809       ":net_utility_services",
810     ]
811   }
813   source_set("mojo_type_converters") {
814     sources = [
815       "dns/mojo_host_type_converters.cc",
816       "dns/mojo_host_type_converters.h",
817       "proxy/mojo_proxy_type_converters.cc",
818       "proxy/mojo_proxy_type_converters.h",
819     ]
821     public_deps = [
822       ":net",
823       "//net/interfaces",
824       "//third_party/mojo/src/mojo/public/cpp/bindings",
825     ]
826   }
828   source_set("net_utility_services") {
829     sources = [
830       "dns/host_resolver_mojo.cc",
831       "dns/host_resolver_mojo.h",
832       "proxy/mojo_proxy_resolver_factory_impl.cc",
833       "proxy/mojo_proxy_resolver_factory_impl.h",
834       "proxy/mojo_proxy_resolver_impl.cc",
835       "proxy/mojo_proxy_resolver_impl.h",
836       "proxy/mojo_proxy_resolver_v8_tracing_bindings.h",
837     ]
839     deps = [
840       ":net_with_v8",
841     ]
843     public_deps = [
844       ":mojo_type_converters",
845       ":net",
846       "//mojo/common",
847       "//net/interfaces",
848       "//third_party/mojo/src/mojo/public/cpp/bindings",
849     ]
850   }
853 if (!is_ios && !is_android) {
854   executable("crash_cache") {
855     testonly = true
856     sources = [
857       "tools/crash_cache/crash_cache.cc",
858     ]
860     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
861     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
862     deps = [
863       ":net",
864       ":test_support",
865       "//base",
866       "//build/config/sanitizers:deps",
867     ]
868   }
870   executable("crl_set_dump") {
871     testonly = true
872     sources = [
873       "tools/crl_set_dump/crl_set_dump.cc",
874     ]
876     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
877     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
878     deps = [
879       ":net",
880       "//base",
881       "//build/config/sanitizers:deps",
882     ]
883   }
885   executable("dns_fuzz_stub") {
886     testonly = true
887     sources = [
888       "tools/dns_fuzz_stub/dns_fuzz_stub.cc",
889     ]
891     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
892     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
893     deps = [
894       ":net",
895       "//base",
896       "//build/config/sanitizers:deps",
897     ]
898   }
900   executable("gdig") {
901     testonly = true
902     sources = [
903       "tools/gdig/file_net_log.cc",
904       "tools/gdig/gdig.cc",
905     ]
906     deps = [
907       ":net",
908       "//base",
909       "//build/config/sanitizers:deps",
910     ]
911   }
913   executable("get_server_time") {
914     testonly = true
915     sources = [
916       "tools/get_server_time/get_server_time.cc",
917     ]
919     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
920     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
921     deps = [
922       ":net",
923       "//base",
924       "//base:i18n",
925       "//build/config/sanitizers:deps",
926       "//url",
927     ]
928   }
930   executable("hpack_example_generator") {
931     testonly = true
932     sources = [
933       "spdy/fuzzing/hpack_example_generator.cc",
934     ]
936     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
937     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
938     deps = [
939       ":net",
940       "//base",
941       "//build/config/sanitizers:deps",
942     ]
943   }
945   executable("hpack_fuzz_mutator") {
946     testonly = true
947     sources = [
948       "spdy/fuzzing/hpack_fuzz_mutator.cc",
949     ]
951     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
952     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
953     deps = [
954       ":net",
955       "//base",
956       "//build/config/sanitizers:deps",
957     ]
958   }
960   executable("hpack_fuzz_wrapper") {
961     testonly = true
962     sources = [
963       "spdy/fuzzing/hpack_fuzz_wrapper.cc",
964     ]
966     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
967     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
968     deps = [
969       ":net",
970       "//base",
971       "//build/config/sanitizers:deps",
972     ]
973   }
975   if (use_v8_in_net) {
976     executable("net_watcher") {
977       testonly = true
978       sources = [
979         "tools/net_watcher/net_watcher.cc",
980       ]
981       deps = [
982         ":net",
983         ":net_with_v8",
984         "//base",
985         "//build/config/sanitizers:deps",
986       ]
988       if (is_desktop_linux) {
989         configs += [
990           "//build/config/linux:gconf",
991           "//build/config/linux:glib",
992         ]
993         deps += [ "//build/linux:gio" ]
994       }
995     }
996   }
998   executable("run_testserver") {
999     testonly = true
1000     sources = [
1001       "tools/testserver/run_testserver.cc",
1002     ]
1003     deps = [
1004       ":test_support",
1005       "//base",
1006       "//base/test:test_support",
1007       "//build/config/sanitizers:deps",
1008       "//testing/gtest",
1009     ]
1010   }
1012   executable("stress_cache") {
1013     testonly = true
1014     sources = [
1015       "tools/stress_cache/stress_cache.cc",
1016     ]
1018     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1019     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1020     deps = [
1021       ":net",
1022       ":test_support",
1023       "//base",
1024       "//build/config/sanitizers:deps",
1025     ]
1026   }
1028   executable("tld_cleanup") {
1029     sources = [
1030       "tools/tld_cleanup/tld_cleanup.cc",
1031     ]
1033     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1034     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1035     deps = [
1036       "//base",
1037       "//base:i18n",
1038       "//build/config/sanitizers:deps",
1039       "//net/tools/tld_cleanup",
1040     ]
1041   }
1044 if (is_linux) {
1045   static_library("epoll_server") {
1046     sources = [
1047       "tools/epoll_server/epoll_server.cc",
1048       "tools/epoll_server/epoll_server.h",
1049     ]
1050     deps = [
1051       ":net",
1052       "//base",
1053     ]
1054   }
1056   static_library("flip_in_mem_edsm_server_base") {
1057     testonly = true
1058     sources = [
1059       "tools/flip_server/acceptor_thread.cc",
1060       "tools/flip_server/acceptor_thread.h",
1061       "tools/flip_server/constants.h",
1062       "tools/flip_server/create_listener.cc",
1063       "tools/flip_server/create_listener.h",
1064       "tools/flip_server/flip_config.cc",
1065       "tools/flip_server/flip_config.h",
1066       "tools/flip_server/http_interface.cc",
1067       "tools/flip_server/http_interface.h",
1068       "tools/flip_server/loadtime_measurement.h",
1069       "tools/flip_server/mem_cache.cc",
1070       "tools/flip_server/mem_cache.h",
1071       "tools/flip_server/output_ordering.cc",
1072       "tools/flip_server/output_ordering.h",
1073       "tools/flip_server/ring_buffer.cc",
1074       "tools/flip_server/ring_buffer.h",
1075       "tools/flip_server/sm_connection.cc",
1076       "tools/flip_server/sm_connection.h",
1077       "tools/flip_server/sm_interface.h",
1078       "tools/flip_server/spdy_interface.cc",
1079       "tools/flip_server/spdy_interface.h",
1080       "tools/flip_server/spdy_ssl.cc",
1081       "tools/flip_server/spdy_ssl.h",
1082       "tools/flip_server/spdy_util.cc",
1083       "tools/flip_server/spdy_util.h",
1084       "tools/flip_server/streamer_interface.cc",
1085       "tools/flip_server/streamer_interface.h",
1086       "tools/flip_server/url_to_filename_encoder.cc",
1087       "tools/flip_server/url_to_filename_encoder.h",
1088       "tools/flip_server/url_utilities.cc",
1089       "tools/flip_server/url_utilities.h",
1090     ]
1091     deps = [
1092       ":balsa",
1093       ":epoll_server",
1094       ":net",
1095       "//base",
1096       "//third_party/boringssl",
1097     ]
1098   }
1100   executable("flip_in_mem_edsm_server_unittests") {
1101     testonly = true
1102     sources = [
1103       "tools/flip_server/flip_test_utils.cc",
1104       "tools/flip_server/flip_test_utils.h",
1105       "tools/flip_server/http_interface_test.cc",
1106       "tools/flip_server/mem_cache_test.cc",
1107       "tools/flip_server/run_all_tests.cc",
1108       "tools/flip_server/spdy_interface_test.cc",
1109       "tools/flip_server/url_to_filename_encoder_unittest.cc",
1110       "tools/flip_server/url_utilities_unittest.cc",
1111     ]
1112     deps = [
1113       ":balsa",
1114       ":flip_in_mem_edsm_server_base",
1115       ":net",
1116       ":test_support",
1117       "//build/config/sanitizers:deps",
1118       "//testing/gtest",
1119       "//testing/gmock",
1120       "//third_party/boringssl",
1121     ]
1122   }
1124   executable("flip_in_mem_edsm_server") {
1125     testonly = true
1126     sources = [
1127       "tools/flip_server/flip_in_mem_edsm_server.cc",
1128     ]
1129     deps = [
1130       ":balsa",
1131       ":flip_in_mem_edsm_server_base",
1132       ":net",
1133       "//base",
1134       "//build/config/sanitizers:deps",
1135     ]
1136   }
1138   source_set("epoll_quic_tools") {
1139     sources = [
1140       "tools/quic/quic_client.cc",
1141       "tools/quic/quic_client.h",
1142       "tools/quic/quic_default_packet_writer.cc",
1143       "tools/quic/quic_default_packet_writer.h",
1144       "tools/quic/quic_epoll_clock.cc",
1145       "tools/quic/quic_epoll_clock.h",
1146       "tools/quic/quic_epoll_connection_helper.cc",
1147       "tools/quic/quic_epoll_connection_helper.h",
1148       "tools/quic/quic_packet_reader.cc",
1149       "tools/quic/quic_packet_reader.h",
1150       "tools/quic/quic_packet_writer_wrapper.cc",
1151       "tools/quic/quic_packet_writer_wrapper.h",
1152       "tools/quic/quic_server.cc",
1153       "tools/quic/quic_server.h",
1154       "tools/quic/quic_socket_utils.cc",
1155       "tools/quic/quic_socket_utils.h",
1156     ]
1157     deps = [
1158       ":balsa",
1159       ":epoll_server",
1160       ":net",
1161       "//base",
1162       "//base/third_party/dynamic_annotations",
1163       "//crypto",
1164       "//third_party/boringssl",
1165       "//url",
1166     ]
1167   }
1169   executable("epoll_quic_client") {
1170     sources = [
1171       "tools/quic/quic_client_bin.cc",
1172     ]
1173     deps = [
1174       ":balsa",
1175       ":epoll_server",
1176       ":epoll_quic_tools",
1177       ":net",
1178       ":simple_quic_tools",
1179       "//base",
1180       "//build/config/sanitizers:deps",
1181       "//third_party/boringssl",
1182     ]
1183   }
1185   executable("epoll_quic_server") {
1186     sources = [
1187       "tools/quic/quic_server_bin.cc",
1188     ]
1189     deps = [
1190       ":balsa",
1191       ":epoll_server",
1192       ":epoll_quic_tools",
1193       ":net",
1194       ":simple_quic_tools",
1195       "//base",
1196       "//build/config/sanitizers:deps",
1197       "//third_party/boringssl",
1198     ]
1199   }
1202 if (is_android) {
1203   generate_jni("net_jni_headers") {
1204     sources = [
1205       "android/java/src/org/chromium/net/AndroidCertVerifyResult.java",
1206       "android/java/src/org/chromium/net/AndroidKeyStore.java",
1207       "android/java/src/org/chromium/net/AndroidNetworkLibrary.java",
1208       "android/java/src/org/chromium/net/AndroidPrivateKey.java",
1209       "android/java/src/org/chromium/net/GURLUtils.java",
1210       "android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java",
1211       "android/java/src/org/chromium/net/NetStringUtil.java",
1212       "android/java/src/org/chromium/net/NetworkChangeNotifier.java",
1213       "android/java/src/org/chromium/net/ProxyChangeListener.java",
1214       "android/java/src/org/chromium/net/X509Util.java",
1215     ]
1216     jni_package = "net"
1217   }
1218   generate_jni("net_test_jni_headers") {
1219     sources = [
1220       "android/javatests/src/org/chromium/net/AndroidKeyStoreTestUtil.java",
1221       "test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticator.java",
1222     ]
1223     jni_package = "net/test"
1224   }
1227 if (is_android || is_linux) {
1228   executable("disk_cache_memory_test") {
1229     testonly = true
1230     sources = [
1231       "tools/disk_cache_memory_test/disk_cache_memory_test.cc",
1232     ]
1233     deps = [
1234       ":net",
1235       "//base",
1236       "//build/config/sanitizers:deps",
1237     ]
1238   }
1241 source_set("simple_quic_tools") {
1242   sources = [
1243     "tools/quic/quic_client_base.cc",
1244     "tools/quic/quic_client_base.h",
1245     "tools/quic/quic_client_session.cc",
1246     "tools/quic/quic_client_session.h",
1247     "tools/quic/quic_dispatcher.cc",
1248     "tools/quic/quic_dispatcher.h",
1249     "tools/quic/quic_in_memory_cache.cc",
1250     "tools/quic/quic_in_memory_cache.h",
1251     "tools/quic/quic_per_connection_packet_writer.cc",
1252     "tools/quic/quic_per_connection_packet_writer.h",
1253     "tools/quic/quic_server_session.cc",
1254     "tools/quic/quic_server_session.h",
1255     "tools/quic/quic_simple_client.cc",
1256     "tools/quic/quic_simple_client.h",
1257     "tools/quic/quic_simple_per_connection_packet_writer.cc",
1258     "tools/quic/quic_simple_per_connection_packet_writer.h",
1259     "tools/quic/quic_simple_server.cc",
1260     "tools/quic/quic_simple_server.h",
1261     "tools/quic/quic_simple_server_packet_writer.cc",
1262     "tools/quic/quic_simple_server_packet_writer.h",
1263     "tools/quic/quic_spdy_client_stream.cc",
1264     "tools/quic/quic_spdy_client_stream.h",
1265     "tools/quic/quic_spdy_server_stream.cc",
1266     "tools/quic/quic_spdy_server_stream.h",
1267     "tools/quic/quic_time_wait_list_manager.cc",
1268     "tools/quic/quic_time_wait_list_manager.h",
1269     "tools/quic/synchronous_host_resolver.cc",
1270     "tools/quic/synchronous_host_resolver.h",
1271   ]
1272   deps = [
1273     ":net",
1274     "//base",
1275     "//base/third_party/dynamic_annotations",
1276     "//url",
1277   ]
1280 if (!is_ios) {
1281   executable("quic_client") {
1282     sources = [
1283       "tools/quic/quic_simple_client_bin.cc",
1284     ]
1285     deps = [
1286       ":net",
1287       ":simple_quic_tools",
1288       "//base",
1289       "//build/config/sanitizers:deps",
1290       "//url",
1291     ]
1292   }
1293   executable("quic_server") {
1294     sources = [
1295       "tools/quic/quic_simple_server_bin.cc",
1296     ]
1297     deps = [
1298       ":net",
1299       ":simple_quic_tools",
1300       "//base",
1301       "//build/config/sanitizers:deps",
1302       "//third_party/boringssl",
1303       "//third_party/protobuf:protobuf_lite",
1304     ]
1305   }
1308 # TODO(GYP): Delete this after we've converted everything to GN.
1309 # The _run targets exist only for compatibility w/ GYP.
1310 group("net_unittests_run") {
1311   testonly = true
1312   deps = [
1313     ":net_unittests",
1314   ]
1317 test("net_unittests") {
1318   sources = gypi_values.net_test_sources
1320   if (is_ios) {
1321     sources -= [
1322       "websockets/websocket_stream_cookie_test.cc",
1323       "websockets/websocket_stream_create_test_base.cc",
1324       "websockets/websocket_stream_create_test_base.h",
1325     ]
1326   }
1328   configs += [
1329     "//build/config:precompiled_headers",
1331     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1332     "//build/config/compiler:no_size_t_to_int_warning",
1333   ]
1334   defines = []
1336   deps = [
1337     ":balsa",
1338     ":extras",
1339     ":http_server",
1340     ":net",
1341     ":simple_quic_tools",
1342     ":test_support",
1343     "//base",
1344     "//base:i18n",
1345     "//base:prefs_test_support",
1346     "//base/allocator",
1347     "//base/third_party/dynamic_annotations",
1348     "//crypto",
1349     "//crypto:platform",
1350     "//crypto:test_support",
1351     "//gin",
1352     "//net/base/registry_controlled_domains",
1353     "//sql",
1354     "//testing/gmock",
1355     "//testing/gtest",
1356     "//third_party/zlib",
1357     "//url",
1358   ]
1360   data = [
1361     "data/",
1362   ]
1364   if (is_linux || is_mac || is_win) {
1365     deps += [
1366       "//third_party/pyftpdlib/",
1367       "//third_party/pywebsocket/",
1368       "//third_party/tlslite/",
1369     ]
1370     data_deps = [
1371       "//third_party/pyftpdlib/",
1372       "//third_party/pywebsocket/",
1373       "//third_party/tlslite/",
1374     ]
1375     data += [
1376       "tools/testserver/",
1377       "//third_party/pyftpdlib/",
1378       "//third_party/pywebsocket/",
1379       "//third_party/tlslite/",
1380       "$root_out_dir/pyproto/google/",
1381     ]
1382   }
1384   if (is_desktop_linux) {
1385     deps += [ ":epoll_quic_tools" ]
1386   }
1387   if (is_linux) {
1388     sources += gypi_values.net_linux_test_sources
1389     deps += [
1390       ":epoll_quic_tools",
1391       ":epoll_server",
1392       ":flip_in_mem_edsm_server_base",
1393     ]
1394   }
1396   if (is_mac || is_ios) {
1397     sources += gypi_values.net_base_test_mac_ios_sources
1398   }
1400   if (is_chromeos) {
1401     sources -= [ "proxy/proxy_config_service_linux_unittest.cc" ]
1402   }
1404   if (v8_use_external_startup_data) {
1405     deps += [ "//gin" ]
1406   }
1408   if (!use_nss_certs) {
1409     sources -= [
1410       "cert/nss_cert_database_unittest.cc",
1411       "ssl/client_cert_store_nss_unittest.cc",
1412     ]
1413     if (is_chromeos) {  # Already removed for all non-ChromeOS builds.
1414       sources -= [
1415         "cert/nss_cert_database_chromeos_unittest.cc",
1416         "cert/nss_profile_filter_chromeos_unittest.cc",
1417       ]
1418     }
1419   }
1421   if (use_openssl) {
1422     # When building for OpenSSL, we need to exclude NSS specific tests
1423     # or functionality not supported by OpenSSL yet.
1424     # TODO(bulach): Add equivalent tests when the underlying
1425     #               functionality is ported to OpenSSL.
1426     sources -= [ "quic/test_tools/crypto_test_utils_nss.cc" ]
1427   } else {
1428     sources -= [
1429       "cert/x509_util_openssl_unittest.cc",
1430       "quic/test_tools/crypto_test_utils_openssl.cc",
1431       "socket/ssl_client_socket_openssl_unittest.cc",
1432       "ssl/ssl_client_session_cache_openssl_unittest.cc",
1433     ]
1434   }
1436   if (use_kerberos) {
1437     defines += [ "USE_KERBEROS" ]
1438   }
1440   # These are excluded on Android, because the actual Kerberos support, which
1441   # these test, is in a separate app on Android.
1442   if (!use_kerberos || is_android) {
1443     sources -= [
1444       "http/http_auth_gssapi_posix_unittest.cc",
1445       "http/mock_gssapi_library_posix.cc",
1446       "http/mock_gssapi_library_posix.h",
1447     ]
1448   }
1449   if (!use_kerberos) {
1450     sources -= [ "http/http_auth_handler_negotiate_unittest.cc" ]
1451   }
1453   if (use_openssl || (!is_desktop_linux && !is_chromeos && !is_ios)) {
1454     # Only include this test when on Posix and using NSS for
1455     # cert verification or on iOS (which also uses NSS for certs).
1456     sources -= [ "cert_net/nss_ocsp_unittest.cc" ]
1457   }
1459   if (!use_openssl_certs) {
1460     sources -= [ "ssl/openssl_client_key_store_unittest.cc" ]
1461   }
1463   if (!enable_websockets) {
1464     sources -= [
1465       "server/http_connection_unittest.cc",
1466       "server/http_server_response_info_unittest.cc",
1467       "server/http_server_unittest.cc",
1468       "server/web_socket_encoder_unittest.cc",
1469       "websockets/websocket_basic_stream_test.cc",
1470       "websockets/websocket_channel_test.cc",
1471       "websockets/websocket_deflate_predictor_impl_test.cc",
1472       "websockets/websocket_deflate_stream_test.cc",
1473       "websockets/websocket_deflater_test.cc",
1474       "websockets/websocket_end_to_end_test.cc",
1475       "websockets/websocket_errors_test.cc",
1476       "websockets/websocket_extension_parser_test.cc",
1477       "websockets/websocket_frame_parser_test.cc",
1478       "websockets/websocket_frame_test.cc",
1479       "websockets/websocket_handshake_challenge_test.cc",
1480       "websockets/websocket_handshake_stream_create_helper_test.cc",
1481       "websockets/websocket_inflater_test.cc",
1482       "websockets/websocket_stream_test.cc",
1483       "websockets/websocket_test_util.cc",
1484       "websockets/websocket_test_util.h",
1485     ]
1486     deps -= [ ":http_server" ]
1487   }
1489   if (disable_file_support) {
1490     sources -= [
1491       "base/directory_lister_unittest.cc",
1492       "url_request/url_request_file_job_unittest.cc",
1493     ]
1494   }
1496   if (disable_ftp_support) {
1497     sources -= [
1498       "ftp/ftp_auth_cache_unittest.cc",
1499       "ftp/ftp_ctrl_response_buffer_unittest.cc",
1500       "ftp/ftp_directory_listing_parser_ls_unittest.cc",
1501       "ftp/ftp_directory_listing_parser_unittest.cc",
1502       "ftp/ftp_directory_listing_parser_unittest.h",
1503       "ftp/ftp_directory_listing_parser_vms_unittest.cc",
1504       "ftp/ftp_directory_listing_parser_windows_unittest.cc",
1505       "ftp/ftp_network_transaction_unittest.cc",
1506       "ftp/ftp_util_unittest.cc",
1507       "url_request/url_request_ftp_job_unittest.cc",
1508     ]
1509   }
1511   if (!enable_built_in_dns) {
1512     sources -= [
1513       "dns/address_sorter_posix_unittest.cc",
1514       "dns/address_sorter_unittest.cc",
1515     ]
1516   }
1518   if (use_v8_in_net) {
1519     deps += [ ":net_with_v8" ]
1520   } else {
1521     sources -= [
1522       "proxy/proxy_resolver_v8_tracing_unittest.cc",
1523       "proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc",
1524       "proxy/proxy_resolver_v8_unittest.cc",
1525     ]
1526   }
1528   if (use_v8_in_net && !is_android) {
1529     deps += [
1530       ":net_browser_services",
1531       ":net_utility_services",
1532       "//mojo/environment:chromium",
1533       "//third_party/mojo/src/mojo/edk/system",
1534     ]
1535   } else {
1536     sources -= [
1537       "dns/host_resolver_mojo_unittest.cc",
1538       "dns/mojo_host_resolver_impl_unittest.cc",
1539       "proxy/mojo_proxy_resolver_factory_impl_unittest.cc",
1540       "proxy/mojo_proxy_resolver_impl_unittest.cc",
1541       "proxy/mojo_proxy_resolver_v8_tracing_bindings_unittest.cc",
1542       "proxy/proxy_resolver_factory_mojo_unittest.cc",
1543       "proxy/proxy_service_mojo_unittest.cc",
1544     ]
1545   }
1547   if (!enable_mdns) {
1548     sources -= [
1549       "dns/mdns_cache_unittest.cc",
1550       "dns/mdns_client_unittest.cc",
1551       "dns/record_parsed_unittest.cc",
1552       "dns/record_rdata_unittest.cc",
1553     ]
1554   }
1556   if (is_ios) {
1557     # TODO(GYP)
1558     #  'actions': [
1559     #    {
1560     #      'action_name': 'copy_test_data',
1561     #      'variables': {
1562     #        'test_data_files': [
1563     #          'data/ssl/certificates/',
1564     #          'data/test.html',
1565     #          'data/url_request_unittest/',
1566     #          'data/verify_name_match_unittest/names/',
1567     #          'data/parse_certificate_unittest/',
1568     #        ],
1569     #        'test_data_prefix': 'net',
1570     #      },
1571     #      'includes': [ '../build/copy_test_data_ios.gypi' ],
1572     #    },
1573     #  ],
1574     sources -= [
1575       # TODO(droger): The following tests are disabled because the
1576       # implementation is missing or incomplete.
1577       # KeygenHandler::GenKeyAndSignChallenge() is not ported to iOS.
1578       "base/keygen_handler_unittest.cc",
1579       "disk_cache/backend_unittest.cc",
1580       "disk_cache/blockfile/block_files_unittest.cc",
1582       # Need to read input data files.
1583       "filter/gzip_filter_unittest.cc",
1584       "socket/ssl_server_socket_unittest.cc",
1585       "spdy/fuzzing/hpack_fuzz_util_test.cc",
1587       # Need TestServer.
1588       "cert_net/cert_net_fetcher_impl_unittest.cc",
1589       "proxy/proxy_script_fetcher_impl_unittest.cc",
1590       "socket/ssl_client_socket_unittest.cc",
1591       "url_request/url_fetcher_impl_unittest.cc",
1592       "url_request/url_request_context_builder_unittest.cc",
1594       # Needs GetAppOutput().
1595       "test/python_utils_unittest.cc",
1597       # The following tests are disabled because they don't apply to
1598       # iOS.
1599       # OS is not "linux" or "freebsd" or "openbsd".
1600       "socket/unix_domain_client_socket_posix_unittest.cc",
1601       "socket/unix_domain_server_socket_posix_unittest.cc",
1603       # See bug http://crbug.com/344533.
1604       "disk_cache/blockfile/index_table_v3_unittest.cc",
1605     ]
1606   }
1608   if (is_android) {
1609     sources -= [
1610       # See bug http://crbug.com/344533.
1611       "disk_cache/blockfile/index_table_v3_unittest.cc",
1612       "dns/dns_config_service_posix_unittest.cc",
1613     ]
1614     deps += [
1615       ":net_test_jni_headers",
1617       # TODO(mmenke):  This depends on test_support_base, which depends on
1618       #                icu.  Figure out a way to remove that dependency.
1619       "//testing/android/native_test:native_test_native_code",
1620     ]
1621     set_sources_assignment_filter([])
1622     sources += [ "base/address_tracker_linux_unittest.cc" ]
1623     set_sources_assignment_filter(sources_assignment_filter)
1624     isolate_file = "net_unittests.isolate"
1625   }
1627   # Symbols for crashes when running tests on swarming.
1628   if (symbol_level > 0) {
1629     if (is_win) {
1630       data += [ "$root_out_dir/net_unittests.exe.pdb" ]
1631     } else if (is_mac) {
1632       data += [ "$root_out_dir/net_unittests.dSYM/" ]
1633     }
1634   }
1637 # !is_android && !is_win && !is_mac
1639 executable("net_perftests") {
1640   testonly = true
1641   sources = [
1642     "base/mime_sniffer_perftest.cc",
1643     "cookies/cookie_monster_perftest.cc",
1644     "disk_cache/blockfile/disk_cache_perftest.cc",
1645     "extras/sqlite/sqlite_persistent_cookie_store_perftest.cc",
1646     "proxy/proxy_resolver_perftest.cc",
1647     "udp/udp_socket_perftest.cc",
1648   ]
1650   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1651   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1652   deps = [
1653     ":extras",
1654     ":net",
1655     ":test_support",
1656     "//base",
1657     "//base:i18n",
1658     "//base/test:test_support_perf",
1659     "//build/config/sanitizers:deps",
1660     "//testing/gtest",
1661     "//url",
1662   ]
1664   if (enable_websockets) {
1665     sources += [ "websockets/websocket_frame_perftest.cc" ]
1666   }
1668   if (use_v8_in_net) {
1669     deps += [ ":net_with_v8" ]
1670   } else {
1671     sources -= [ "proxy/proxy_resolver_perftest.cc" ]
1672   }