Roll src/third_party/WebKit b877cfb:d0bbdc6 (svn 200241:200242)
[chromium-blink-merge.git] / net / BUILD.gn
blob8db0cfb56aceebc8c76b4d86dae9cdd64901028e
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/crypto.gni")
6 import("//build/config/features.gni")
7 import("//build/config/ui.gni")
8 import("//build/module_args/v8.gni")
9 import("//url/config.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 component("net") {
67   sources =
68       gypi_values.net_nacl_common_sources + gypi_values.net_non_nacl_sources
70   cflags = []
71   defines = [
72     # TODO(GYP) Note that the GYP file supports linux_link_kerberos (defaults to
73     # 0) which implies that we run pkg_config on kerberos and link to that
74     # rather than setting this define which will dynamically open it. That
75     # doesn't seem to be set in the regular builds, so we're skipping this
76     # capability here.
77     "DLOPEN_KERBEROS",
78     "NET_IMPLEMENTATION",
79   ]
81   configs += [
82     "//build/config:precompiled_headers",
84     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
85     "//build/config/compiler:no_size_t_to_int_warning",
86   ]
87   public_configs = [ ":net_config" ]
88   include_dirs = []
90   public_deps = [
91     ":net_quic_proto",
92     "//crypto",
93     "//crypto:platform",
94     "//url",
95   ]
96   deps = [
97     ":net_resources",
98     "//base",
99     "//base:prefs",
100     "//base/third_party/dynamic_annotations",
101     "//net/base/registry_controlled_domains",
102     "//sdch",
103     "//third_party/protobuf:protobuf_lite",
104     "//third_party/zlib",
105     "//url",
106   ]
108   if (use_kerberos) {
109     defines += [ "USE_KERBEROS" ]
110     if (is_android) {
111       include_dirs += [ "/usr/include/kerberosV" ]
112     }
113   } else {
114     sources -= [
115       "http/http_auth_gssapi_posix.cc",
116       "http/http_auth_gssapi_posix.h",
117       "http/http_auth_handler_negotiate.cc",
118       "http/http_auth_handler_negotiate.h",
119     ]
120   }
122   if (is_posix) {
123     if (posix_avoid_mmap) {
124       sources -= [ "disk_cache/blockfile/mapped_file_posix.cc" ]
125     } else {
126       sources -= [ "disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc" ]
127     }
128   }
130   if (disable_file_support) {
131     sources -= [
132       "base/directory_lister.cc",
133       "base/directory_lister.h",
134       "url_request/file_protocol_handler.cc",
135       "url_request/file_protocol_handler.h",
136       "url_request/url_request_file_dir_job.cc",
137       "url_request/url_request_file_dir_job.h",
138       "url_request/url_request_file_job.cc",
139       "url_request/url_request_file_job.h",
140     ]
141   }
143   if (disable_ftp_support) {
144     sources -= [
145       "ftp/ftp_auth_cache.cc",
146       "ftp/ftp_auth_cache.h",
147       "ftp/ftp_ctrl_response_buffer.cc",
148       "ftp/ftp_ctrl_response_buffer.h",
149       "ftp/ftp_directory_listing_parser.cc",
150       "ftp/ftp_directory_listing_parser.h",
151       "ftp/ftp_directory_listing_parser_ls.cc",
152       "ftp/ftp_directory_listing_parser_ls.h",
153       "ftp/ftp_directory_listing_parser_netware.cc",
154       "ftp/ftp_directory_listing_parser_netware.h",
155       "ftp/ftp_directory_listing_parser_os2.cc",
156       "ftp/ftp_directory_listing_parser_os2.h",
157       "ftp/ftp_directory_listing_parser_vms.cc",
158       "ftp/ftp_directory_listing_parser_vms.h",
159       "ftp/ftp_directory_listing_parser_windows.cc",
160       "ftp/ftp_directory_listing_parser_windows.h",
161       "ftp/ftp_network_layer.cc",
162       "ftp/ftp_network_layer.h",
163       "ftp/ftp_network_session.cc",
164       "ftp/ftp_network_session.h",
165       "ftp/ftp_network_transaction.cc",
166       "ftp/ftp_network_transaction.h",
167       "ftp/ftp_request_info.h",
168       "ftp/ftp_response_info.cc",
169       "ftp/ftp_response_info.h",
170       "ftp/ftp_server_type_histograms.cc",
171       "ftp/ftp_server_type_histograms.h",
172       "ftp/ftp_transaction.h",
173       "ftp/ftp_transaction_factory.h",
174       "ftp/ftp_util.cc",
175       "ftp/ftp_util.h",
176       "url_request/ftp_protocol_handler.cc",
177       "url_request/ftp_protocol_handler.h",
178       "url_request/url_request_ftp_job.cc",
179       "url_request/url_request_ftp_job.h",
180     ]
181   }
183   if (enable_built_in_dns) {
184     defines += [ "ENABLE_BUILT_IN_DNS" ]
185   } else {
186     sources -= [
187       "dns/address_sorter_posix.cc",
188       "dns/address_sorter_posix.h",
189       "dns/dns_client.cc",
190     ]
191   }
193   if (use_openssl) {
194     sources -= [
195       "base/nss_memio.c",
196       "base/nss_memio.h",
197       "cert/ct_log_verifier_nss.cc",
198       "cert/ct_objects_extractor_nss.cc",
199       "cert/jwk_serializer_nss.cc",
200       "cert/scoped_nss_types.h",
201       "cert/x509_util_nss.cc",
202       "quic/crypto/aead_base_decrypter_nss.cc",
203       "quic/crypto/aead_base_encrypter_nss.cc",
204       "quic/crypto/aes_128_gcm_12_decrypter_nss.cc",
205       "quic/crypto/aes_128_gcm_12_encrypter_nss.cc",
206       "quic/crypto/chacha20_poly1305_decrypter_nss.cc",
207       "quic/crypto/chacha20_poly1305_encrypter_nss.cc",
208       "quic/crypto/channel_id_nss.cc",
209       "quic/crypto/p256_key_exchange_nss.cc",
210       "socket/nss_ssl_util.cc",
211       "socket/nss_ssl_util.h",
212       "socket/ssl_client_socket_nss.cc",
213       "socket/ssl_client_socket_nss.h",
214       "socket/ssl_server_socket_nss.cc",
215       "socket/ssl_server_socket_nss.h",
216     ]
217     if (is_ios) {
218       # Always removed for !ios below.
219       sources -= [
220         "cert/cert_verify_proc_nss.cc",
221         "cert/cert_verify_proc_nss.h",
222       ]
223     }
224     if (is_win) {
225       sources -= [ "cert/sha256_legacy_support_nss_win.cc" ]
226     }
227     if (!use_nss_certs && !is_ios) {
228       sources -= [ "cert/x509_util_nss.h" ]
229     }
230   } else {
231     sources -= [
232       "cert/ct_log_verifier_openssl.cc",
233       "cert/ct_objects_extractor_openssl.cc",
234       "cert/jwk_serializer_openssl.cc",
235       "cert/x509_util_openssl.cc",
236       "cert/x509_util_openssl.h",
237       "quic/crypto/aead_base_decrypter_openssl.cc",
238       "quic/crypto/aead_base_encrypter_openssl.cc",
239       "quic/crypto/aes_128_gcm_12_decrypter_openssl.cc",
240       "quic/crypto/aes_128_gcm_12_encrypter_openssl.cc",
241       "quic/crypto/chacha20_poly1305_decrypter_openssl.cc",
242       "quic/crypto/chacha20_poly1305_encrypter_openssl.cc",
243       "quic/crypto/channel_id_openssl.cc",
244       "quic/crypto/p256_key_exchange_openssl.cc",
245       "quic/crypto/scoped_evp_aead_ctx.cc",
246       "quic/crypto/scoped_evp_aead_ctx.h",
247       "socket/ssl_client_socket_openssl.cc",
248       "socket/ssl_client_socket_openssl.h",
249       "socket/ssl_server_socket_openssl.cc",
250       "socket/ssl_server_socket_openssl.h",
251       "ssl/openssl_ssl_util.cc",
252       "ssl/openssl_ssl_util.h",
253       "ssl/ssl_client_session_cache_openssl.cc",
254       "ssl/ssl_client_session_cache_openssl.h",
255       "ssl/ssl_platform_key.h",
256       "ssl/threaded_ssl_private_key.cc",
257       "ssl/threaded_ssl_private_key.h",
258     ]
259     if (is_mac) {
260       sources -= [ "ssl/ssl_platform_key_mac.cc" ]
261     }
262     if (is_win) {
263       sources -= [
264         "cert/sha256_legacy_support_openssl_win.cc",
265         "ssl/ssl_platform_key_win.cc",
266       ]
267     }
268     if (use_nss_certs) {
269       sources -= [ "ssl/ssl_platform_key_nss.cc" ]
270     }
271   }
273   if (!use_openssl_certs) {
274     sources -= [
275       "base/crypto_module_openssl.cc",
276       "base/keygen_handler_openssl.cc",
277       "base/openssl_private_key_store.h",
278       "base/openssl_private_key_store_memory.cc",
279       "cert/cert_database_openssl.cc",
280       "cert/cert_verify_proc_openssl.cc",
281       "cert/cert_verify_proc_openssl.h",
282       "cert/test_root_certs_openssl.cc",
283       "cert/x509_certificate_openssl.cc",
284       "ssl/openssl_client_key_store.cc",
285       "ssl/openssl_client_key_store.h",
286     ]
287     if (is_android) {
288       sources -= [ "base/openssl_private_key_store_android.cc" ]
289     }
290   } else {
291     if (is_android) {
292       # Android doesn't use these even when using OpenSSL.
293       sources -= [
294         "base/openssl_private_key_store_memory.cc",
295         "cert/cert_database_openssl.cc",
296         "cert/cert_verify_proc_openssl.cc",
297         "cert/test_root_certs_openssl.cc",
298       ]
299     }
301     # TODO(davidben): Remove these exclusions when use_openssl_certs builds also
302     # use the SSLPrivateKey machinery.
303     sources -= [
304       "ssl/threaded_ssl_private_key.cc",
305       "ssl/threaded_ssl_private_key.h",
306     ]
307   }
309   if (use_glib && !is_chromeos) {
310     configs += [ "//build/config/linux:gconf" ]
311     deps += [ "//build/config/linux:gio" ]
312   }
314   if (is_linux) {
315     configs += [ "//build/config/linux:libresolv" ]
316   }
318   if (!use_nss_certs) {
319     sources -= [
320       "base/crypto_module_nss.cc",
321       "base/keygen_handler_nss.cc",
322       "cert/cert_database_nss.cc",
323       "cert/nss_cert_database.cc",
324       "cert/nss_cert_database.h",
325       "cert/x509_certificate_nss.cc",
326       "ssl/client_cert_store_nss.cc",
327       "ssl/client_cert_store_nss.h",
328       "third_party/mozilla_security_manager/nsKeygenHandler.cpp",
329       "third_party/mozilla_security_manager/nsKeygenHandler.h",
330       "third_party/mozilla_security_manager/nsNSSCertificateDB.cpp",
331       "third_party/mozilla_security_manager/nsNSSCertificateDB.h",
332       "third_party/mozilla_security_manager/nsPKCS12Blob.cpp",
333       "third_party/mozilla_security_manager/nsPKCS12Blob.h",
334     ]
335     if (!is_ios) {
336       # These files are part of the partial implementation of NSS on iOS so
337       # keep them in that case (even though use_nss_certs is not set).
338       sources -= [
339         "cert/cert_verify_proc_nss.cc",
340         "cert/cert_verify_proc_nss.h",
341         "cert/test_root_certs_nss.cc",
342         "cert/x509_util_nss_certs.cc",
343         "cert_net/nss_ocsp.cc",
344         "cert_net/nss_ocsp.h",
345       ]
346     }
347     if (is_chromeos) {
348       # These were already removed on non-ChromeOS.
349       sources -= [
350         "cert/nss_cert_database_chromeos.cc",
351         "cert/nss_cert_database_chromeos.h",
352         "cert/nss_profile_filter_chromeos.cc",
353         "cert/nss_profile_filter_chromeos.h",
354         "ssl/client_cert_store_chromeos.cc",
355         "ssl/client_cert_store_chromeos.h",
356       ]
357     }
358     sources -= [ "ssl/ssl_platform_key_nss.cc" ]
359   } else if (use_openssl) {
360     # client_cert_store_nss.c requires NSS_CmpCertChainWCANames from NSS's
361     # libssl, but our bundled copy is not built in OpenSSL ports. Pull that file
362     # in directly.
363     sources += [ "third_party/nss/ssl/cmpcert.c" ]
364   }
366   if (!enable_websockets) {
367     sources -= [
368       "websockets/websocket_basic_handshake_stream.cc",
369       "websockets/websocket_basic_handshake_stream.h",
370       "websockets/websocket_basic_stream.cc",
371       "websockets/websocket_basic_stream.h",
372       "websockets/websocket_channel.cc",
373       "websockets/websocket_channel.h",
374       "websockets/websocket_deflate_predictor.h",
375       "websockets/websocket_deflate_predictor_impl.cc",
376       "websockets/websocket_deflate_predictor_impl.h",
377       "websockets/websocket_deflate_stream.cc",
378       "websockets/websocket_deflate_stream.h",
379       "websockets/websocket_deflater.cc",
380       "websockets/websocket_deflater.h",
381       "websockets/websocket_errors.cc",
382       "websockets/websocket_errors.h",
383       "websockets/websocket_extension.cc",
384       "websockets/websocket_extension.h",
385       "websockets/websocket_extension_parser.cc",
386       "websockets/websocket_extension_parser.h",
387       "websockets/websocket_frame.cc",
388       "websockets/websocket_frame.h",
389       "websockets/websocket_frame_parser.cc",
390       "websockets/websocket_frame_parser.h",
391       "websockets/websocket_handshake_challenge.cc",
392       "websockets/websocket_handshake_challenge.h",
393       "websockets/websocket_handshake_constants.cc",
394       "websockets/websocket_handshake_constants.h",
395       "websockets/websocket_handshake_request_info.cc",
396       "websockets/websocket_handshake_request_info.h",
397       "websockets/websocket_handshake_response_info.cc",
398       "websockets/websocket_handshake_response_info.h",
399       "websockets/websocket_handshake_stream_base.h",
400       "websockets/websocket_handshake_stream_create_helper.cc",
401       "websockets/websocket_handshake_stream_create_helper.h",
402       "websockets/websocket_inflater.cc",
403       "websockets/websocket_inflater.h",
404       "websockets/websocket_mux.h",
405       "websockets/websocket_stream.cc",
406       "websockets/websocket_stream.h",
407     ]
408   }
410   if (!enable_mdns) {
411     sources -= [
412       "dns/mdns_cache.cc",
413       "dns/mdns_cache.h",
414       "dns/mdns_client.cc",
415       "dns/mdns_client.h",
416       "dns/mdns_client_impl.cc",
417       "dns/mdns_client_impl.h",
418       "dns/record_parsed.cc",
419       "dns/record_parsed.h",
420       "dns/record_rdata.cc",
421       "dns/record_rdata.h",
422     ]
423   }
425   if (is_win) {
426     sources -= [
427       "http/http_auth_handler_ntlm_portable.cc",
428       "socket/socket_libevent.cc",
429       "socket/socket_libevent.h",
430       "socket/tcp_socket_libevent.cc",
431       "socket/tcp_socket_libevent.h",
432       "udp/udp_socket_libevent.cc",
433       "udp/udp_socket_libevent.h",
434     ]
435   } else {  # !is_win
436     sources -= [
437       "base/winsock_init.cc",
438       "base/winsock_init.h",
439       "base/winsock_util.cc",
440       "base/winsock_util.h",
441       "proxy/proxy_resolver_winhttp.cc",
442       "proxy/proxy_resolver_winhttp.h",
443     ]
444   }
446   if (is_mac) {
447     libs = [
448       "Foundation.framework",
449       "Security.framework",
450       "SystemConfiguration.framework",
451       "resolv",
452     ]
453   }
455   if (is_ios) {
456     # Add back some sources that were otherwise filtered out. iOS needs some Mac
457     # files.
458     set_sources_assignment_filter([])
459     sources += [
460       "base/mac/url_conversions.h",
461       "base/mac/url_conversions.mm",
462       "base/network_change_notifier_mac.cc",
463       "base/network_config_watcher_mac.cc",
464       "base/network_interfaces_mac.cc",
465       "base/network_interfaces_mac.h",
466       "base/platform_mime_util_mac.mm",
467       "proxy/proxy_resolver_mac.cc",
468       "proxy/proxy_server_mac.cc",
469     ]
470     set_sources_assignment_filter(sources_assignment_filter)
472     sources -= [ "disk_cache/blockfile/file_posix.cc" ]
473     libs = [
474       "CFNetwork.framework",
475       "MobileCoreServices.framework",
476       "Security.framework",
477       "SystemConfiguration.framework",
478       "resolv",
479     ]
480   }
482   if (is_ios || is_mac) {
483     sources += gypi_values.net_base_mac_ios_sources
484   }
486   if (is_android) {
487     # Add some Linux sources that were excluded by the filter, but which
488     # are needed.
489     set_sources_assignment_filter([])
490     sources += [
491       "base/address_tracker_linux.cc",
492       "base/address_tracker_linux.h",
493       "base/network_interfaces_linux.cc",
494       "base/network_interfaces_linux.h",
495       "base/platform_mime_util_linux.cc",
496     ]
497     set_sources_assignment_filter(sources_assignment_filter)
498     deps += [ ":net_jni_headers" ]
499   }
501   if (use_icu_alternatives_on_android) {
502     sources += [
503       "base/net_string_util_icu_alternatives_android.cc",
504       "base/net_string_util_icu_alternatives_android.h",
505     ]
506   } else {
507     deps += [
508       "//base:i18n",
509       "//third_party/icu",
510     ]
511     sources += [
512       "base/filename_util_icu.cc",
513       "base/net_string_util_icu.cc",
514       "base/net_util_icu.cc",
515     ]
516   }
519 grit("net_resources") {
520   source = "base/net_resources.grd"
521   use_qualified_include = true
522   outputs = [
523     "grit/net_resources.h",
524     "net_resources.pak",
525     "net_resources.rc",
526   ]
529 proto_library("net_quic_proto") {
530   visibility = [ "//net" ]  # Part of the net component.
532   sources = [
533     "quic/proto/cached_network_parameters.proto",
534     "quic/proto/source_address_token.proto",
535   ]
536   cc_generator_options = "dllexport_decl=NET_EXPORT_PRIVATE:"
537   cc_include = "net/base/net_export.h"
539   defines = [ "NET_IMPLEMENTATION" ]
541   extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
544 static_library("extras") {
545   sources = gypi_values.net_extras_sources
546   configs += [ "//build/config/compiler:wexit_time_destructors" ]
547   deps = [
548     ":net",
549     "//base",
550     "//sql:sql",
551   ]
554 static_library("http_server") {
555   sources = [
556     "server/http_connection.cc",
557     "server/http_connection.h",
558     "server/http_server.cc",
559     "server/http_server.h",
560     "server/http_server_request_info.cc",
561     "server/http_server_request_info.h",
562     "server/http_server_response_info.cc",
563     "server/http_server_response_info.h",
564     "server/web_socket.cc",
565     "server/web_socket.h",
566     "server/web_socket_encoder.cc",
567     "server/web_socket_encoder.h",
568   ]
569   configs += [
570     "//build/config/compiler:no_size_t_to_int_warning",
571     "//build/config/compiler:wexit_time_destructors",
572   ]
573   deps = [
574     ":net",
575     "//base",
576   ]
579 executable("dump_cache") {
580   testonly = true
581   sources = [
582     "tools/dump_cache/cache_dumper.cc",
583     "tools/dump_cache/cache_dumper.h",
584     "tools/dump_cache/dump_cache.cc",
585     "tools/dump_cache/dump_files.cc",
586     "tools/dump_cache/dump_files.h",
587     "tools/dump_cache/simple_cache_dumper.cc",
588     "tools/dump_cache/simple_cache_dumper.h",
589     "tools/dump_cache/url_to_filename_encoder.cc",
590     "tools/dump_cache/url_to_filename_encoder.h",
591     "tools/dump_cache/url_utilities.cc",
592     "tools/dump_cache/url_utilities.h",
593   ]
595   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
596   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
598   deps = [
599     "//base",
600     ":net",
601     ":test_support",
602   ]
605 source_set("test_support") {
606   testonly = true
607   sources = [
608     "base/load_timing_info_test_util.cc",
609     "base/load_timing_info_test_util.h",
610     "base/mock_file_stream.cc",
611     "base/mock_file_stream.h",
612     "base/test_completion_callback.cc",
613     "base/test_completion_callback.h",
614     "base/test_data_directory.cc",
615     "base/test_data_directory.h",
616     "cert/mock_cert_verifier.cc",
617     "cert/mock_cert_verifier.h",
618     "cookies/cookie_monster_store_test.cc",
619     "cookies/cookie_monster_store_test.h",
620     "cookies/cookie_store_test_callbacks.cc",
621     "cookies/cookie_store_test_callbacks.h",
622     "cookies/cookie_store_test_helpers.cc",
623     "cookies/cookie_store_test_helpers.h",
624     "disk_cache/disk_cache_test_base.cc",
625     "disk_cache/disk_cache_test_base.h",
626     "disk_cache/disk_cache_test_util.cc",
627     "disk_cache/disk_cache_test_util.h",
628     "dns/dns_test_util.cc",
629     "dns/dns_test_util.h",
630     "dns/mock_host_resolver.cc",
631     "dns/mock_host_resolver.h",
632     "dns/mock_mdns_socket_factory.cc",
633     "dns/mock_mdns_socket_factory.h",
634     "http/http_transaction_test_util.cc",
635     "http/http_transaction_test_util.h",
636     "log/test_net_log.cc",
637     "log/test_net_log.h",
638     "log/test_net_log_entry.cc",
639     "log/test_net_log_entry.h",
640     "log/test_net_log_util.cc",
641     "log/test_net_log_util.h",
642     "proxy/mock_proxy_resolver.cc",
643     "proxy/mock_proxy_resolver.h",
644     "proxy/mock_proxy_script_fetcher.cc",
645     "proxy/mock_proxy_script_fetcher.h",
646     "proxy/proxy_config_service_common_unittest.cc",
647     "proxy/proxy_config_service_common_unittest.h",
648     "socket/socket_test_util.cc",
649     "socket/socket_test_util.h",
650     "test/cert_test_util.cc",
651     "test/cert_test_util.h",
652     "test/cert_test_util_nss.cc",
653     "test/channel_id_test_util.cc",
654     "test/channel_id_test_util.h",
655     "test/ct_test_util.cc",
656     "test/ct_test_util.h",
657     "test/embedded_test_server/embedded_test_server.cc",
658     "test/embedded_test_server/embedded_test_server.h",
659     "test/embedded_test_server/http_connection.cc",
660     "test/embedded_test_server/http_connection.h",
661     "test/embedded_test_server/http_request.cc",
662     "test/embedded_test_server/http_request.h",
663     "test/embedded_test_server/http_response.cc",
664     "test/embedded_test_server/http_response.h",
665     "test/embedded_test_server/stream_listen_socket.cc",
666     "test/embedded_test_server/stream_listen_socket.h",
667     "test/embedded_test_server/tcp_listen_socket.cc",
668     "test/embedded_test_server/tcp_listen_socket.h",
669     "test/event_waiter.h",
670     "test/net_test_suite.cc",
671     "test/net_test_suite.h",
672     "test/python_utils.cc",
673     "test/python_utils.h",
674     "test/spawned_test_server/base_test_server.cc",
675     "test/spawned_test_server/base_test_server.h",
676     "test/spawned_test_server/local_test_server.cc",
677     "test/spawned_test_server/local_test_server.h",
678     "test/spawned_test_server/local_test_server_posix.cc",
679     "test/spawned_test_server/local_test_server_win.cc",
680     "test/spawned_test_server/remote_test_server.cc",
681     "test/spawned_test_server/remote_test_server.h",
682     "test/spawned_test_server/spawned_test_server.h",
683     "test/spawned_test_server/spawner_communicator.cc",
684     "test/spawned_test_server/spawner_communicator.h",
685     "test/url_request/ssl_certificate_error_job.cc",
686     "test/url_request/ssl_certificate_error_job.h",
687     "test/url_request/url_request_failed_job.cc",
688     "test/url_request/url_request_failed_job.h",
689     "test/url_request/url_request_mock_data_job.cc",
690     "test/url_request/url_request_mock_data_job.h",
691     "test/url_request/url_request_slow_download_job.cc",
692     "test/url_request/url_request_slow_download_job.h",
693     "url_request/test_url_fetcher_factory.cc",
694     "url_request/test_url_fetcher_factory.h",
695     "url_request/url_request_test_util.cc",
696     "url_request/url_request_test_util.h",
697   ]
699   configs += [
700     "//build/config:precompiled_headers",
702     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
703     "//build/config/compiler:no_size_t_to_int_warning",
704   ]
706   public_deps = [
707     "//base",
708     "//base/test:test_support",
709     "//crypto",
710     "//net",
711     "//net/tools/tld_cleanup",
712     "//testing/gmock",
713     "//testing/gtest",
714     "//url",
715   ]
717   if (!is_ios) {
718     public_deps += [ "//third_party/protobuf:py_proto" ]
719   }
721   if (use_nss_certs || is_ios) {
722     public_deps += [ "//crypto:platform" ]
723   }
725   if (!is_android) {
726     sources -= [
727       "test/spawned_test_server/remote_test_server.cc",
728       "test/spawned_test_server/remote_test_server.h",
729       "test/spawned_test_server/spawner_communicator.cc",
730       "test/spawned_test_server/spawner_communicator.h",
731     ]
732   }
734   if (use_v8_in_net) {
735     public_deps += [ ":net_with_v8" ]
736   }
738   if (!enable_mdns) {
739     sources -= [
740       "dns/mock_mdns_socket_factory.cc",
741       "dns/mock_mdns_socket_factory.h",
742     ]
743   }
745   if (!use_nss_certs) {
746     sources -= [ "test/cert_test_util_nss.cc" ]
747   }
749   if (!disable_file_support) {
750     sources += [
751       "test/url_request/url_request_mock_http_job.cc",
752       "test/url_request/url_request_mock_http_job.h",
753       "url_request/test_url_request_interceptor.cc",
754       "url_request/test_url_request_interceptor.h",
755     ]
756   }
759 source_set("balsa") {
760   sources = [
761     "tools/balsa/balsa_enums.h",
762     "tools/balsa/balsa_frame.cc",
763     "tools/balsa/balsa_frame.h",
764     "tools/balsa/balsa_headers.cc",
765     "tools/balsa/balsa_headers.h",
766     "tools/balsa/balsa_headers_token_utils.cc",
767     "tools/balsa/balsa_headers_token_utils.h",
768     "tools/balsa/balsa_visitor_interface.h",
769     "tools/balsa/http_message_constants.cc",
770     "tools/balsa/http_message_constants.h",
771     "tools/balsa/noop_balsa_visitor.h",
772     "tools/balsa/simple_buffer.cc",
773     "tools/balsa/simple_buffer.h",
774     "tools/balsa/split.cc",
775     "tools/balsa/split.h",
776     "tools/balsa/string_piece_utils.h",
777     "tools/quic/spdy_balsa_utils.cc",
778     "tools/quic/spdy_balsa_utils.h",
779   ]
780   deps = [
781     ":net",
782     "//base",
783     "//url",
784   ]
787 if (use_v8_in_net) {
788   component("net_with_v8") {
789     sources = [
790       "proxy/proxy_resolver_v8.cc",
791       "proxy/proxy_resolver_v8.h",
792       "proxy/proxy_resolver_v8_tracing.cc",
793       "proxy/proxy_resolver_v8_tracing.h",
794       "proxy/proxy_resolver_v8_tracing_wrapper.cc",
795       "proxy/proxy_resolver_v8_tracing_wrapper.h",
796       "proxy/proxy_service_v8.cc",
797       "proxy/proxy_service_v8.h",
798     ]
800     defines = [ "NET_IMPLEMENTATION" ]
801     configs += [
802       "//build/config/compiler:no_size_t_to_int_warning",
803       "//build/config/compiler:wexit_time_destructors",
804     ]
806     public_deps = [
807       ":net",
808     ]
809     deps = [
810       "//base",
811       "//gin",
812       "//url",
813       "//v8",
814     ]
815   }
818 if (use_v8_in_net && !is_android) {
819   source_set("net_browser_services") {
820     sources = [
821       "dns/mojo_host_resolver_impl.cc",
822       "dns/mojo_host_resolver_impl.h",
823       "proxy/in_process_mojo_proxy_resolver_factory.cc",
824       "proxy/in_process_mojo_proxy_resolver_factory.h",
825       "proxy/mojo_proxy_resolver_factory.h",
826       "proxy/proxy_resolver_factory_mojo.cc",
827       "proxy/proxy_resolver_factory_mojo.h",
828       "proxy/proxy_service_mojo.cc",
829       "proxy/proxy_service_mojo.h",
830     ]
832     public_deps = [
833       ":mojo_type_converters",
834       ":net",
835       "//base",
836       "//mojo/common",
837       "//net/interfaces",
838       "//third_party/mojo/src/mojo/public/cpp/bindings",
840       # NOTE(amistry): As long as we support in-process Mojo v8 PAC, we need
841       # this dependency since in_process_mojo_proxy_resolver_factory creates
842       # the utility process side Mojo services in the browser process.
843       # Ultimately, this will go away when we only support out-of-process.
844       ":net_utility_services",
845     ]
846   }
848   source_set("mojo_type_converters") {
849     sources = [
850       "dns/mojo_host_type_converters.cc",
851       "dns/mojo_host_type_converters.h",
852       "proxy/mojo_proxy_type_converters.cc",
853       "proxy/mojo_proxy_type_converters.h",
854     ]
856     public_deps = [
857       ":net",
858       "//net/interfaces",
859       "//third_party/mojo/src/mojo/public/cpp/bindings",
860     ]
861   }
863   source_set("net_utility_services") {
864     sources = [
865       "dns/host_resolver_mojo.cc",
866       "dns/host_resolver_mojo.h",
867       "proxy/mojo_proxy_resolver_factory_impl.cc",
868       "proxy/mojo_proxy_resolver_factory_impl.h",
869       "proxy/mojo_proxy_resolver_impl.cc",
870       "proxy/mojo_proxy_resolver_impl.h",
871       "proxy/mojo_proxy_resolver_v8_tracing_bindings.h",
872     ]
874     deps = [
875       ":net_with_v8",
876     ]
878     public_deps = [
879       ":mojo_type_converters",
880       ":net",
881       "//mojo/common",
882       "//net/interfaces",
883       "//third_party/mojo/src/mojo/public/cpp/bindings",
884     ]
885   }
888 if (!is_ios && !is_android) {
889   executable("crash_cache") {
890     testonly = true
891     sources = [
892       "tools/crash_cache/crash_cache.cc",
893     ]
895     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
896     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
897     deps = [
898       ":net",
899       ":test_support",
900       "//base",
901     ]
902   }
904   executable("crl_set_dump") {
905     testonly = true
906     sources = [
907       "tools/crl_set_dump/crl_set_dump.cc",
908     ]
910     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
911     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
912     deps = [
913       ":net",
914       "//base",
915     ]
916   }
918   executable("dns_fuzz_stub") {
919     testonly = true
920     sources = [
921       "tools/dns_fuzz_stub/dns_fuzz_stub.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     ]
930   }
932   executable("gdig") {
933     testonly = true
934     sources = [
935       "tools/gdig/file_net_log.cc",
936       "tools/gdig/gdig.cc",
937     ]
938     deps = [
939       ":net",
940       "//base",
941     ]
942   }
944   executable("get_server_time") {
945     testonly = true
946     sources = [
947       "tools/get_server_time/get_server_time.cc",
948     ]
950     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
951     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
952     deps = [
953       ":net",
954       "//base",
955       "//base:i18n",
956       "//url",
957     ]
958   }
960   executable("hpack_example_generator") {
961     testonly = true
962     sources = [
963       "spdy/fuzzing/hpack_example_generator.cc",
964     ]
966     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
967     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
968     deps = [
969       "//base",
970       ":net",
971     ]
972   }
974   executable("hpack_fuzz_mutator") {
975     testonly = true
976     sources = [
977       "spdy/fuzzing/hpack_fuzz_mutator.cc",
978     ]
980     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
981     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
982     deps = [
983       "//base",
984       ":net",
985     ]
986   }
988   executable("hpack_fuzz_wrapper") {
989     testonly = true
990     sources = [
991       "spdy/fuzzing/hpack_fuzz_wrapper.cc",
992     ]
994     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
995     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
996     deps = [
997       "//base",
998       ":net",
999     ]
1000   }
1002   if (use_v8_in_net) {
1003     executable("net_watcher") {
1004       testonly = true
1005       sources = [
1006         "tools/net_watcher/net_watcher.cc",
1007       ]
1008       deps = [
1009         ":net",
1010         ":net_with_v8",
1011         "//base",
1012       ]
1014       if (is_desktop_linux) {
1015         configs += [
1016           "//build/config/linux:gconf",
1017           "//build/config/linux:glib",
1018         ]
1019         deps += [ "//build/config/linux:gio" ]
1020       }
1021     }
1022   }
1024   executable("run_testserver") {
1025     testonly = true
1026     sources = [
1027       "tools/testserver/run_testserver.cc",
1028     ]
1029     deps = [
1030       ":test_support",
1031       "//base",
1032       "//base/test:test_support",
1033       "//testing/gtest",
1034     ]
1035   }
1037   executable("stress_cache") {
1038     testonly = true
1039     sources = [
1040       "tools/stress_cache/stress_cache.cc",
1041     ]
1043     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1044     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1045     deps = [
1046       ":net",
1047       ":test_support",
1048       "//base",
1049     ]
1050   }
1052   executable("tld_cleanup") {
1053     sources = [
1054       "tools/tld_cleanup/tld_cleanup.cc",
1055     ]
1057     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1058     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1059     deps = [
1060       "//base",
1061       "//base:i18n",
1062       "//net/tools/tld_cleanup",
1063     ]
1064   }
1067 if (is_linux) {
1068   static_library("epoll_server") {
1069     sources = [
1070       "tools/epoll_server/epoll_server.cc",
1071       "tools/epoll_server/epoll_server.h",
1072     ]
1073     deps = [
1074       ":net",
1075       "//base",
1076     ]
1077   }
1079   static_library("flip_in_mem_edsm_server_base") {
1080     testonly = true
1081     sources = [
1082       "tools/dump_cache/url_to_filename_encoder.cc",
1083       "tools/dump_cache/url_to_filename_encoder.h",
1084       "tools/dump_cache/url_utilities.cc",
1085       "tools/dump_cache/url_utilities.h",
1086       "tools/flip_server/acceptor_thread.cc",
1087       "tools/flip_server/acceptor_thread.h",
1088       "tools/flip_server/constants.h",
1089       "tools/flip_server/create_listener.cc",
1090       "tools/flip_server/create_listener.h",
1091       "tools/flip_server/flip_config.cc",
1092       "tools/flip_server/flip_config.h",
1093       "tools/flip_server/http_interface.cc",
1094       "tools/flip_server/http_interface.h",
1095       "tools/flip_server/loadtime_measurement.h",
1096       "tools/flip_server/mem_cache.cc",
1097       "tools/flip_server/mem_cache.h",
1098       "tools/flip_server/output_ordering.cc",
1099       "tools/flip_server/output_ordering.h",
1100       "tools/flip_server/ring_buffer.cc",
1101       "tools/flip_server/ring_buffer.h",
1102       "tools/flip_server/sm_connection.cc",
1103       "tools/flip_server/sm_connection.h",
1104       "tools/flip_server/sm_interface.h",
1105       "tools/flip_server/spdy_interface.cc",
1106       "tools/flip_server/spdy_interface.h",
1107       "tools/flip_server/spdy_ssl.cc",
1108       "tools/flip_server/spdy_ssl.h",
1109       "tools/flip_server/spdy_util.cc",
1110       "tools/flip_server/spdy_util.h",
1111       "tools/flip_server/streamer_interface.cc",
1112       "tools/flip_server/streamer_interface.h",
1113     ]
1114     deps = [
1115       ":balsa",
1116       ":epoll_server",
1117       ":net",
1118       "//base",
1119       "//third_party/boringssl",
1120     ]
1121   }
1123   executable("flip_in_mem_edsm_server_unittests") {
1124     testonly = true
1125     sources = [
1126       "tools/flip_server/flip_test_utils.cc",
1127       "tools/flip_server/flip_test_utils.h",
1128       "tools/flip_server/http_interface_test.cc",
1129       "tools/flip_server/mem_cache_test.cc",
1130       "tools/flip_server/run_all_tests.cc",
1131       "tools/flip_server/spdy_interface_test.cc",
1132     ]
1133     deps = [
1134       ":balsa",
1135       ":flip_in_mem_edsm_server_base",
1136       ":net",
1137       ":test_support",
1138       "//testing/gtest",
1139       "//testing/gmock",
1140       "//third_party/boringssl",
1141     ]
1142   }
1144   executable("flip_in_mem_edsm_server") {
1145     testonly = true
1146     sources = [
1147       "tools/flip_server/flip_in_mem_edsm_server.cc",
1148     ]
1149     deps = [
1150       ":balsa",
1151       ":flip_in_mem_edsm_server_base",
1152       ":net",
1153       "//base",
1154     ]
1155   }
1157   source_set("epoll_quic_tools") {
1158     sources = [
1159       "tools/quic/quic_client.cc",
1160       "tools/quic/quic_client.h",
1161       "tools/quic/quic_default_packet_writer.cc",
1162       "tools/quic/quic_default_packet_writer.h",
1163       "tools/quic/quic_epoll_clock.cc",
1164       "tools/quic/quic_epoll_clock.h",
1165       "tools/quic/quic_epoll_connection_helper.cc",
1166       "tools/quic/quic_epoll_connection_helper.h",
1167       "tools/quic/quic_packet_reader.cc",
1168       "tools/quic/quic_packet_reader.h",
1169       "tools/quic/quic_packet_writer_wrapper.cc",
1170       "tools/quic/quic_packet_writer_wrapper.h",
1171       "tools/quic/quic_server.cc",
1172       "tools/quic/quic_server.h",
1173       "tools/quic/quic_socket_utils.cc",
1174       "tools/quic/quic_socket_utils.h",
1175     ]
1176     deps = [
1177       ":balsa",
1178       ":epoll_server",
1179       ":net",
1180       "//base",
1181       "//base/third_party/dynamic_annotations",
1182       "//crypto",
1183       "//third_party/boringssl",
1184       "//url",
1185     ]
1186   }
1188   executable("epoll_quic_client") {
1189     sources = [
1190       "tools/quic/quic_client_bin.cc",
1191     ]
1192     deps = [
1193       ":balsa",
1194       ":epoll_server",
1195       ":epoll_quic_tools",
1196       ":net",
1197       ":simple_quic_tools",
1198       "//base",
1199       "//third_party/boringssl",
1200     ]
1201   }
1203   executable("epoll_quic_server") {
1204     sources = [
1205       "tools/quic/quic_server_bin.cc",
1206     ]
1207     deps = [
1208       ":balsa",
1209       ":epoll_server",
1210       ":epoll_quic_tools",
1211       ":net",
1212       ":simple_quic_tools",
1213       "//base",
1214       "//third_party/boringssl",
1215     ]
1216   }
1219 if (is_android) {
1220   generate_jni("net_jni_headers") {
1221     sources = [
1222       "android/java/src/org/chromium/net/AndroidCertVerifyResult.java",
1223       "android/java/src/org/chromium/net/AndroidKeyStore.java",
1224       "android/java/src/org/chromium/net/AndroidNetworkLibrary.java",
1225       "android/java/src/org/chromium/net/AndroidPrivateKey.java",
1226       "android/java/src/org/chromium/net/GURLUtils.java",
1227       "android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java",
1228       "android/java/src/org/chromium/net/NetworkChangeNotifier.java",
1229       "android/java/src/org/chromium/net/ProxyChangeListener.java",
1230       "android/java/src/org/chromium/net/X509Util.java",
1231     ]
1232     jni_package = "net"
1233   }
1234   generate_jni("net_test_jni_headers") {
1235     sources = [
1236       "android/javatests/src/org/chromium/net/AndroidKeyStoreTestUtil.java",
1237       "test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticator.java",
1238     ]
1239     jni_package = "net/test"
1240   }
1243 if (is_android || is_linux) {
1244   executable("disk_cache_memory_test") {
1245     testonly = true
1246     sources = [
1247       "tools/disk_cache_memory_test/disk_cache_memory_test.cc",
1248     ]
1249     deps = [
1250       ":net",
1251       "//base",
1252     ]
1253   }
1256 source_set("simple_quic_tools") {
1257   sources = [
1258     "tools/quic/quic_client_session.cc",
1259     "tools/quic/quic_client_session.h",
1260     "tools/quic/quic_dispatcher.cc",
1261     "tools/quic/quic_dispatcher.h",
1262     "tools/quic/quic_in_memory_cache.cc",
1263     "tools/quic/quic_in_memory_cache.h",
1264     "tools/quic/quic_per_connection_packet_writer.cc",
1265     "tools/quic/quic_per_connection_packet_writer.h",
1266     "tools/quic/quic_server_session.cc",
1267     "tools/quic/quic_server_session.h",
1268     "tools/quic/quic_simple_client.cc",
1269     "tools/quic/quic_simple_client.h",
1270     "tools/quic/quic_simple_per_connection_packet_writer.cc",
1271     "tools/quic/quic_simple_per_connection_packet_writer.h",
1272     "tools/quic/quic_simple_server.cc",
1273     "tools/quic/quic_simple_server.h",
1274     "tools/quic/quic_simple_server_packet_writer.cc",
1275     "tools/quic/quic_simple_server_packet_writer.h",
1276     "tools/quic/quic_spdy_client_stream.cc",
1277     "tools/quic/quic_spdy_client_stream.h",
1278     "tools/quic/quic_spdy_server_stream.cc",
1279     "tools/quic/quic_spdy_server_stream.h",
1280     "tools/quic/quic_time_wait_list_manager.cc",
1281     "tools/quic/quic_time_wait_list_manager.h",
1282     "tools/quic/synchronous_host_resolver.cc",
1283     "tools/quic/synchronous_host_resolver.h",
1284   ]
1285   deps = [
1286     ":net",
1287     "//base",
1288     "//base/third_party/dynamic_annotations",
1289     "//url",
1290   ]
1293 if (!is_ios) {
1294   executable("quic_client") {
1295     sources = [
1296       "tools/quic/quic_simple_client_bin.cc",
1297     ]
1298     deps = [
1299       ":net",
1300       ":simple_quic_tools",
1301       "//base",
1302       "//url",
1303     ]
1304   }
1305   executable("quic_server") {
1306     sources = [
1307       "tools/quic/quic_simple_server_bin.cc",
1308     ]
1309     deps = [
1310       ":net",
1311       ":simple_quic_tools",
1312       "//base",
1313       "//third_party/boringssl",
1314       "//third_party/protobuf:protobuf_lite",
1315     ]
1316   }
1319 # TODO(GYP): Delete this after we've converted everything to GN.
1320 # The _run targets exist only for compatibility w/ GYP.
1321 group("net_unittests_run") {
1322   testonly = true
1323   deps = [
1324     ":net_unittests",
1325   ]
1328 test("net_unittests") {
1329   sources = gypi_values.net_test_sources
1331   if (is_ios) {
1332     sources -= [
1333       "websockets/websocket_stream_cookie_test.cc",
1334       "websockets/websocket_stream_create_test_base.cc",
1335       "websockets/websocket_stream_create_test_base.h",
1336     ]
1337   }
1339   configs += [
1340     "//build/config:precompiled_headers",
1342     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1343     "//build/config/compiler:no_size_t_to_int_warning",
1344   ]
1345   defines = []
1347   deps = [
1348     ":balsa",
1349     ":extras",
1350     ":http_server",
1351     ":net",
1352     ":simple_quic_tools",
1353     ":test_support",
1354     "//base",
1355     "//base:i18n",
1356     "//base:prefs_test_support",
1357     "//base/allocator",
1358     "//base/third_party/dynamic_annotations",
1359     "//crypto",
1360     "//crypto:platform",
1361     "//crypto:test_support",
1362     "//gin",
1363     "//net/base/registry_controlled_domains",
1364     "//sql",
1365     "//testing/gmock",
1366     "//testing/gtest",
1367     "//third_party/zlib",
1368     "//url",
1369   ]
1371   data = [
1372     "data/",
1373   ]
1375   if (is_linux || is_mac || is_win) {
1376     deps += [
1377       "//third_party/pyftpdlib/",
1378       "//third_party/pywebsocket/",
1379       "//third_party/tlslite/",
1380     ]
1381     data_deps = [
1382       "//third_party/pyftpdlib/",
1383       "//third_party/pywebsocket/",
1384       "//third_party/tlslite/",
1385     ]
1386     data += [
1387       "tools/testserver/",
1388       "//third_party/pyftpdlib/",
1389       "//third_party/pywebsocket/",
1390       "//third_party/tlslite/",
1391       "$root_out_dir/pyproto/google/",
1392     ]
1393   }
1395   if (is_desktop_linux) {
1396     deps += [ ":epoll_quic_tools" ]
1397   }
1398   if (is_linux) {
1399     sources += gypi_values.net_linux_test_sources
1400     deps += [
1401       ":epoll_quic_tools",
1402       ":epoll_server",
1403       ":flip_in_mem_edsm_server_base",
1404     ]
1405   }
1407   if (is_mac || is_ios) {
1408     sources += gypi_values.net_base_test_mac_ios_sources
1409   }
1411   if (is_chromeos) {
1412     sources -= [ "proxy/proxy_config_service_linux_unittest.cc" ]
1413   }
1415   if (v8_use_external_startup_data) {
1416     deps += [ "//gin" ]
1417   }
1419   if (!use_nss_certs) {
1420     sources -= [
1421       "cert/nss_cert_database_unittest.cc",
1422       "ssl/client_cert_store_nss_unittest.cc",
1423     ]
1424     if (is_chromeos) {  # Already removed for all non-ChromeOS builds.
1425       sources -= [
1426         "cert/nss_cert_database_chromeos_unittest.cc",
1427         "cert/nss_profile_filter_chromeos_unittest.cc",
1428         "ssl/client_cert_store_chromeos_unittest.cc",
1429       ]
1430     }
1431   }
1433   if (use_openssl) {
1434     # When building for OpenSSL, we need to exclude NSS specific tests
1435     # or functionality not supported by OpenSSL yet.
1436     # TODO(bulach): Add equivalent tests when the underlying
1437     #               functionality is ported to OpenSSL.
1438     sources -= [ "quic/test_tools/crypto_test_utils_nss.cc" ]
1439   } else {
1440     sources -= [
1441       "cert/x509_util_openssl_unittest.cc",
1442       "quic/test_tools/crypto_test_utils_openssl.cc",
1443       "socket/ssl_client_socket_openssl_unittest.cc",
1444       "ssl/ssl_client_session_cache_openssl_unittest.cc",
1445     ]
1446   }
1448   if (use_kerberos) {
1449     defines += [ "USE_KERBEROS" ]
1450   }
1452   # These are excluded on Android, because the actual Kerberos support, which
1453   # these test, is in a separate app on Android.
1454   if (!use_kerberos || is_android) {
1455     sources -= [
1456       "http/http_auth_gssapi_posix_unittest.cc",
1457       "http/mock_gssapi_library_posix.cc",
1458       "http/mock_gssapi_library_posix.h",
1459     ]
1460   }
1461   if (!use_kerberos) {
1462     sources -= [ "http/http_auth_handler_negotiate_unittest.cc" ]
1463   }
1465   if (use_openssl || (!is_desktop_linux && !is_chromeos && !is_ios)) {
1466     # Only include this test when on Posix and using NSS for
1467     # cert verification or on iOS (which also uses NSS for certs).
1468     sources -= [ "cert_net/nss_ocsp_unittest.cc" ]
1469   }
1471   if (!use_openssl_certs) {
1472     sources -= [ "ssl/openssl_client_key_store_unittest.cc" ]
1473   }
1475   if (!enable_websockets) {
1476     sources -= [
1477       "server/http_connection_unittest.cc",
1478       "server/http_server_response_info_unittest.cc",
1479       "server/http_server_unittest.cc",
1480       "server/web_socket_encoder_unittest.cc",
1481       "websockets/websocket_basic_stream_test.cc",
1482       "websockets/websocket_channel_test.cc",
1483       "websockets/websocket_deflate_predictor_impl_test.cc",
1484       "websockets/websocket_deflate_stream_test.cc",
1485       "websockets/websocket_deflater_test.cc",
1486       "websockets/websocket_end_to_end_test.cc",
1487       "websockets/websocket_errors_test.cc",
1488       "websockets/websocket_extension_parser_test.cc",
1489       "websockets/websocket_frame_parser_test.cc",
1490       "websockets/websocket_frame_test.cc",
1491       "websockets/websocket_handshake_challenge_test.cc",
1492       "websockets/websocket_handshake_stream_create_helper_test.cc",
1493       "websockets/websocket_inflater_test.cc",
1494       "websockets/websocket_stream_test.cc",
1495       "websockets/websocket_test_util.cc",
1496       "websockets/websocket_test_util.h",
1497     ]
1498     deps -= [ ":http_server" ]
1499   }
1501   if (disable_file_support) {
1502     sources -= [
1503       "base/directory_lister_unittest.cc",
1504       "url_request/url_request_file_job_unittest.cc",
1505     ]
1506   }
1508   if (disable_ftp_support) {
1509     sources -= [
1510       "ftp/ftp_auth_cache_unittest.cc",
1511       "ftp/ftp_ctrl_response_buffer_unittest.cc",
1512       "ftp/ftp_directory_listing_parser_ls_unittest.cc",
1513       "ftp/ftp_directory_listing_parser_netware_unittest.cc",
1514       "ftp/ftp_directory_listing_parser_os2_unittest.cc",
1515       "ftp/ftp_directory_listing_parser_unittest.cc",
1516       "ftp/ftp_directory_listing_parser_unittest.h",
1517       "ftp/ftp_directory_listing_parser_vms_unittest.cc",
1518       "ftp/ftp_directory_listing_parser_windows_unittest.cc",
1519       "ftp/ftp_network_transaction_unittest.cc",
1520       "ftp/ftp_util_unittest.cc",
1521       "url_request/url_request_ftp_job_unittest.cc",
1522     ]
1523   }
1525   if (!enable_built_in_dns) {
1526     sources -= [
1527       "dns/address_sorter_posix_unittest.cc",
1528       "dns/address_sorter_unittest.cc",
1529     ]
1530   }
1532   # Always need use_v8_in_net to be 1 to run on Android, so just remove
1533   # net_unittest's dependency on v8 when using icu alternatives instead of
1534   # setting use_v8_in_net to 0.
1535   if (use_v8_in_net && !use_icu_alternatives_on_android) {
1536     deps += [ ":net_with_v8" ]
1537   } else {
1538     sources -= [
1539       "proxy/proxy_resolver_v8_tracing_unittest.cc",
1540       "proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc",
1541       "proxy/proxy_resolver_v8_unittest.cc",
1542     ]
1543   }
1545   if (use_v8_in_net && !is_android) {
1546     deps += [
1547       ":net_browser_services",
1548       ":net_utility_services",
1549       "//mojo/environment:chromium",
1550       "//third_party/mojo/src/mojo/edk/system",
1551     ]
1552   } else {
1553     sources -= [
1554       "dns/host_resolver_mojo_unittest.cc",
1555       "dns/mojo_host_resolver_impl_unittest.cc",
1556       "proxy/mojo_proxy_resolver_factory_impl_unittest.cc",
1557       "proxy/mojo_proxy_resolver_impl_unittest.cc",
1558       "proxy/mojo_proxy_resolver_v8_tracing_bindings_unittest.cc",
1559       "proxy/proxy_resolver_factory_mojo_unittest.cc",
1560       "proxy/proxy_service_mojo_unittest.cc",
1561     ]
1562   }
1564   if (!enable_mdns) {
1565     sources -= [
1566       "dns/mdns_cache_unittest.cc",
1567       "dns/mdns_client_unittest.cc",
1568       "dns/record_parsed_unittest.cc",
1569       "dns/record_rdata_unittest.cc",
1570     ]
1571   }
1573   if (is_ios) {
1574     # TODO(GYP)
1575     #  'actions': [
1576     #    {
1577     #      'action_name': 'copy_test_data',
1578     #      'variables': {
1579     #        'test_data_files': [
1580     #          'data/ssl/certificates/',
1581     #          'data/test.html',
1582     #          'data/url_request_unittest/',
1583     #        ],
1584     #        'test_data_prefix': 'net',
1585     #      },
1586     #      'includes': [ '../build/copy_test_data_ios.gypi' ],
1587     #    },
1588     #  ],
1589     sources -= [
1590       # TODO(droger): The following tests are disabled because the
1591       # implementation is missing or incomplete.
1592       # KeygenHandler::GenKeyAndSignChallenge() is not ported to iOS.
1593       "base/keygen_handler_unittest.cc",
1594       "disk_cache/backend_unittest.cc",
1595       "disk_cache/blockfile/block_files_unittest.cc",
1597       # Need to read input data files.
1598       "filter/gzip_filter_unittest.cc",
1599       "socket/ssl_server_socket_unittest.cc",
1600       "spdy/fuzzing/hpack_fuzz_util_test.cc",
1602       # Need TestServer.
1603       "cert_net/cert_net_fetcher_impl_unittest.cc",
1604       "proxy/proxy_script_fetcher_impl_unittest.cc",
1605       "socket/ssl_client_socket_unittest.cc",
1606       "url_request/url_fetcher_impl_unittest.cc",
1607       "url_request/url_request_context_builder_unittest.cc",
1609       # Needs GetAppOutput().
1610       "test/python_utils_unittest.cc",
1612       # The following tests are disabled because they don't apply to
1613       # iOS.
1614       # OS is not "linux" or "freebsd" or "openbsd".
1615       "socket/unix_domain_client_socket_posix_unittest.cc",
1616       "socket/unix_domain_server_socket_posix_unittest.cc",
1618       # See bug http://crbug.com/344533.
1619       "disk_cache/blockfile/index_table_v3_unittest.cc",
1620     ]
1621   }
1623   if (is_android) {
1624     sources -= [
1625       # See bug http://crbug.com/344533.
1626       "disk_cache/blockfile/index_table_v3_unittest.cc",
1627       "dns/dns_config_service_posix_unittest.cc",
1628     ]
1629     deps += [
1630       ":net_test_jni_headers",
1632       # TODO(mmenke):  This depends on test_support_base, which depends on
1633       #                icu.  Figure out a way to remove that dependency.
1634       "//testing/android/native_test:native_test_native_code",
1635     ]
1636     set_sources_assignment_filter([])
1637     sources += [ "base/address_tracker_linux_unittest.cc" ]
1638     set_sources_assignment_filter(sources_assignment_filter)
1639     isolate_file = "net_unittests.isolate"
1640   }
1642   if (use_icu_alternatives_on_android) {
1643     sources -= [
1644       "base/filename_util_unittest.cc",
1645       "base/net_util_icu_unittest.cc",
1646     ]
1647     deps -= [ "//base:i18n" ]
1648   }
1650   # Symbols for crashes when running tests on swarming.
1651   if (symbol_level > 0) {
1652     if (is_win) {
1653       data += [ "$root_out_dir/net_unittests.exe.pdb" ]
1654     } else if (is_mac) {
1655       data += [ "$root_out_dir/net_unittests.dSYM/" ]
1656     }
1657   }
1660 # !is_android && !is_win && !is_mac
1662 executable("net_perftests") {
1663   testonly = true
1664   sources = [
1665     "base/mime_sniffer_perftest.cc",
1666     "cookies/cookie_monster_perftest.cc",
1667     "disk_cache/blockfile/disk_cache_perftest.cc",
1668     "extras/sqlite/sqlite_persistent_cookie_store_perftest.cc",
1669     "proxy/proxy_resolver_perftest.cc",
1670     "udp/udp_socket_perftest.cc",
1671   ]
1673   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1674   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1675   deps = [
1676     ":extras",
1677     ":net",
1678     ":test_support",
1679     "//base",
1680     "//base:i18n",
1681     "//base/test:test_support_perf",
1682     "//testing/gtest",
1683     "//url",
1684   ]
1686   if (enable_websockets) {
1687     sources += [ "websockets/websocket_frame_perftest.cc" ]
1688   }
1690   if (use_v8_in_net) {
1691     deps += [ ":net_with_v8" ]
1692   } else {
1693     sources -= [ "proxy/proxy_resolver_perftest.cc" ]
1694   }