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