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