Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / net / BUILD.gn
blob7a57e7a05bb68d306be8222b1664a6336e69327a
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     "quic/crypto/proof_source_chromium_nss.cc",
164     "socket/nss_ssl_util.cc",
165     "socket/nss_ssl_util.h",
166     "socket/ssl_client_socket_nss.cc",
167     "socket/ssl_client_socket_nss.h",
168     "socket/ssl_server_socket_nss.cc",
169     "socket/ssl_server_socket_nss.h",
170   ]
171   if (is_ios) {
172     # Always removed for !ios below.
173     net_shared_sources -= [
174       "cert/cert_verify_proc_nss.cc",
175       "cert/cert_verify_proc_nss.h",
176     ]
177   }
178   if (is_win) {
179     net_shared_sources -= [ "cert/sha256_legacy_support_nss_win.cc" ]
180   }
181   if (!use_nss_certs && !is_ios) {
182     net_shared_sources -= [ "cert/x509_util_nss.h" ]
183   }
184 } else {
185   net_shared_sources -= [
186     "cert/ct_log_verifier_openssl.cc",
187     "cert/ct_objects_extractor_openssl.cc",
188     "cert/jwk_serializer_openssl.cc",
189     "cert/x509_util_openssl.cc",
190     "cert/x509_util_openssl.h",
191     "quic/crypto/aead_base_decrypter_openssl.cc",
192     "quic/crypto/aead_base_encrypter_openssl.cc",
193     "quic/crypto/aes_128_gcm_12_decrypter_openssl.cc",
194     "quic/crypto/aes_128_gcm_12_encrypter_openssl.cc",
195     "quic/crypto/chacha20_poly1305_decrypter_openssl.cc",
196     "quic/crypto/chacha20_poly1305_encrypter_openssl.cc",
197     "quic/crypto/channel_id_openssl.cc",
198     "quic/crypto/p256_key_exchange_openssl.cc",
199     "quic/crypto/proof_source_chromium_openssl.cc",
200     "quic/crypto/scoped_evp_aead_ctx.cc",
201     "quic/crypto/scoped_evp_aead_ctx.h",
202     "socket/ssl_client_socket_openssl.cc",
203     "socket/ssl_client_socket_openssl.h",
204     "socket/ssl_server_socket_openssl.cc",
205     "socket/ssl_server_socket_openssl.h",
206     "ssl/openssl_ssl_util.cc",
207     "ssl/openssl_ssl_util.h",
208     "ssl/ssl_client_session_cache_openssl.cc",
209     "ssl/ssl_client_session_cache_openssl.h",
210     "ssl/ssl_platform_key.h",
211     "ssl/threaded_ssl_private_key.cc",
212     "ssl/threaded_ssl_private_key.h",
213   ]
214   if (is_mac) {
215     net_shared_sources -= [ "ssl/ssl_platform_key_mac.cc" ]
216   }
217   if (is_android) {
218     net_shared_sources -= [ "ssl/ssl_platform_key_android.cc" ]
219   }
220   if (is_win) {
221     net_shared_sources -= [
222       "cert/sha256_legacy_support_openssl_win.cc",
223       "ssl/ssl_platform_key_win.cc",
224     ]
225   }
226   if (use_nss_certs) {
227     net_shared_sources -= [
228       "ssl/client_key_store.cc",
229       "ssl/client_key_store.h",
230       "ssl/ssl_platform_key_nss.cc",
231     ]
232   }
235 if (!use_openssl_certs) {
236   net_shared_sources -= [
237     "base/crypto_module_openssl.cc",
238     "base/keygen_handler_openssl.cc",
239     "base/openssl_private_key_store.h",
240     "base/openssl_private_key_store_memory.cc",
241     "cert/cert_database_openssl.cc",
242     "cert/cert_verify_proc_openssl.cc",
243     "cert/cert_verify_proc_openssl.h",
244     "cert/test_root_certs_openssl.cc",
245     "cert/x509_certificate_openssl.cc",
246     "ssl/openssl_client_key_store.cc",
247     "ssl/openssl_client_key_store.h",
248   ]
249   if (is_android) {
250     net_shared_sources -= [ "base/openssl_private_key_store_android.cc" ]
251   }
252 } else {
253   if (is_android) {
254     # Android doesn't use these even when using OpenSSL.
255     net_shared_sources -= [
256       "base/openssl_private_key_store_memory.cc",
257       "cert/cert_database_openssl.cc",
258       "cert/cert_verify_proc_openssl.cc",
259       "cert/test_root_certs_openssl.cc",
260     ]
261   }
264 if (use_glib && !is_chromeos) {
265   net_shared_configs += [ "//build/config/linux:gconf" ]
266   net_shared_deps += [ "//build/linux:gio" ]
269 if (is_linux) {
270   net_shared_configs += [ "//build/config/linux:libresolv" ]
273 if (!use_nss_certs) {
274   net_shared_sources -= [
275     "base/crypto_module_nss.cc",
276     "base/keygen_handler_nss.cc",
277     "cert/cert_database_nss.cc",
278     "cert/nss_cert_database.cc",
279     "cert/nss_cert_database.h",
280     "cert/x509_certificate_nss.cc",
281     "ssl/client_cert_store_nss.cc",
282     "ssl/client_cert_store_nss.h",
283     "third_party/mozilla_security_manager/nsKeygenHandler.cpp",
284     "third_party/mozilla_security_manager/nsKeygenHandler.h",
285     "third_party/mozilla_security_manager/nsNSSCertificateDB.cpp",
286     "third_party/mozilla_security_manager/nsNSSCertificateDB.h",
287     "third_party/mozilla_security_manager/nsPKCS12Blob.cpp",
288     "third_party/mozilla_security_manager/nsPKCS12Blob.h",
289   ]
290   if (!is_ios) {
291     # These files are part of the partial implementation of NSS on iOS so
292     # keep them in that case (even though use_nss_certs is not set).
293     net_shared_sources -= [
294       "cert/cert_verify_proc_nss.cc",
295       "cert/cert_verify_proc_nss.h",
296       "cert/test_root_certs_nss.cc",
297       "cert/x509_util_nss_certs.cc",
298       "cert_net/nss_ocsp.cc",
299       "cert_net/nss_ocsp.h",
300     ]
301   }
302   if (is_chromeos) {
303     # These were already removed on non-ChromeOS.
304     net_shared_sources -= [
305       "cert/nss_cert_database_chromeos.cc",
306       "cert/nss_cert_database_chromeos.h",
307       "cert/nss_profile_filter_chromeos.cc",
308       "cert/nss_profile_filter_chromeos.h",
309     ]
310   }
311   net_shared_sources -= [
312     "ssl/client_key_store.cc",
313     "ssl/client_key_store.h",
314     "ssl/ssl_platform_key_nss.cc",
315   ]
316 } else if (use_openssl) {
317   # client_cert_store_nss.c requires NSS_CmpCertChainWCANames from NSS's
318   # libssl, but our bundled copy is not built in OpenSSL ports. Pull that file
319   # in directly.
320   net_shared_sources += [ "third_party/nss/ssl/cmpcert.c" ]
323 if (!enable_mdns) {
324   net_shared_sources -= [
325     "dns/mdns_cache.cc",
326     "dns/mdns_cache.h",
327     "dns/mdns_client.cc",
328     "dns/mdns_client.h",
329     "dns/mdns_client_impl.cc",
330     "dns/mdns_client_impl.h",
331     "dns/record_parsed.cc",
332     "dns/record_parsed.h",
333     "dns/record_rdata.cc",
334     "dns/record_rdata.h",
335   ]
338 if (is_win) {
339   net_shared_sources -= [
340     "http/http_auth_handler_ntlm_portable.cc",
341     "socket/socket_libevent.cc",
342     "socket/socket_libevent.h",
343     "socket/tcp_socket_libevent.cc",
344     "socket/tcp_socket_libevent.h",
345     "udp/udp_socket_libevent.cc",
346     "udp/udp_socket_libevent.h",
347   ]
348 } else {  # !is_win
349   net_shared_sources -= [
350     "base/winsock_init.cc",
351     "base/winsock_init.h",
352     "base/winsock_util.cc",
353     "base/winsock_util.h",
354     "proxy/proxy_resolver_winhttp.cc",
355     "proxy/proxy_resolver_winhttp.h",
356   ]
359 if (is_ios) {
360   # Add back some sources that were otherwise filtered out. iOS needs some Mac
361   # files.
362   net_shared_unfiltered_sources += [
363     "base/mac/url_conversions.h",
364     "base/mac/url_conversions.mm",
365     "base/network_change_notifier_mac.cc",
366     "base/network_config_watcher_mac.cc",
367     "base/network_interfaces_mac.cc",
368     "base/network_interfaces_mac.h",
369     "base/platform_mime_util_mac.mm",
370     "proxy/proxy_resolver_mac.cc",
371     "proxy/proxy_server_mac.cc",
372   ]
374   net_shared_sources -= [ "disk_cache/blockfile/file_posix.cc" ]
375   net_shared_deps += [
376     "//third_party/nss:nspr",
377     "//third_party/nss",
378     "//net/third_party/nss/ssl:libssl",
379   ]
382 if (is_ios || is_mac) {
383   net_shared_sources += gypi_values.net_base_mac_ios_sources
386 if (is_android) {
387   net_shared_deps += [ ":net_jni_headers" ]
389   # Add some Linux sources that were excluded by the filter, but which
390   # are needed.
391   net_shared_unfiltered_sources += [
392     "base/address_tracker_linux.cc",
393     "base/address_tracker_linux.h",
394     "base/network_interfaces_linux.cc",
395     "base/network_interfaces_linux.h",
396     "base/platform_mime_util_linux.cc",
397   ]
400 component("net") {
401   sources = net_shared_sources
403   # Add back some sources that were otherwise filtered out.
404   set_sources_assignment_filter([])
405   sources += net_shared_unfiltered_sources
406   set_sources_assignment_filter(sources_assignment_filter)
408   cflags = []
409   configs += net_shared_configs
410   public_configs = [ ":net_config" ]
412   public_deps = net_shared_public_deps + [ "//url" ]
413   deps = net_shared_deps
415   if (is_mac) {
416     libs = [
417       "Foundation.framework",
418       "Security.framework",
419       "SystemConfiguration.framework",
420       "resolv",
421     ]
422   }
424   if (is_ios) {
425     libs = [
426       "CFNetwork.framework",
427       "MobileCoreServices.framework",
428       "Security.framework",
429       "SystemConfiguration.framework",
430       "resolv",
431     ]
432   }
434   if (!disable_file_support) {
435     sources += gypi_values.net_file_support_sources
436   }
438   if (!disable_ftp_support) {
439     sources += gypi_values.net_ftp_support_sources
440   }
442   if (enable_websockets) {
443     sources += gypi_values.net_websockets_sources
444   }
446   # ICU support.
447   deps += [
448     "//base:i18n",
449     "//third_party/icu",
450   ]
451   sources += [
452     "base/filename_util_icu.cc",
453     "base/net_string_util_icu.cc",
454     "base/net_util_icu.cc",
455   ]
458 if (is_android) {
459   # Same as net, but with ICU, file, ftp, and websocket support stripped.
460   component("net_small") {
461     sources = net_shared_sources
463     # Add back some sources that were otherwise filtered out.
464     set_sources_assignment_filter([])
465     sources += net_shared_unfiltered_sources
466     set_sources_assignment_filter(sources_assignment_filter)
468     cflags = []
469     defines = []
470     configs += net_shared_configs
471     public_configs = [ ":net_config" ]
473     public_deps = net_shared_public_deps +
474                   [ "//url:url_lib_use_icu_alternatives_on_android" ]
475     deps = net_shared_deps + [ ":net_jni_headers" ]
477     defines += [
478       "DISABLE_FILE_SUPPORT",
479       "DISABLE_FTP_SUPPORT",
480       "USE_ICU_ALTERNATIVES_ON_ANDROID=1",
481     ]
483     # Use ICU alternative on Android.
484     sources += [
485       "base/net_string_util_icu_alternatives_android.cc",
486       "base/net_string_util_icu_alternatives_android.h",
487     ]
488   }
491 grit("net_resources") {
492   source = "base/net_resources.grd"
493   use_qualified_include = true
494   outputs = [
495     "grit/net_resources.h",
496     "net_resources.pak",
497   ]
500 proto_library("net_quic_proto") {
501   visibility = [
502     ":net",
503     ":net_small",
504   ]
506   sources = [
507     "quic/proto/cached_network_parameters.proto",
508     "quic/proto/source_address_token.proto",
509   ]
510   cc_generator_options = "dllexport_decl=NET_EXPORT_PRIVATE:"
511   cc_include = "net/base/net_export.h"
513   defines = [ "NET_IMPLEMENTATION" ]
515   extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
518 static_library("extras") {
519   sources = gypi_values.net_extras_sources
520   configs += [ "//build/config/compiler:wexit_time_destructors" ]
521   deps = [
522     ":net",
523     "//base",
524     "//sql:sql",
525   ]
528 static_library("http_server") {
529   sources = [
530     "server/http_connection.cc",
531     "server/http_connection.h",
532     "server/http_server.cc",
533     "server/http_server.h",
534     "server/http_server_request_info.cc",
535     "server/http_server_request_info.h",
536     "server/http_server_response_info.cc",
537     "server/http_server_response_info.h",
538     "server/web_socket.cc",
539     "server/web_socket.h",
540     "server/web_socket_encoder.cc",
541     "server/web_socket_encoder.h",
542   ]
543   configs += [
544     "//build/config/compiler:no_size_t_to_int_warning",
545     "//build/config/compiler:wexit_time_destructors",
546   ]
547   deps = [
548     ":net",
549     "//base",
550   ]
553 executable("dump_cache") {
554   testonly = true
555   sources = [
556     "tools/dump_cache/dump_cache.cc",
557     "tools/dump_cache/dump_files.cc",
558     "tools/dump_cache/dump_files.h",
559   ]
561   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
562   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
564   deps = [
565     ":net",
566     ":test_support",
567     "//base",
568     "//build/config/sanitizers:deps",
569   ]
572 source_set("test_support") {
573   testonly = true
574   sources = [
575     "base/load_timing_info_test_util.cc",
576     "base/load_timing_info_test_util.h",
577     "base/mock_file_stream.cc",
578     "base/mock_file_stream.h",
579     "base/test_completion_callback.cc",
580     "base/test_completion_callback.h",
581     "base/test_data_directory.cc",
582     "base/test_data_directory.h",
583     "cert/mock_cert_verifier.cc",
584     "cert/mock_cert_verifier.h",
585     "cookies/cookie_monster_store_test.cc",
586     "cookies/cookie_monster_store_test.h",
587     "cookies/cookie_store_test_callbacks.cc",
588     "cookies/cookie_store_test_callbacks.h",
589     "cookies/cookie_store_test_helpers.cc",
590     "cookies/cookie_store_test_helpers.h",
591     "disk_cache/disk_cache_test_base.cc",
592     "disk_cache/disk_cache_test_base.h",
593     "disk_cache/disk_cache_test_util.cc",
594     "disk_cache/disk_cache_test_util.h",
595     "dns/dns_test_util.cc",
596     "dns/dns_test_util.h",
597     "dns/mock_host_resolver.cc",
598     "dns/mock_host_resolver.h",
599     "dns/mock_mdns_socket_factory.cc",
600     "dns/mock_mdns_socket_factory.h",
601     "http/http_transaction_test_util.cc",
602     "http/http_transaction_test_util.h",
603     "log/test_net_log.cc",
604     "log/test_net_log.h",
605     "log/test_net_log_entry.cc",
606     "log/test_net_log_entry.h",
607     "log/test_net_log_util.cc",
608     "log/test_net_log_util.h",
609     "proxy/mock_proxy_resolver.cc",
610     "proxy/mock_proxy_resolver.h",
611     "proxy/mock_proxy_script_fetcher.cc",
612     "proxy/mock_proxy_script_fetcher.h",
613     "proxy/proxy_config_service_common_unittest.cc",
614     "proxy/proxy_config_service_common_unittest.h",
615     "socket/socket_test_util.cc",
616     "socket/socket_test_util.h",
617     "test/cert_test_util.cc",
618     "test/cert_test_util.h",
619     "test/cert_test_util_nss.cc",
620     "test/channel_id_test_util.cc",
621     "test/channel_id_test_util.h",
622     "test/ct_test_util.cc",
623     "test/ct_test_util.h",
624     "test/embedded_test_server/embedded_test_server.cc",
625     "test/embedded_test_server/embedded_test_server.h",
626     "test/embedded_test_server/http_connection.cc",
627     "test/embedded_test_server/http_connection.h",
628     "test/embedded_test_server/http_request.cc",
629     "test/embedded_test_server/http_request.h",
630     "test/embedded_test_server/http_response.cc",
631     "test/embedded_test_server/http_response.h",
632     "test/embedded_test_server/stream_listen_socket.cc",
633     "test/embedded_test_server/stream_listen_socket.h",
634     "test/embedded_test_server/tcp_listen_socket.cc",
635     "test/embedded_test_server/tcp_listen_socket.h",
636     "test/event_waiter.h",
637     "test/net_test_suite.cc",
638     "test/net_test_suite.h",
639     "test/python_utils.cc",
640     "test/python_utils.h",
641     "test/url_request/ssl_certificate_error_job.cc",
642     "test/url_request/ssl_certificate_error_job.h",
643     "test/url_request/url_request_failed_job.cc",
644     "test/url_request/url_request_failed_job.h",
645     "test/url_request/url_request_mock_data_job.cc",
646     "test/url_request/url_request_mock_data_job.h",
647     "test/url_request/url_request_slow_download_job.cc",
648     "test/url_request/url_request_slow_download_job.h",
649     "url_request/test_url_fetcher_factory.cc",
650     "url_request/test_url_fetcher_factory.h",
651     "url_request/url_request_test_util.cc",
652     "url_request/url_request_test_util.h",
653   ]
654   if (!is_ios) {
655     sources += [
656       "test/spawned_test_server/base_test_server.cc",
657       "test/spawned_test_server/base_test_server.h",
658       "test/spawned_test_server/local_test_server.cc",
659       "test/spawned_test_server/local_test_server.h",
660       "test/spawned_test_server/local_test_server_posix.cc",
661       "test/spawned_test_server/local_test_server_win.cc",
662       "test/spawned_test_server/spawned_test_server.h",
663     ]
664   }
666   configs += [
667     "//build/config:precompiled_headers",
669     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
670     "//build/config/compiler:no_size_t_to_int_warning",
671   ]
673   public_deps = [
674     "//base",
675     "//base/test:test_support",
676     "//crypto",
677     "//net",
678     "//net/tools/tld_cleanup",
679     "//testing/gmock",
680     "//testing/gtest",
681     "//url",
682   ]
684   if (!is_ios) {
685     public_deps += [ "//third_party/protobuf:py_proto" ]
686   }
688   if (use_nss_certs || is_ios) {
689     public_deps += [ "//crypto:platform" ]
690   }
692   if (is_android) {
693     sources += [
694       "test/spawned_test_server/remote_test_server.cc",
695       "test/spawned_test_server/remote_test_server.h",
696       "test/spawned_test_server/spawner_communicator.cc",
697       "test/spawned_test_server/spawner_communicator.h",
698     ]
699   }
701   if (use_v8_in_net) {
702     public_deps += [ ":net_with_v8" ]
703   }
705   if (!enable_mdns) {
706     sources -= [
707       "dns/mock_mdns_socket_factory.cc",
708       "dns/mock_mdns_socket_factory.h",
709     ]
710   }
712   if (!use_nss_certs) {
713     sources -= [ "test/cert_test_util_nss.cc" ]
714   }
716   if (!disable_file_support) {
717     sources += [
718       "test/url_request/url_request_mock_http_job.cc",
719       "test/url_request/url_request_mock_http_job.h",
720       "url_request/test_url_request_interceptor.cc",
721       "url_request/test_url_request_interceptor.h",
722     ]
723   }
726 source_set("balsa") {
727   sources = [
728     "tools/balsa/balsa_enums.h",
729     "tools/balsa/balsa_frame.cc",
730     "tools/balsa/balsa_frame.h",
731     "tools/balsa/balsa_headers.cc",
732     "tools/balsa/balsa_headers.h",
733     "tools/balsa/balsa_headers_token_utils.cc",
734     "tools/balsa/balsa_headers_token_utils.h",
735     "tools/balsa/balsa_visitor_interface.h",
736     "tools/balsa/http_message_constants.cc",
737     "tools/balsa/http_message_constants.h",
738     "tools/balsa/noop_balsa_visitor.h",
739     "tools/balsa/simple_buffer.cc",
740     "tools/balsa/simple_buffer.h",
741     "tools/balsa/split.cc",
742     "tools/balsa/split.h",
743     "tools/balsa/string_piece_utils.h",
744     "tools/quic/spdy_balsa_utils.cc",
745     "tools/quic/spdy_balsa_utils.h",
746   ]
747   deps = [
748     ":net",
749     "//base",
750     "//url",
751   ]
754 if (use_v8_in_net) {
755   component("net_with_v8") {
756     sources = [
757       "proxy/proxy_resolver_v8.cc",
758       "proxy/proxy_resolver_v8.h",
759       "proxy/proxy_resolver_v8_tracing.cc",
760       "proxy/proxy_resolver_v8_tracing.h",
761       "proxy/proxy_resolver_v8_tracing_wrapper.cc",
762       "proxy/proxy_resolver_v8_tracing_wrapper.h",
763       "proxy/proxy_service_v8.cc",
764       "proxy/proxy_service_v8.h",
765     ]
767     defines = [ "NET_IMPLEMENTATION" ]
768     configs += [
769       "//build/config/compiler:no_size_t_to_int_warning",
770       "//build/config/compiler:wexit_time_destructors",
771     ]
773     public_deps = [
774       ":net",
775     ]
776     deps = [
777       "//base",
778       "//gin",
779       "//url",
780       "//v8",
781     ]
782   }
785 if (use_v8_in_net && !is_android) {
786   source_set("net_browser_services") {
787     sources = [
788       "dns/mojo_host_resolver_impl.cc",
789       "dns/mojo_host_resolver_impl.h",
790       "proxy/in_process_mojo_proxy_resolver_factory.cc",
791       "proxy/in_process_mojo_proxy_resolver_factory.h",
792       "proxy/mojo_proxy_resolver_factory.h",
793       "proxy/proxy_resolver_factory_mojo.cc",
794       "proxy/proxy_resolver_factory_mojo.h",
795       "proxy/proxy_service_mojo.cc",
796       "proxy/proxy_service_mojo.h",
797     ]
799     public_deps = [
800       ":mojo_type_converters",
801       ":net",
802       "//base",
803       "//mojo/common",
804       "//net/interfaces",
805       "//third_party/mojo/src/mojo/public/cpp/bindings",
807       # NOTE(amistry): As long as we support in-process Mojo v8 PAC, we need
808       # this dependency since in_process_mojo_proxy_resolver_factory creates
809       # the utility process side Mojo services in the browser process.
810       # Ultimately, this will go away when we only support out-of-process.
811       ":net_utility_services",
812     ]
813   }
815   source_set("mojo_type_converters") {
816     sources = [
817       "dns/mojo_host_type_converters.cc",
818       "dns/mojo_host_type_converters.h",
819       "proxy/mojo_proxy_type_converters.cc",
820       "proxy/mojo_proxy_type_converters.h",
821     ]
823     public_deps = [
824       ":net",
825       "//net/interfaces",
826       "//third_party/mojo/src/mojo/public/cpp/bindings",
827     ]
828   }
830   source_set("net_utility_services") {
831     sources = [
832       "dns/host_resolver_mojo.cc",
833       "dns/host_resolver_mojo.h",
834       "proxy/mojo_proxy_resolver_factory_impl.cc",
835       "proxy/mojo_proxy_resolver_factory_impl.h",
836       "proxy/mojo_proxy_resolver_impl.cc",
837       "proxy/mojo_proxy_resolver_impl.h",
838       "proxy/mojo_proxy_resolver_v8_tracing_bindings.h",
839     ]
841     deps = [
842       ":net_with_v8",
843     ]
845     public_deps = [
846       ":mojo_type_converters",
847       ":net",
848       "//mojo/common",
849       "//net/interfaces",
850       "//third_party/mojo/src/mojo/public/cpp/bindings",
851     ]
852   }
855 if (!is_ios && !is_android) {
856   executable("crash_cache") {
857     testonly = true
858     sources = [
859       "tools/crash_cache/crash_cache.cc",
860     ]
862     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
863     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
864     deps = [
865       ":net",
866       ":test_support",
867       "//base",
868       "//build/config/sanitizers:deps",
869     ]
870   }
872   executable("crl_set_dump") {
873     testonly = true
874     sources = [
875       "tools/crl_set_dump/crl_set_dump.cc",
876     ]
878     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
879     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
880     deps = [
881       ":net",
882       "//base",
883       "//build/config/sanitizers:deps",
884     ]
885   }
887   executable("dns_fuzz_stub") {
888     testonly = true
889     sources = [
890       "tools/dns_fuzz_stub/dns_fuzz_stub.cc",
891     ]
893     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
894     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
895     deps = [
896       ":net",
897       "//base",
898       "//build/config/sanitizers:deps",
899     ]
900   }
902   executable("gdig") {
903     testonly = true
904     sources = [
905       "tools/gdig/file_net_log.cc",
906       "tools/gdig/gdig.cc",
907     ]
908     deps = [
909       ":net",
910       "//base",
911       "//build/config/sanitizers:deps",
912     ]
913   }
915   executable("get_server_time") {
916     testonly = true
917     sources = [
918       "tools/get_server_time/get_server_time.cc",
919     ]
921     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
922     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
923     deps = [
924       ":net",
925       "//base",
926       "//base:i18n",
927       "//build/config/sanitizers:deps",
928       "//url",
929     ]
930   }
932   executable("hpack_example_generator") {
933     testonly = true
934     sources = [
935       "spdy/fuzzing/hpack_example_generator.cc",
936     ]
938     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
939     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
940     deps = [
941       ":net",
942       "//base",
943       "//build/config/sanitizers:deps",
944     ]
945   }
947   executable("hpack_fuzz_mutator") {
948     testonly = true
949     sources = [
950       "spdy/fuzzing/hpack_fuzz_mutator.cc",
951     ]
953     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
954     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
955     deps = [
956       ":net",
957       "//base",
958       "//build/config/sanitizers:deps",
959     ]
960   }
962   executable("hpack_fuzz_wrapper") {
963     testonly = true
964     sources = [
965       "spdy/fuzzing/hpack_fuzz_wrapper.cc",
966     ]
968     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
969     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
970     deps = [
971       ":net",
972       "//base",
973       "//build/config/sanitizers:deps",
974     ]
975   }
977   if (use_v8_in_net) {
978     executable("net_watcher") {
979       testonly = true
980       sources = [
981         "tools/net_watcher/net_watcher.cc",
982       ]
983       deps = [
984         ":net",
985         ":net_with_v8",
986         "//base",
987         "//build/config/sanitizers:deps",
988       ]
990       if (is_desktop_linux) {
991         configs += [
992           "//build/config/linux:gconf",
993           "//build/config/linux:glib",
994         ]
995         deps += [ "//build/linux:gio" ]
996       }
997     }
998   }
1000   executable("run_testserver") {
1001     testonly = true
1002     sources = [
1003       "tools/testserver/run_testserver.cc",
1004     ]
1005     deps = [
1006       ":test_support",
1007       "//base",
1008       "//base/test:test_support",
1009       "//build/config/sanitizers:deps",
1010       "//testing/gtest",
1011     ]
1012   }
1014   executable("stress_cache") {
1015     testonly = true
1016     sources = [
1017       "tools/stress_cache/stress_cache.cc",
1018     ]
1020     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1021     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1022     deps = [
1023       ":net",
1024       ":test_support",
1025       "//base",
1026       "//build/config/sanitizers:deps",
1027     ]
1028   }
1030   executable("tld_cleanup") {
1031     sources = [
1032       "tools/tld_cleanup/tld_cleanup.cc",
1033     ]
1035     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1036     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1037     deps = [
1038       "//base",
1039       "//base:i18n",
1040       "//build/config/sanitizers:deps",
1041       "//net/tools/tld_cleanup",
1042     ]
1043   }
1046 if (is_linux) {
1047   static_library("epoll_server") {
1048     sources = [
1049       "tools/epoll_server/epoll_server.cc",
1050       "tools/epoll_server/epoll_server.h",
1051     ]
1052     deps = [
1053       ":net",
1054       "//base",
1055     ]
1056   }
1058   static_library("flip_in_mem_edsm_server_base") {
1059     testonly = true
1060     sources = [
1061       "tools/flip_server/acceptor_thread.cc",
1062       "tools/flip_server/acceptor_thread.h",
1063       "tools/flip_server/constants.h",
1064       "tools/flip_server/create_listener.cc",
1065       "tools/flip_server/create_listener.h",
1066       "tools/flip_server/flip_config.cc",
1067       "tools/flip_server/flip_config.h",
1068       "tools/flip_server/http_interface.cc",
1069       "tools/flip_server/http_interface.h",
1070       "tools/flip_server/loadtime_measurement.h",
1071       "tools/flip_server/mem_cache.cc",
1072       "tools/flip_server/mem_cache.h",
1073       "tools/flip_server/output_ordering.cc",
1074       "tools/flip_server/output_ordering.h",
1075       "tools/flip_server/ring_buffer.cc",
1076       "tools/flip_server/ring_buffer.h",
1077       "tools/flip_server/sm_connection.cc",
1078       "tools/flip_server/sm_connection.h",
1079       "tools/flip_server/sm_interface.h",
1080       "tools/flip_server/spdy_interface.cc",
1081       "tools/flip_server/spdy_interface.h",
1082       "tools/flip_server/spdy_ssl.cc",
1083       "tools/flip_server/spdy_ssl.h",
1084       "tools/flip_server/spdy_util.cc",
1085       "tools/flip_server/spdy_util.h",
1086       "tools/flip_server/streamer_interface.cc",
1087       "tools/flip_server/streamer_interface.h",
1088       "tools/flip_server/url_to_filename_encoder.cc",
1089       "tools/flip_server/url_to_filename_encoder.h",
1090       "tools/flip_server/url_utilities.cc",
1091       "tools/flip_server/url_utilities.h",
1092     ]
1093     deps = [
1094       ":balsa",
1095       ":epoll_server",
1096       ":net",
1097       "//base",
1098       "//third_party/boringssl",
1099     ]
1100   }
1102   executable("flip_in_mem_edsm_server_unittests") {
1103     testonly = true
1104     sources = [
1105       "tools/flip_server/flip_test_utils.cc",
1106       "tools/flip_server/flip_test_utils.h",
1107       "tools/flip_server/http_interface_test.cc",
1108       "tools/flip_server/mem_cache_test.cc",
1109       "tools/flip_server/run_all_tests.cc",
1110       "tools/flip_server/spdy_interface_test.cc",
1111       "tools/flip_server/url_to_filename_encoder_unittest.cc",
1112       "tools/flip_server/url_utilities_unittest.cc",
1113     ]
1114     deps = [
1115       ":balsa",
1116       ":flip_in_mem_edsm_server_base",
1117       ":net",
1118       ":test_support",
1119       "//build/config/sanitizers:deps",
1120       "//testing/gtest",
1121       "//testing/gmock",
1122       "//third_party/boringssl",
1123     ]
1124   }
1126   executable("flip_in_mem_edsm_server") {
1127     testonly = true
1128     sources = [
1129       "tools/flip_server/flip_in_mem_edsm_server.cc",
1130     ]
1131     deps = [
1132       ":balsa",
1133       ":flip_in_mem_edsm_server_base",
1134       ":net",
1135       "//base",
1136       "//build/config/sanitizers:deps",
1137     ]
1138   }
1140   source_set("epoll_quic_tools") {
1141     sources = [
1142       "tools/quic/quic_client.cc",
1143       "tools/quic/quic_client.h",
1144       "tools/quic/quic_default_packet_writer.cc",
1145       "tools/quic/quic_default_packet_writer.h",
1146       "tools/quic/quic_epoll_clock.cc",
1147       "tools/quic/quic_epoll_clock.h",
1148       "tools/quic/quic_epoll_connection_helper.cc",
1149       "tools/quic/quic_epoll_connection_helper.h",
1150       "tools/quic/quic_packet_reader.cc",
1151       "tools/quic/quic_packet_reader.h",
1152       "tools/quic/quic_packet_writer_wrapper.cc",
1153       "tools/quic/quic_packet_writer_wrapper.h",
1154       "tools/quic/quic_server.cc",
1155       "tools/quic/quic_server.h",
1156       "tools/quic/quic_socket_utils.cc",
1157       "tools/quic/quic_socket_utils.h",
1158     ]
1159     deps = [
1160       ":balsa",
1161       ":epoll_server",
1162       ":net",
1163       "//base",
1164       "//base/third_party/dynamic_annotations",
1165       "//crypto",
1166       "//third_party/boringssl",
1167       "//url",
1168     ]
1169   }
1171   executable("epoll_quic_client") {
1172     sources = [
1173       "tools/quic/quic_client_bin.cc",
1174     ]
1175     deps = [
1176       ":balsa",
1177       ":epoll_server",
1178       ":epoll_quic_tools",
1179       ":net",
1180       ":simple_quic_tools",
1181       "//base",
1182       "//build/config/sanitizers:deps",
1183       "//third_party/boringssl",
1184     ]
1185   }
1187   executable("epoll_quic_server") {
1188     sources = [
1189       "tools/quic/quic_server_bin.cc",
1190     ]
1191     deps = [
1192       ":balsa",
1193       ":epoll_server",
1194       ":epoll_quic_tools",
1195       ":net",
1196       ":simple_quic_tools",
1197       "//base",
1198       "//build/config/sanitizers:deps",
1199       "//third_party/boringssl",
1200     ]
1201   }
1204 if (is_android) {
1205   generate_jni("net_jni_headers") {
1206     sources = [
1207       "android/java/src/org/chromium/net/AndroidCertVerifyResult.java",
1208       "android/java/src/org/chromium/net/AndroidKeyStore.java",
1209       "android/java/src/org/chromium/net/AndroidNetworkLibrary.java",
1210       "android/java/src/org/chromium/net/AndroidPrivateKey.java",
1211       "android/java/src/org/chromium/net/GURLUtils.java",
1212       "android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java",
1213       "android/java/src/org/chromium/net/NetStringUtil.java",
1214       "android/java/src/org/chromium/net/NetworkChangeNotifier.java",
1215       "android/java/src/org/chromium/net/ProxyChangeListener.java",
1216       "android/java/src/org/chromium/net/X509Util.java",
1217     ]
1218     jni_package = "net"
1219   }
1220   generate_jni("net_test_jni_headers") {
1221     sources = [
1222       "android/javatests/src/org/chromium/net/AndroidKeyStoreTestUtil.java",
1223       "test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticator.java",
1224     ]
1225     jni_package = "net/test"
1226   }
1229 if (is_android || is_linux) {
1230   executable("disk_cache_memory_test") {
1231     testonly = true
1232     sources = [
1233       "tools/disk_cache_memory_test/disk_cache_memory_test.cc",
1234     ]
1235     deps = [
1236       ":net",
1237       "//base",
1238       "//build/config/sanitizers:deps",
1239     ]
1240   }
1243 source_set("simple_quic_tools") {
1244   sources = [
1245     "tools/quic/quic_client_base.cc",
1246     "tools/quic/quic_client_base.h",
1247     "tools/quic/quic_client_session.cc",
1248     "tools/quic/quic_client_session.h",
1249     "tools/quic/quic_dispatcher.cc",
1250     "tools/quic/quic_dispatcher.h",
1251     "tools/quic/quic_in_memory_cache.cc",
1252     "tools/quic/quic_in_memory_cache.h",
1253     "tools/quic/quic_per_connection_packet_writer.cc",
1254     "tools/quic/quic_per_connection_packet_writer.h",
1255     "tools/quic/quic_server_session.cc",
1256     "tools/quic/quic_server_session.h",
1257     "tools/quic/quic_simple_client.cc",
1258     "tools/quic/quic_simple_client.h",
1259     "tools/quic/quic_simple_per_connection_packet_writer.cc",
1260     "tools/quic/quic_simple_per_connection_packet_writer.h",
1261     "tools/quic/quic_simple_server.cc",
1262     "tools/quic/quic_simple_server.h",
1263     "tools/quic/quic_simple_server_packet_writer.cc",
1264     "tools/quic/quic_simple_server_packet_writer.h",
1265     "tools/quic/quic_spdy_client_stream.cc",
1266     "tools/quic/quic_spdy_client_stream.h",
1267     "tools/quic/quic_spdy_server_stream.cc",
1268     "tools/quic/quic_spdy_server_stream.h",
1269     "tools/quic/quic_time_wait_list_manager.cc",
1270     "tools/quic/quic_time_wait_list_manager.h",
1271     "tools/quic/synchronous_host_resolver.cc",
1272     "tools/quic/synchronous_host_resolver.h",
1273   ]
1274   deps = [
1275     ":net",
1276     "//base",
1277     "//base/third_party/dynamic_annotations",
1278     "//url",
1279   ]
1282 if (!is_ios) {
1283   executable("quic_client") {
1284     sources = [
1285       "tools/quic/quic_simple_client_bin.cc",
1286     ]
1287     deps = [
1288       ":net",
1289       ":simple_quic_tools",
1290       "//base",
1291       "//build/config/sanitizers:deps",
1292       "//url",
1293     ]
1294   }
1295   executable("quic_server") {
1296     sources = [
1297       "tools/quic/quic_simple_server_bin.cc",
1298     ]
1299     deps = [
1300       ":net",
1301       ":simple_quic_tools",
1302       "//base",
1303       "//build/config/sanitizers:deps",
1304       "//third_party/boringssl",
1305       "//third_party/protobuf:protobuf_lite",
1306     ]
1307   }
1310 # TODO(GYP): Delete this after we've converted everything to GN.
1311 # The _run targets exist only for compatibility w/ GYP.
1312 group("net_unittests_run") {
1313   testonly = true
1314   deps = [
1315     ":net_unittests",
1316   ]
1319 test("net_unittests") {
1320   sources = gypi_values.net_test_sources
1322   if (is_ios) {
1323     sources -= [
1324       "websockets/websocket_stream_cookie_test.cc",
1325       "websockets/websocket_stream_create_test_base.cc",
1326       "websockets/websocket_stream_create_test_base.h",
1327     ]
1328   }
1330   configs += [
1331     "//build/config:precompiled_headers",
1333     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1334     "//build/config/compiler:no_size_t_to_int_warning",
1335   ]
1336   defines = []
1338   deps = [
1339     ":balsa",
1340     ":extras",
1341     ":http_server",
1342     ":net",
1343     ":simple_quic_tools",
1344     ":test_support",
1345     "//base",
1346     "//base:i18n",
1347     "//base:prefs_test_support",
1348     "//base/allocator",
1349     "//base/third_party/dynamic_annotations",
1350     "//crypto",
1351     "//crypto:platform",
1352     "//crypto:test_support",
1353     "//gin",
1354     "//net/base/registry_controlled_domains",
1355     "//sql",
1356     "//testing/gmock",
1357     "//testing/gtest",
1358     "//third_party/zlib",
1359     "//url",
1360   ]
1362   data = [
1363     "data/",
1364   ]
1366   if (is_linux || is_mac || is_win) {
1367     deps += [
1368       "//third_party/pyftpdlib/",
1369       "//third_party/pywebsocket/",
1370       "//third_party/tlslite/",
1371     ]
1372     data_deps = [
1373       "//third_party/pyftpdlib/",
1374       "//third_party/pywebsocket/",
1375       "//third_party/tlslite/",
1376     ]
1377     data += [
1378       "tools/testserver/",
1379       "//third_party/pyftpdlib/",
1380       "//third_party/pywebsocket/",
1381       "//third_party/tlslite/",
1382       "$root_out_dir/pyproto/google/",
1383     ]
1384   }
1386   if (is_desktop_linux) {
1387     deps += [ ":epoll_quic_tools" ]
1388   }
1389   if (is_linux) {
1390     sources += gypi_values.net_linux_test_sources
1391     deps += [
1392       ":epoll_quic_tools",
1393       ":epoll_server",
1394       ":flip_in_mem_edsm_server_base",
1395     ]
1396   }
1398   if (is_mac || is_ios) {
1399     sources += gypi_values.net_base_test_mac_ios_sources
1400   }
1402   if (is_chromeos) {
1403     sources -= [ "proxy/proxy_config_service_linux_unittest.cc" ]
1404   }
1406   if (v8_use_external_startup_data) {
1407     deps += [ "//gin" ]
1408   }
1410   if (!use_nss_certs) {
1411     sources -= [
1412       "cert/nss_cert_database_unittest.cc",
1413       "ssl/client_cert_store_nss_unittest.cc",
1414     ]
1415     if (is_chromeos) {  # Already removed for all non-ChromeOS builds.
1416       sources -= [
1417         "cert/nss_cert_database_chromeos_unittest.cc",
1418         "cert/nss_profile_filter_chromeos_unittest.cc",
1419       ]
1420     }
1421   }
1423   if (use_openssl) {
1424     # When building for OpenSSL, we need to exclude NSS specific tests
1425     # or functionality not supported by OpenSSL yet.
1426     # TODO(bulach): Add equivalent tests when the underlying
1427     #               functionality is ported to OpenSSL.
1428     sources -= [ "quic/test_tools/crypto_test_utils_nss.cc" ]
1429   } else {
1430     sources -= [
1431       "cert/x509_util_openssl_unittest.cc",
1432       "quic/test_tools/crypto_test_utils_openssl.cc",
1433       "socket/ssl_client_socket_openssl_unittest.cc",
1434       "ssl/ssl_client_session_cache_openssl_unittest.cc",
1435     ]
1436   }
1438   if (use_kerberos) {
1439     defines += [ "USE_KERBEROS" ]
1440   }
1442   # These are excluded on Android, because the actual Kerberos support, which
1443   # these test, is in a separate app on Android.
1444   if (!use_kerberos || is_android) {
1445     sources -= [
1446       "http/http_auth_gssapi_posix_unittest.cc",
1447       "http/mock_gssapi_library_posix.cc",
1448       "http/mock_gssapi_library_posix.h",
1449     ]
1450   }
1451   if (!use_kerberos) {
1452     sources -= [ "http/http_auth_handler_negotiate_unittest.cc" ]
1453   }
1455   if (use_openssl || (!is_desktop_linux && !is_chromeos && !is_ios)) {
1456     # Only include this test when on Posix and using NSS for
1457     # cert verification or on iOS (which also uses NSS for certs).
1458     sources -= [ "cert_net/nss_ocsp_unittest.cc" ]
1459   }
1461   if (!use_openssl_certs) {
1462     sources -= [ "ssl/openssl_client_key_store_unittest.cc" ]
1463   }
1465   if (!enable_websockets) {
1466     sources -= [
1467       "server/http_connection_unittest.cc",
1468       "server/http_server_response_info_unittest.cc",
1469       "server/http_server_unittest.cc",
1470       "server/web_socket_encoder_unittest.cc",
1471       "websockets/websocket_basic_stream_test.cc",
1472       "websockets/websocket_channel_test.cc",
1473       "websockets/websocket_deflate_predictor_impl_test.cc",
1474       "websockets/websocket_deflate_stream_test.cc",
1475       "websockets/websocket_deflater_test.cc",
1476       "websockets/websocket_end_to_end_test.cc",
1477       "websockets/websocket_errors_test.cc",
1478       "websockets/websocket_extension_parser_test.cc",
1479       "websockets/websocket_frame_parser_test.cc",
1480       "websockets/websocket_frame_test.cc",
1481       "websockets/websocket_handshake_challenge_test.cc",
1482       "websockets/websocket_handshake_stream_create_helper_test.cc",
1483       "websockets/websocket_inflater_test.cc",
1484       "websockets/websocket_stream_test.cc",
1485       "websockets/websocket_test_util.cc",
1486       "websockets/websocket_test_util.h",
1487     ]
1488     deps -= [ ":http_server" ]
1489   }
1491   if (disable_file_support) {
1492     sources -= [
1493       "base/directory_lister_unittest.cc",
1494       "url_request/url_request_file_job_unittest.cc",
1495     ]
1496   }
1498   if (disable_ftp_support) {
1499     sources -= [
1500       "ftp/ftp_auth_cache_unittest.cc",
1501       "ftp/ftp_ctrl_response_buffer_unittest.cc",
1502       "ftp/ftp_directory_listing_parser_ls_unittest.cc",
1503       "ftp/ftp_directory_listing_parser_unittest.cc",
1504       "ftp/ftp_directory_listing_parser_unittest.h",
1505       "ftp/ftp_directory_listing_parser_vms_unittest.cc",
1506       "ftp/ftp_directory_listing_parser_windows_unittest.cc",
1507       "ftp/ftp_network_transaction_unittest.cc",
1508       "ftp/ftp_util_unittest.cc",
1509       "url_request/url_request_ftp_job_unittest.cc",
1510     ]
1511   }
1513   if (!enable_built_in_dns) {
1514     sources -= [
1515       "dns/address_sorter_posix_unittest.cc",
1516       "dns/address_sorter_unittest.cc",
1517     ]
1518   }
1520   if (use_v8_in_net) {
1521     deps += [ ":net_with_v8" ]
1522   } else {
1523     sources -= [
1524       "proxy/proxy_resolver_v8_tracing_unittest.cc",
1525       "proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc",
1526       "proxy/proxy_resolver_v8_unittest.cc",
1527     ]
1528   }
1530   if (use_v8_in_net && !is_android) {
1531     deps += [
1532       ":net_browser_services",
1533       ":net_utility_services",
1534       "//mojo/environment:chromium",
1535       "//third_party/mojo/src/mojo/edk/system",
1536     ]
1537   } else {
1538     sources -= [
1539       "dns/host_resolver_mojo_unittest.cc",
1540       "dns/mojo_host_resolver_impl_unittest.cc",
1541       "proxy/mojo_proxy_resolver_factory_impl_unittest.cc",
1542       "proxy/mojo_proxy_resolver_impl_unittest.cc",
1543       "proxy/mojo_proxy_resolver_v8_tracing_bindings_unittest.cc",
1544       "proxy/proxy_resolver_factory_mojo_unittest.cc",
1545       "proxy/proxy_service_mojo_unittest.cc",
1546     ]
1547   }
1549   if (!enable_mdns) {
1550     sources -= [
1551       "dns/mdns_cache_unittest.cc",
1552       "dns/mdns_client_unittest.cc",
1553       "dns/record_parsed_unittest.cc",
1554       "dns/record_rdata_unittest.cc",
1555     ]
1556   }
1558   if (is_ios) {
1559     # TODO(GYP)
1560     #  'actions': [
1561     #    {
1562     #      'action_name': 'copy_test_data',
1563     #      'variables': {
1564     #        'test_data_files': [
1565     #          'data/ssl/certificates/',
1566     #          'data/test.html',
1567     #          'data/url_request_unittest/',
1568     #          'data/verify_name_match_unittest/names/',
1569     #          'data/parse_certificate_unittest/',
1570     #        ],
1571     #        'test_data_prefix': 'net',
1572     #      },
1573     #      'includes': [ '../build/copy_test_data_ios.gypi' ],
1574     #    },
1575     #  ],
1576     sources -= [
1577       # TODO(droger): The following tests are disabled because the
1578       # implementation is missing or incomplete.
1579       # KeygenHandler::GenKeyAndSignChallenge() is not ported to iOS.
1580       "base/keygen_handler_unittest.cc",
1581       "disk_cache/backend_unittest.cc",
1582       "disk_cache/blockfile/block_files_unittest.cc",
1584       # Need to read input data files.
1585       "filter/gzip_filter_unittest.cc",
1586       "socket/ssl_server_socket_unittest.cc",
1587       "spdy/fuzzing/hpack_fuzz_util_test.cc",
1589       # Need TestServer.
1590       "cert_net/cert_net_fetcher_impl_unittest.cc",
1591       "proxy/proxy_script_fetcher_impl_unittest.cc",
1592       "socket/ssl_client_socket_unittest.cc",
1593       "url_request/url_fetcher_impl_unittest.cc",
1594       "url_request/url_request_context_builder_unittest.cc",
1596       # Needs GetAppOutput().
1597       "test/python_utils_unittest.cc",
1599       # The following tests are disabled because they don't apply to
1600       # iOS.
1601       # OS is not "linux" or "freebsd" or "openbsd".
1602       "socket/unix_domain_client_socket_posix_unittest.cc",
1603       "socket/unix_domain_server_socket_posix_unittest.cc",
1605       # See bug http://crbug.com/344533.
1606       "disk_cache/blockfile/index_table_v3_unittest.cc",
1607     ]
1608   }
1610   if (is_android) {
1611     sources -= [
1612       # See bug http://crbug.com/344533.
1613       "disk_cache/blockfile/index_table_v3_unittest.cc",
1614       "dns/dns_config_service_posix_unittest.cc",
1615     ]
1616     deps += [
1617       ":net_test_jni_headers",
1619       # TODO(mmenke):  This depends on test_support_base, which depends on
1620       #                icu.  Figure out a way to remove that dependency.
1621       "//testing/android/native_test:native_test_native_code",
1622     ]
1623     set_sources_assignment_filter([])
1624     sources += [ "base/address_tracker_linux_unittest.cc" ]
1625     set_sources_assignment_filter(sources_assignment_filter)
1626     isolate_file = "net_unittests.isolate"
1627   }
1629   # Symbols for crashes when running tests on swarming.
1630   if (symbol_level > 0) {
1631     if (is_win) {
1632       data += [ "$root_out_dir/net_unittests.exe.pdb" ]
1633     } else if (is_mac) {
1634       data += [ "$root_out_dir/net_unittests.dSYM/" ]
1635     }
1636   }
1639 # !is_android && !is_win && !is_mac
1641 executable("net_perftests") {
1642   testonly = true
1643   sources = [
1644     "base/mime_sniffer_perftest.cc",
1645     "cookies/cookie_monster_perftest.cc",
1646     "disk_cache/blockfile/disk_cache_perftest.cc",
1647     "extras/sqlite/sqlite_persistent_cookie_store_perftest.cc",
1648     "proxy/proxy_resolver_perftest.cc",
1649     "udp/udp_socket_perftest.cc",
1650   ]
1652   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1653   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1654   deps = [
1655     ":extras",
1656     ":net",
1657     ":test_support",
1658     "//base",
1659     "//base:i18n",
1660     "//base/test:test_support_perf",
1661     "//build/config/sanitizers:deps",
1662     "//testing/gtest",
1663     "//url",
1664   ]
1666   if (enable_websockets) {
1667     sources += [ "websockets/websocket_frame_perftest.cc" ]
1668   }
1670   if (use_v8_in_net) {
1671     deps += [ ":net_with_v8" ]
1672   } else {
1673     sources -= [ "proxy/proxy_resolver_perftest.cc" ]
1674   }