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