Landing Recent QUIC changes until 8/19/2015 17:00 UTC.
[chromium-blink-merge.git] / net / BUILD.gn
blob3ac509b8c90f758c3861ff4e29e198521f52b1a0
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 -= [
270         "ssl/client_key_store.cc",
271         "ssl/client_key_store.h",
272         "ssl/ssl_platform_key_nss.cc",
273       ]
274     }
275   }
277   if (!use_openssl_certs) {
278     sources -= [
279       "base/crypto_module_openssl.cc",
280       "base/keygen_handler_openssl.cc",
281       "base/openssl_private_key_store.h",
282       "base/openssl_private_key_store_memory.cc",
283       "cert/cert_database_openssl.cc",
284       "cert/cert_verify_proc_openssl.cc",
285       "cert/cert_verify_proc_openssl.h",
286       "cert/test_root_certs_openssl.cc",
287       "cert/x509_certificate_openssl.cc",
288       "ssl/openssl_client_key_store.cc",
289       "ssl/openssl_client_key_store.h",
290     ]
291     if (is_android) {
292       sources -= [ "base/openssl_private_key_store_android.cc" ]
293     }
294   } else {
295     if (is_android) {
296       # Android doesn't use these even when using OpenSSL.
297       sources -= [
298         "base/openssl_private_key_store_memory.cc",
299         "cert/cert_database_openssl.cc",
300         "cert/cert_verify_proc_openssl.cc",
301         "cert/test_root_certs_openssl.cc",
302       ]
303     }
305     # TODO(davidben): Remove these exclusions when use_openssl_certs builds also
306     # use the SSLPrivateKey machinery.
307     sources -= [
308       "ssl/threaded_ssl_private_key.cc",
309       "ssl/threaded_ssl_private_key.h",
310     ]
311   }
313   if (use_glib && !is_chromeos) {
314     configs += [ "//build/config/linux:gconf" ]
315     deps += [ "//build/config/linux:gio" ]
316   }
318   if (is_linux) {
319     configs += [ "//build/config/linux:libresolv" ]
320   }
322   if (!use_nss_certs) {
323     sources -= [
324       "base/crypto_module_nss.cc",
325       "base/keygen_handler_nss.cc",
326       "cert/cert_database_nss.cc",
327       "cert/nss_cert_database.cc",
328       "cert/nss_cert_database.h",
329       "cert/x509_certificate_nss.cc",
330       "ssl/client_cert_store_nss.cc",
331       "ssl/client_cert_store_nss.h",
332       "third_party/mozilla_security_manager/nsKeygenHandler.cpp",
333       "third_party/mozilla_security_manager/nsKeygenHandler.h",
334       "third_party/mozilla_security_manager/nsNSSCertificateDB.cpp",
335       "third_party/mozilla_security_manager/nsNSSCertificateDB.h",
336       "third_party/mozilla_security_manager/nsPKCS12Blob.cpp",
337       "third_party/mozilla_security_manager/nsPKCS12Blob.h",
338     ]
339     if (!is_ios) {
340       # These files are part of the partial implementation of NSS on iOS so
341       # keep them in that case (even though use_nss_certs is not set).
342       sources -= [
343         "cert/cert_verify_proc_nss.cc",
344         "cert/cert_verify_proc_nss.h",
345         "cert/test_root_certs_nss.cc",
346         "cert/x509_util_nss_certs.cc",
347         "cert_net/nss_ocsp.cc",
348         "cert_net/nss_ocsp.h",
349       ]
350     }
351     if (is_chromeos) {
352       # These were already removed on non-ChromeOS.
353       sources -= [
354         "cert/nss_cert_database_chromeos.cc",
355         "cert/nss_cert_database_chromeos.h",
356         "cert/nss_profile_filter_chromeos.cc",
357         "cert/nss_profile_filter_chromeos.h",
358       ]
359     }
360     sources -= [
361       "ssl/client_key_store.cc",
362       "ssl/client_key_store.h",
363       "ssl/ssl_platform_key_nss.cc",
364     ]
365   } else if (use_openssl) {
366     # client_cert_store_nss.c requires NSS_CmpCertChainWCANames from NSS's
367     # libssl, but our bundled copy is not built in OpenSSL ports. Pull that file
368     # in directly.
369     sources += [ "third_party/nss/ssl/cmpcert.c" ]
370   }
372   if (!enable_websockets) {
373     sources -= [
374       "websockets/websocket_basic_handshake_stream.cc",
375       "websockets/websocket_basic_handshake_stream.h",
376       "websockets/websocket_basic_stream.cc",
377       "websockets/websocket_basic_stream.h",
378       "websockets/websocket_channel.cc",
379       "websockets/websocket_channel.h",
380       "websockets/websocket_deflate_predictor.h",
381       "websockets/websocket_deflate_predictor_impl.cc",
382       "websockets/websocket_deflate_predictor_impl.h",
383       "websockets/websocket_deflate_stream.cc",
384       "websockets/websocket_deflate_stream.h",
385       "websockets/websocket_deflater.cc",
386       "websockets/websocket_deflater.h",
387       "websockets/websocket_errors.cc",
388       "websockets/websocket_errors.h",
389       "websockets/websocket_extension.cc",
390       "websockets/websocket_extension.h",
391       "websockets/websocket_extension_parser.cc",
392       "websockets/websocket_extension_parser.h",
393       "websockets/websocket_frame.cc",
394       "websockets/websocket_frame.h",
395       "websockets/websocket_frame_parser.cc",
396       "websockets/websocket_frame_parser.h",
397       "websockets/websocket_handshake_challenge.cc",
398       "websockets/websocket_handshake_challenge.h",
399       "websockets/websocket_handshake_constants.cc",
400       "websockets/websocket_handshake_constants.h",
401       "websockets/websocket_handshake_request_info.cc",
402       "websockets/websocket_handshake_request_info.h",
403       "websockets/websocket_handshake_response_info.cc",
404       "websockets/websocket_handshake_response_info.h",
405       "websockets/websocket_handshake_stream_base.h",
406       "websockets/websocket_handshake_stream_create_helper.cc",
407       "websockets/websocket_handshake_stream_create_helper.h",
408       "websockets/websocket_inflater.cc",
409       "websockets/websocket_inflater.h",
410       "websockets/websocket_mux.h",
411       "websockets/websocket_stream.cc",
412       "websockets/websocket_stream.h",
413     ]
414   }
416   if (!enable_mdns) {
417     sources -= [
418       "dns/mdns_cache.cc",
419       "dns/mdns_cache.h",
420       "dns/mdns_client.cc",
421       "dns/mdns_client.h",
422       "dns/mdns_client_impl.cc",
423       "dns/mdns_client_impl.h",
424       "dns/record_parsed.cc",
425       "dns/record_parsed.h",
426       "dns/record_rdata.cc",
427       "dns/record_rdata.h",
428     ]
429   }
431   if (is_win) {
432     sources -= [
433       "http/http_auth_handler_ntlm_portable.cc",
434       "socket/socket_libevent.cc",
435       "socket/socket_libevent.h",
436       "socket/tcp_socket_libevent.cc",
437       "socket/tcp_socket_libevent.h",
438       "udp/udp_socket_libevent.cc",
439       "udp/udp_socket_libevent.h",
440     ]
441   } else {  # !is_win
442     sources -= [
443       "base/winsock_init.cc",
444       "base/winsock_init.h",
445       "base/winsock_util.cc",
446       "base/winsock_util.h",
447       "proxy/proxy_resolver_winhttp.cc",
448       "proxy/proxy_resolver_winhttp.h",
449     ]
450   }
452   if (is_mac) {
453     libs = [
454       "Foundation.framework",
455       "Security.framework",
456       "SystemConfiguration.framework",
457       "resolv",
458     ]
459   }
461   if (is_ios) {
462     # Add back some sources that were otherwise filtered out. iOS needs some Mac
463     # files.
464     set_sources_assignment_filter([])
465     sources += [
466       "base/mac/url_conversions.h",
467       "base/mac/url_conversions.mm",
468       "base/network_change_notifier_mac.cc",
469       "base/network_config_watcher_mac.cc",
470       "base/network_interfaces_mac.cc",
471       "base/network_interfaces_mac.h",
472       "base/platform_mime_util_mac.mm",
473       "proxy/proxy_resolver_mac.cc",
474       "proxy/proxy_server_mac.cc",
475     ]
476     set_sources_assignment_filter(sources_assignment_filter)
478     sources -= [ "disk_cache/blockfile/file_posix.cc" ]
479     libs = [
480       "CFNetwork.framework",
481       "MobileCoreServices.framework",
482       "Security.framework",
483       "SystemConfiguration.framework",
484       "resolv",
485     ]
487     deps += [
488       "//third_party/nss:nspr",
489       "//third_party/nss",
490       "//net/third_party/nss/ssl:libssl",
491     ]
492   }
494   if (is_ios || is_mac) {
495     sources += gypi_values.net_base_mac_ios_sources
496   }
498   if (is_android) {
499     # Add some Linux sources that were excluded by the filter, but which
500     # are needed.
501     set_sources_assignment_filter([])
502     sources += [
503       "base/address_tracker_linux.cc",
504       "base/address_tracker_linux.h",
505       "base/network_interfaces_linux.cc",
506       "base/network_interfaces_linux.h",
507       "base/platform_mime_util_linux.cc",
508     ]
509     set_sources_assignment_filter(sources_assignment_filter)
510     deps += [ ":net_jni_headers" ]
511   }
513   if (use_icu_alternatives_on_android) {
514     sources += [
515       "base/net_string_util_icu_alternatives_android.cc",
516       "base/net_string_util_icu_alternatives_android.h",
517     ]
518   } else {
519     deps += [
520       "//base:i18n",
521       "//third_party/icu",
522     ]
523     sources += [
524       "base/filename_util_icu.cc",
525       "base/net_string_util_icu.cc",
526       "base/net_util_icu.cc",
527     ]
528   }
531 grit("net_resources") {
532   source = "base/net_resources.grd"
533   use_qualified_include = true
534   outputs = [
535     "grit/net_resources.h",
536     "net_resources.pak",
537   ]
540 proto_library("net_quic_proto") {
541   visibility = [ "//net" ]  # Part of the net component.
543   sources = [
544     "quic/proto/cached_network_parameters.proto",
545     "quic/proto/source_address_token.proto",
546   ]
547   cc_generator_options = "dllexport_decl=NET_EXPORT_PRIVATE:"
548   cc_include = "net/base/net_export.h"
550   defines = [ "NET_IMPLEMENTATION" ]
552   extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
555 static_library("extras") {
556   sources = gypi_values.net_extras_sources
557   configs += [ "//build/config/compiler:wexit_time_destructors" ]
558   deps = [
559     ":net",
560     "//base",
561     "//sql:sql",
562   ]
565 static_library("http_server") {
566   sources = [
567     "server/http_connection.cc",
568     "server/http_connection.h",
569     "server/http_server.cc",
570     "server/http_server.h",
571     "server/http_server_request_info.cc",
572     "server/http_server_request_info.h",
573     "server/http_server_response_info.cc",
574     "server/http_server_response_info.h",
575     "server/web_socket.cc",
576     "server/web_socket.h",
577     "server/web_socket_encoder.cc",
578     "server/web_socket_encoder.h",
579   ]
580   configs += [
581     "//build/config/compiler:no_size_t_to_int_warning",
582     "//build/config/compiler:wexit_time_destructors",
583   ]
584   deps = [
585     ":net",
586     "//base",
587   ]
590 executable("dump_cache") {
591   testonly = true
592   sources = [
593     "tools/dump_cache/dump_cache.cc",
594     "tools/dump_cache/dump_files.cc",
595     "tools/dump_cache/dump_files.h",
596   ]
598   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
599   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
601   deps = [
602     "//base",
603     ":net",
604     ":test_support",
605   ]
608 source_set("test_support") {
609   testonly = true
610   sources = [
611     "base/load_timing_info_test_util.cc",
612     "base/load_timing_info_test_util.h",
613     "base/mock_file_stream.cc",
614     "base/mock_file_stream.h",
615     "base/test_completion_callback.cc",
616     "base/test_completion_callback.h",
617     "base/test_data_directory.cc",
618     "base/test_data_directory.h",
619     "cert/mock_cert_verifier.cc",
620     "cert/mock_cert_verifier.h",
621     "cookies/cookie_monster_store_test.cc",
622     "cookies/cookie_monster_store_test.h",
623     "cookies/cookie_store_test_callbacks.cc",
624     "cookies/cookie_store_test_callbacks.h",
625     "cookies/cookie_store_test_helpers.cc",
626     "cookies/cookie_store_test_helpers.h",
627     "disk_cache/disk_cache_test_base.cc",
628     "disk_cache/disk_cache_test_base.h",
629     "disk_cache/disk_cache_test_util.cc",
630     "disk_cache/disk_cache_test_util.h",
631     "dns/dns_test_util.cc",
632     "dns/dns_test_util.h",
633     "dns/mock_host_resolver.cc",
634     "dns/mock_host_resolver.h",
635     "dns/mock_mdns_socket_factory.cc",
636     "dns/mock_mdns_socket_factory.h",
637     "http/http_transaction_test_util.cc",
638     "http/http_transaction_test_util.h",
639     "log/test_net_log.cc",
640     "log/test_net_log.h",
641     "log/test_net_log_entry.cc",
642     "log/test_net_log_entry.h",
643     "log/test_net_log_util.cc",
644     "log/test_net_log_util.h",
645     "proxy/mock_proxy_resolver.cc",
646     "proxy/mock_proxy_resolver.h",
647     "proxy/mock_proxy_script_fetcher.cc",
648     "proxy/mock_proxy_script_fetcher.h",
649     "proxy/proxy_config_service_common_unittest.cc",
650     "proxy/proxy_config_service_common_unittest.h",
651     "socket/socket_test_util.cc",
652     "socket/socket_test_util.h",
653     "test/cert_test_util.cc",
654     "test/cert_test_util.h",
655     "test/cert_test_util_nss.cc",
656     "test/channel_id_test_util.cc",
657     "test/channel_id_test_util.h",
658     "test/ct_test_util.cc",
659     "test/ct_test_util.h",
660     "test/embedded_test_server/embedded_test_server.cc",
661     "test/embedded_test_server/embedded_test_server.h",
662     "test/embedded_test_server/http_connection.cc",
663     "test/embedded_test_server/http_connection.h",
664     "test/embedded_test_server/http_request.cc",
665     "test/embedded_test_server/http_request.h",
666     "test/embedded_test_server/http_response.cc",
667     "test/embedded_test_server/http_response.h",
668     "test/embedded_test_server/stream_listen_socket.cc",
669     "test/embedded_test_server/stream_listen_socket.h",
670     "test/embedded_test_server/tcp_listen_socket.cc",
671     "test/embedded_test_server/tcp_listen_socket.h",
672     "test/event_waiter.h",
673     "test/net_test_suite.cc",
674     "test/net_test_suite.h",
675     "test/python_utils.cc",
676     "test/python_utils.h",
677     "test/spawned_test_server/base_test_server.cc",
678     "test/spawned_test_server/base_test_server.h",
679     "test/spawned_test_server/local_test_server.cc",
680     "test/spawned_test_server/local_test_server.h",
681     "test/spawned_test_server/local_test_server_posix.cc",
682     "test/spawned_test_server/local_test_server_win.cc",
683     "test/spawned_test_server/remote_test_server.cc",
684     "test/spawned_test_server/remote_test_server.h",
685     "test/spawned_test_server/spawned_test_server.h",
686     "test/spawned_test_server/spawner_communicator.cc",
687     "test/spawned_test_server/spawner_communicator.h",
688     "test/url_request/ssl_certificate_error_job.cc",
689     "test/url_request/ssl_certificate_error_job.h",
690     "test/url_request/url_request_failed_job.cc",
691     "test/url_request/url_request_failed_job.h",
692     "test/url_request/url_request_mock_data_job.cc",
693     "test/url_request/url_request_mock_data_job.h",
694     "test/url_request/url_request_slow_download_job.cc",
695     "test/url_request/url_request_slow_download_job.h",
696     "url_request/test_url_fetcher_factory.cc",
697     "url_request/test_url_fetcher_factory.h",
698     "url_request/url_request_test_util.cc",
699     "url_request/url_request_test_util.h",
700   ]
702   configs += [
703     "//build/config:precompiled_headers",
705     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
706     "//build/config/compiler:no_size_t_to_int_warning",
707   ]
709   public_deps = [
710     "//base",
711     "//base/test:test_support",
712     "//crypto",
713     "//net",
714     "//net/tools/tld_cleanup",
715     "//testing/gmock",
716     "//testing/gtest",
717     "//url",
718   ]
720   if (!is_ios) {
721     public_deps += [ "//third_party/protobuf:py_proto" ]
722   }
724   if (use_nss_certs || is_ios) {
725     public_deps += [ "//crypto:platform" ]
726   }
728   if (!is_android) {
729     sources -= [
730       "test/spawned_test_server/remote_test_server.cc",
731       "test/spawned_test_server/remote_test_server.h",
732       "test/spawned_test_server/spawner_communicator.cc",
733       "test/spawned_test_server/spawner_communicator.h",
734     ]
735   }
737   if (use_v8_in_net) {
738     public_deps += [ ":net_with_v8" ]
739   }
741   if (!enable_mdns) {
742     sources -= [
743       "dns/mock_mdns_socket_factory.cc",
744       "dns/mock_mdns_socket_factory.h",
745     ]
746   }
748   if (!use_nss_certs) {
749     sources -= [ "test/cert_test_util_nss.cc" ]
750   }
752   if (!disable_file_support) {
753     sources += [
754       "test/url_request/url_request_mock_http_job.cc",
755       "test/url_request/url_request_mock_http_job.h",
756       "url_request/test_url_request_interceptor.cc",
757       "url_request/test_url_request_interceptor.h",
758     ]
759   }
762 source_set("balsa") {
763   sources = [
764     "tools/balsa/balsa_enums.h",
765     "tools/balsa/balsa_frame.cc",
766     "tools/balsa/balsa_frame.h",
767     "tools/balsa/balsa_headers.cc",
768     "tools/balsa/balsa_headers.h",
769     "tools/balsa/balsa_headers_token_utils.cc",
770     "tools/balsa/balsa_headers_token_utils.h",
771     "tools/balsa/balsa_visitor_interface.h",
772     "tools/balsa/http_message_constants.cc",
773     "tools/balsa/http_message_constants.h",
774     "tools/balsa/noop_balsa_visitor.h",
775     "tools/balsa/simple_buffer.cc",
776     "tools/balsa/simple_buffer.h",
777     "tools/balsa/split.cc",
778     "tools/balsa/split.h",
779     "tools/balsa/string_piece_utils.h",
780     "tools/quic/spdy_balsa_utils.cc",
781     "tools/quic/spdy_balsa_utils.h",
782   ]
783   deps = [
784     ":net",
785     "//base",
786     "//url",
787   ]
790 if (use_v8_in_net) {
791   component("net_with_v8") {
792     sources = [
793       "proxy/proxy_resolver_v8.cc",
794       "proxy/proxy_resolver_v8.h",
795       "proxy/proxy_resolver_v8_tracing.cc",
796       "proxy/proxy_resolver_v8_tracing.h",
797       "proxy/proxy_resolver_v8_tracing_wrapper.cc",
798       "proxy/proxy_resolver_v8_tracing_wrapper.h",
799       "proxy/proxy_service_v8.cc",
800       "proxy/proxy_service_v8.h",
801     ]
803     defines = [ "NET_IMPLEMENTATION" ]
804     configs += [
805       "//build/config/compiler:no_size_t_to_int_warning",
806       "//build/config/compiler:wexit_time_destructors",
807     ]
809     public_deps = [
810       ":net",
811     ]
812     deps = [
813       "//base",
814       "//gin",
815       "//url",
816       "//v8",
817     ]
818   }
821 if (use_v8_in_net && !is_android) {
822   source_set("net_browser_services") {
823     sources = [
824       "dns/mojo_host_resolver_impl.cc",
825       "dns/mojo_host_resolver_impl.h",
826       "proxy/in_process_mojo_proxy_resolver_factory.cc",
827       "proxy/in_process_mojo_proxy_resolver_factory.h",
828       "proxy/mojo_proxy_resolver_factory.h",
829       "proxy/proxy_resolver_factory_mojo.cc",
830       "proxy/proxy_resolver_factory_mojo.h",
831       "proxy/proxy_service_mojo.cc",
832       "proxy/proxy_service_mojo.h",
833     ]
835     public_deps = [
836       ":mojo_type_converters",
837       ":net",
838       "//base",
839       "//mojo/common",
840       "//net/interfaces",
841       "//third_party/mojo/src/mojo/public/cpp/bindings",
843       # NOTE(amistry): As long as we support in-process Mojo v8 PAC, we need
844       # this dependency since in_process_mojo_proxy_resolver_factory creates
845       # the utility process side Mojo services in the browser process.
846       # Ultimately, this will go away when we only support out-of-process.
847       ":net_utility_services",
848     ]
849   }
851   source_set("mojo_type_converters") {
852     sources = [
853       "dns/mojo_host_type_converters.cc",
854       "dns/mojo_host_type_converters.h",
855       "proxy/mojo_proxy_type_converters.cc",
856       "proxy/mojo_proxy_type_converters.h",
857     ]
859     public_deps = [
860       ":net",
861       "//net/interfaces",
862       "//third_party/mojo/src/mojo/public/cpp/bindings",
863     ]
864   }
866   source_set("net_utility_services") {
867     sources = [
868       "dns/host_resolver_mojo.cc",
869       "dns/host_resolver_mojo.h",
870       "proxy/mojo_proxy_resolver_factory_impl.cc",
871       "proxy/mojo_proxy_resolver_factory_impl.h",
872       "proxy/mojo_proxy_resolver_impl.cc",
873       "proxy/mojo_proxy_resolver_impl.h",
874       "proxy/mojo_proxy_resolver_v8_tracing_bindings.h",
875     ]
877     deps = [
878       ":net_with_v8",
879     ]
881     public_deps = [
882       ":mojo_type_converters",
883       ":net",
884       "//mojo/common",
885       "//net/interfaces",
886       "//third_party/mojo/src/mojo/public/cpp/bindings",
887     ]
888   }
891 if (!is_ios && !is_android) {
892   executable("crash_cache") {
893     testonly = true
894     sources = [
895       "tools/crash_cache/crash_cache.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       ":test_support",
903       "//base",
904     ]
905   }
907   executable("crl_set_dump") {
908     testonly = true
909     sources = [
910       "tools/crl_set_dump/crl_set_dump.cc",
911     ]
913     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
914     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
915     deps = [
916       ":net",
917       "//base",
918     ]
919   }
921   executable("dns_fuzz_stub") {
922     testonly = true
923     sources = [
924       "tools/dns_fuzz_stub/dns_fuzz_stub.cc",
925     ]
927     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
928     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
929     deps = [
930       ":net",
931       "//base",
932     ]
933   }
935   executable("gdig") {
936     testonly = true
937     sources = [
938       "tools/gdig/file_net_log.cc",
939       "tools/gdig/gdig.cc",
940     ]
941     deps = [
942       ":net",
943       "//base",
944     ]
945   }
947   executable("get_server_time") {
948     testonly = true
949     sources = [
950       "tools/get_server_time/get_server_time.cc",
951     ]
953     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
954     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
955     deps = [
956       ":net",
957       "//base",
958       "//base:i18n",
959       "//url",
960     ]
961   }
963   executable("hpack_example_generator") {
964     testonly = true
965     sources = [
966       "spdy/fuzzing/hpack_example_generator.cc",
967     ]
969     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
970     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
971     deps = [
972       "//base",
973       ":net",
974     ]
975   }
977   executable("hpack_fuzz_mutator") {
978     testonly = true
979     sources = [
980       "spdy/fuzzing/hpack_fuzz_mutator.cc",
981     ]
983     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
984     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
985     deps = [
986       "//base",
987       ":net",
988     ]
989   }
991   executable("hpack_fuzz_wrapper") {
992     testonly = true
993     sources = [
994       "spdy/fuzzing/hpack_fuzz_wrapper.cc",
995     ]
997     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
998     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
999     deps = [
1000       "//base",
1001       ":net",
1002     ]
1003   }
1005   if (use_v8_in_net) {
1006     executable("net_watcher") {
1007       testonly = true
1008       sources = [
1009         "tools/net_watcher/net_watcher.cc",
1010       ]
1011       deps = [
1012         ":net",
1013         ":net_with_v8",
1014         "//base",
1015       ]
1017       if (is_desktop_linux) {
1018         deps += [ "//build/config/linux:gio" ]
1019       }
1021       if (use_gconf) {
1022         configs += [ "//build/config/linux:gconf" ]
1023       }
1025       if (use_glib) {
1026         configs += [ "//build/config/linux:glib" ]
1027       }
1028     }
1029   }
1031   executable("run_testserver") {
1032     testonly = true
1033     sources = [
1034       "tools/testserver/run_testserver.cc",
1035     ]
1036     deps = [
1037       ":test_support",
1038       "//base",
1039       "//base/test:test_support",
1040       "//testing/gtest",
1041     ]
1042   }
1044   executable("stress_cache") {
1045     testonly = true
1046     sources = [
1047       "tools/stress_cache/stress_cache.cc",
1048     ]
1050     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1051     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1052     deps = [
1053       ":net",
1054       ":test_support",
1055       "//base",
1056     ]
1057   }
1059   executable("tld_cleanup") {
1060     sources = [
1061       "tools/tld_cleanup/tld_cleanup.cc",
1062     ]
1064     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1065     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1066     deps = [
1067       "//base",
1068       "//base:i18n",
1069       "//net/tools/tld_cleanup",
1070     ]
1071   }
1074 if (is_linux) {
1075   static_library("epoll_server") {
1076     sources = [
1077       "tools/epoll_server/epoll_server.cc",
1078       "tools/epoll_server/epoll_server.h",
1079     ]
1080     deps = [
1081       ":net",
1082       "//base",
1083     ]
1084   }
1086   static_library("flip_in_mem_edsm_server_base") {
1087     testonly = true
1088     sources = [
1089       "tools/flip_server/acceptor_thread.cc",
1090       "tools/flip_server/acceptor_thread.h",
1091       "tools/flip_server/constants.h",
1092       "tools/flip_server/create_listener.cc",
1093       "tools/flip_server/create_listener.h",
1094       "tools/flip_server/flip_config.cc",
1095       "tools/flip_server/flip_config.h",
1096       "tools/flip_server/http_interface.cc",
1097       "tools/flip_server/http_interface.h",
1098       "tools/flip_server/loadtime_measurement.h",
1099       "tools/flip_server/mem_cache.cc",
1100       "tools/flip_server/mem_cache.h",
1101       "tools/flip_server/output_ordering.cc",
1102       "tools/flip_server/output_ordering.h",
1103       "tools/flip_server/ring_buffer.cc",
1104       "tools/flip_server/ring_buffer.h",
1105       "tools/flip_server/sm_connection.cc",
1106       "tools/flip_server/sm_connection.h",
1107       "tools/flip_server/sm_interface.h",
1108       "tools/flip_server/spdy_interface.cc",
1109       "tools/flip_server/spdy_interface.h",
1110       "tools/flip_server/spdy_ssl.cc",
1111       "tools/flip_server/spdy_ssl.h",
1112       "tools/flip_server/spdy_util.cc",
1113       "tools/flip_server/spdy_util.h",
1114       "tools/flip_server/streamer_interface.cc",
1115       "tools/flip_server/streamer_interface.h",
1116       "tools/flip_server/url_to_filename_encoder.cc",
1117       "tools/flip_server/url_to_filename_encoder.h",
1118       "tools/flip_server/url_utilities.cc",
1119       "tools/flip_server/url_utilities.h",
1120     ]
1121     deps = [
1122       ":balsa",
1123       ":epoll_server",
1124       ":net",
1125       "//base",
1126       "//third_party/boringssl",
1127     ]
1128   }
1130   executable("flip_in_mem_edsm_server_unittests") {
1131     testonly = true
1132     sources = [
1133       "tools/flip_server/flip_test_utils.cc",
1134       "tools/flip_server/flip_test_utils.h",
1135       "tools/flip_server/http_interface_test.cc",
1136       "tools/flip_server/mem_cache_test.cc",
1137       "tools/flip_server/run_all_tests.cc",
1138       "tools/flip_server/spdy_interface_test.cc",
1139       "tools/flip_server/url_to_filename_encoder_unittest.cc",
1140       "tools/flip_server/url_utilities_unittest.cc",
1141     ]
1142     deps = [
1143       ":balsa",
1144       ":flip_in_mem_edsm_server_base",
1145       ":net",
1146       ":test_support",
1147       "//testing/gtest",
1148       "//testing/gmock",
1149       "//third_party/boringssl",
1150     ]
1151   }
1153   executable("flip_in_mem_edsm_server") {
1154     testonly = true
1155     sources = [
1156       "tools/flip_server/flip_in_mem_edsm_server.cc",
1157     ]
1158     deps = [
1159       ":balsa",
1160       ":flip_in_mem_edsm_server_base",
1161       ":net",
1162       "//base",
1163     ]
1164   }
1166   source_set("epoll_quic_tools") {
1167     sources = [
1168       "tools/quic/quic_client.cc",
1169       "tools/quic/quic_client.h",
1170       "tools/quic/quic_default_packet_writer.cc",
1171       "tools/quic/quic_default_packet_writer.h",
1172       "tools/quic/quic_epoll_clock.cc",
1173       "tools/quic/quic_epoll_clock.h",
1174       "tools/quic/quic_epoll_connection_helper.cc",
1175       "tools/quic/quic_epoll_connection_helper.h",
1176       "tools/quic/quic_packet_reader.cc",
1177       "tools/quic/quic_packet_reader.h",
1178       "tools/quic/quic_packet_writer_wrapper.cc",
1179       "tools/quic/quic_packet_writer_wrapper.h",
1180       "tools/quic/quic_server.cc",
1181       "tools/quic/quic_server.h",
1182       "tools/quic/quic_socket_utils.cc",
1183       "tools/quic/quic_socket_utils.h",
1184     ]
1185     deps = [
1186       ":balsa",
1187       ":epoll_server",
1188       ":net",
1189       "//base",
1190       "//base/third_party/dynamic_annotations",
1191       "//crypto",
1192       "//third_party/boringssl",
1193       "//url",
1194     ]
1195   }
1197   executable("epoll_quic_client") {
1198     sources = [
1199       "tools/quic/quic_client_bin.cc",
1200     ]
1201     deps = [
1202       ":balsa",
1203       ":epoll_server",
1204       ":epoll_quic_tools",
1205       ":net",
1206       ":simple_quic_tools",
1207       "//base",
1208       "//third_party/boringssl",
1209     ]
1210   }
1212   executable("epoll_quic_server") {
1213     sources = [
1214       "tools/quic/quic_server_bin.cc",
1215     ]
1216     deps = [
1217       ":balsa",
1218       ":epoll_server",
1219       ":epoll_quic_tools",
1220       ":net",
1221       ":simple_quic_tools",
1222       "//base",
1223       "//third_party/boringssl",
1224     ]
1225   }
1228 if (is_android) {
1229   generate_jni("net_jni_headers") {
1230     sources = [
1231       "android/java/src/org/chromium/net/AndroidCertVerifyResult.java",
1232       "android/java/src/org/chromium/net/AndroidKeyStore.java",
1233       "android/java/src/org/chromium/net/AndroidNetworkLibrary.java",
1234       "android/java/src/org/chromium/net/AndroidPrivateKey.java",
1235       "android/java/src/org/chromium/net/GURLUtils.java",
1236       "android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java",
1237       "android/java/src/org/chromium/net/NetworkChangeNotifier.java",
1238       "android/java/src/org/chromium/net/ProxyChangeListener.java",
1239       "android/java/src/org/chromium/net/X509Util.java",
1240     ]
1241     jni_package = "net"
1242   }
1243   generate_jni("net_test_jni_headers") {
1244     sources = [
1245       "android/javatests/src/org/chromium/net/AndroidKeyStoreTestUtil.java",
1246       "test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticator.java",
1247     ]
1248     jni_package = "net/test"
1249   }
1252 if (is_android || is_linux) {
1253   executable("disk_cache_memory_test") {
1254     testonly = true
1255     sources = [
1256       "tools/disk_cache_memory_test/disk_cache_memory_test.cc",
1257     ]
1258     deps = [
1259       ":net",
1260       "//base",
1261     ]
1262   }
1265 source_set("simple_quic_tools") {
1266   sources = [
1267     "tools/quic/quic_client_base.cc",
1268     "tools/quic/quic_client_base.h",
1269     "tools/quic/quic_client_session.cc",
1270     "tools/quic/quic_client_session.h",
1271     "tools/quic/quic_dispatcher.cc",
1272     "tools/quic/quic_dispatcher.h",
1273     "tools/quic/quic_in_memory_cache.cc",
1274     "tools/quic/quic_in_memory_cache.h",
1275     "tools/quic/quic_per_connection_packet_writer.cc",
1276     "tools/quic/quic_per_connection_packet_writer.h",
1277     "tools/quic/quic_server_session.cc",
1278     "tools/quic/quic_server_session.h",
1279     "tools/quic/quic_simple_client.cc",
1280     "tools/quic/quic_simple_client.h",
1281     "tools/quic/quic_simple_per_connection_packet_writer.cc",
1282     "tools/quic/quic_simple_per_connection_packet_writer.h",
1283     "tools/quic/quic_simple_server.cc",
1284     "tools/quic/quic_simple_server.h",
1285     "tools/quic/quic_simple_server_packet_writer.cc",
1286     "tools/quic/quic_simple_server_packet_writer.h",
1287     "tools/quic/quic_spdy_client_stream.cc",
1288     "tools/quic/quic_spdy_client_stream.h",
1289     "tools/quic/quic_spdy_server_stream.cc",
1290     "tools/quic/quic_spdy_server_stream.h",
1291     "tools/quic/quic_time_wait_list_manager.cc",
1292     "tools/quic/quic_time_wait_list_manager.h",
1293     "tools/quic/synchronous_host_resolver.cc",
1294     "tools/quic/synchronous_host_resolver.h",
1295   ]
1296   deps = [
1297     ":net",
1298     "//base",
1299     "//base/third_party/dynamic_annotations",
1300     "//url",
1301   ]
1304 if (!is_ios) {
1305   executable("quic_client") {
1306     sources = [
1307       "tools/quic/quic_simple_client_bin.cc",
1308     ]
1309     deps = [
1310       ":net",
1311       ":simple_quic_tools",
1312       "//base",
1313       "//url",
1314     ]
1315   }
1316   executable("quic_server") {
1317     sources = [
1318       "tools/quic/quic_simple_server_bin.cc",
1319     ]
1320     deps = [
1321       ":net",
1322       ":simple_quic_tools",
1323       "//base",
1324       "//third_party/boringssl",
1325       "//third_party/protobuf:protobuf_lite",
1326     ]
1327   }
1330 # TODO(GYP): Delete this after we've converted everything to GN.
1331 # The _run targets exist only for compatibility w/ GYP.
1332 group("net_unittests_run") {
1333   testonly = true
1334   deps = [
1335     ":net_unittests",
1336   ]
1339 test("net_unittests") {
1340   sources = gypi_values.net_test_sources
1342   if (is_ios) {
1343     sources -= [
1344       "websockets/websocket_stream_cookie_test.cc",
1345       "websockets/websocket_stream_create_test_base.cc",
1346       "websockets/websocket_stream_create_test_base.h",
1347     ]
1348   }
1350   configs += [
1351     "//build/config:precompiled_headers",
1353     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1354     "//build/config/compiler:no_size_t_to_int_warning",
1355   ]
1356   defines = []
1358   deps = [
1359     ":balsa",
1360     ":extras",
1361     ":http_server",
1362     ":net",
1363     ":simple_quic_tools",
1364     ":test_support",
1365     "//base",
1366     "//base:i18n",
1367     "//base:prefs_test_support",
1368     "//base/allocator",
1369     "//base/third_party/dynamic_annotations",
1370     "//crypto",
1371     "//crypto:platform",
1372     "//crypto:test_support",
1373     "//net/base/registry_controlled_domains",
1374     "//sql",
1375     "//testing/gmock",
1376     "//testing/gtest",
1377     "//third_party/zlib",
1378     "//url",
1379   ]
1381   if (!is_ios) {
1382     deps += [ "//gin" ]
1383   }
1384   data = [
1385     "data/",
1386   ]
1388   if (is_linux || is_mac || is_win) {
1389     deps += [
1390       "//third_party/pyftpdlib/",
1391       "//third_party/pywebsocket/",
1392       "//third_party/tlslite/",
1393     ]
1394     data_deps = [
1395       "//third_party/pyftpdlib/",
1396       "//third_party/pywebsocket/",
1397       "//third_party/tlslite/",
1398     ]
1399     data += [
1400       "tools/testserver/",
1401       "//third_party/pyftpdlib/",
1402       "//third_party/pywebsocket/",
1403       "//third_party/tlslite/",
1404       "$root_out_dir/pyproto/google/",
1405     ]
1406   }
1408   if (is_desktop_linux) {
1409     deps += [ ":epoll_quic_tools" ]
1410   }
1411   if (is_linux) {
1412     sources += gypi_values.net_linux_test_sources
1413     deps += [
1414       ":epoll_quic_tools",
1415       ":epoll_server",
1416       ":flip_in_mem_edsm_server_base",
1417     ]
1418   }
1420   if (is_mac || is_ios) {
1421     sources += gypi_values.net_base_test_mac_ios_sources
1422   }
1424   if (is_chromeos) {
1425     sources -= [ "proxy/proxy_config_service_linux_unittest.cc" ]
1426   }
1428   if (v8_use_external_startup_data) {
1429     deps += [ "//gin" ]
1430   }
1432   if (!use_nss_certs) {
1433     sources -= [
1434       "cert/nss_cert_database_unittest.cc",
1435       "ssl/client_cert_store_nss_unittest.cc",
1436     ]
1437     if (is_chromeos) {  # Already removed for all non-ChromeOS builds.
1438       sources -= [
1439         "cert/nss_cert_database_chromeos_unittest.cc",
1440         "cert/nss_profile_filter_chromeos_unittest.cc",
1441       ]
1442     }
1443   }
1445   if (use_openssl) {
1446     # When building for OpenSSL, we need to exclude NSS specific tests
1447     # or functionality not supported by OpenSSL yet.
1448     # TODO(bulach): Add equivalent tests when the underlying
1449     #               functionality is ported to OpenSSL.
1450     sources -= [ "quic/test_tools/crypto_test_utils_nss.cc" ]
1451   } else {
1452     sources -= [
1453       "cert/x509_util_openssl_unittest.cc",
1454       "quic/test_tools/crypto_test_utils_openssl.cc",
1455       "socket/ssl_client_socket_openssl_unittest.cc",
1456       "ssl/ssl_client_session_cache_openssl_unittest.cc",
1457     ]
1458   }
1460   if (use_kerberos) {
1461     defines += [ "USE_KERBEROS" ]
1462   }
1464   # These are excluded on Android, because the actual Kerberos support, which
1465   # these test, is in a separate app on Android.
1466   if (!use_kerberos || is_android) {
1467     sources -= [
1468       "http/http_auth_gssapi_posix_unittest.cc",
1469       "http/mock_gssapi_library_posix.cc",
1470       "http/mock_gssapi_library_posix.h",
1471     ]
1472   }
1473   if (!use_kerberos) {
1474     sources -= [ "http/http_auth_handler_negotiate_unittest.cc" ]
1475   }
1477   if (use_openssl || (!is_desktop_linux && !is_chromeos && !is_ios)) {
1478     # Only include this test when on Posix and using NSS for
1479     # cert verification or on iOS (which also uses NSS for certs).
1480     sources -= [ "cert_net/nss_ocsp_unittest.cc" ]
1481   }
1483   if (!use_openssl_certs) {
1484     sources -= [ "ssl/openssl_client_key_store_unittest.cc" ]
1485   }
1487   if (!enable_websockets) {
1488     sources -= [
1489       "server/http_connection_unittest.cc",
1490       "server/http_server_response_info_unittest.cc",
1491       "server/http_server_unittest.cc",
1492       "server/web_socket_encoder_unittest.cc",
1493       "websockets/websocket_basic_stream_test.cc",
1494       "websockets/websocket_channel_test.cc",
1495       "websockets/websocket_deflate_predictor_impl_test.cc",
1496       "websockets/websocket_deflate_stream_test.cc",
1497       "websockets/websocket_deflater_test.cc",
1498       "websockets/websocket_end_to_end_test.cc",
1499       "websockets/websocket_errors_test.cc",
1500       "websockets/websocket_extension_parser_test.cc",
1501       "websockets/websocket_frame_parser_test.cc",
1502       "websockets/websocket_frame_test.cc",
1503       "websockets/websocket_handshake_challenge_test.cc",
1504       "websockets/websocket_handshake_stream_create_helper_test.cc",
1505       "websockets/websocket_inflater_test.cc",
1506       "websockets/websocket_stream_test.cc",
1507       "websockets/websocket_test_util.cc",
1508       "websockets/websocket_test_util.h",
1509     ]
1510     deps -= [ ":http_server" ]
1511   }
1513   if (disable_file_support) {
1514     sources -= [
1515       "base/directory_lister_unittest.cc",
1516       "url_request/url_request_file_job_unittest.cc",
1517     ]
1518   }
1520   if (disable_ftp_support) {
1521     sources -= [
1522       "ftp/ftp_auth_cache_unittest.cc",
1523       "ftp/ftp_ctrl_response_buffer_unittest.cc",
1524       "ftp/ftp_directory_listing_parser_ls_unittest.cc",
1525       "ftp/ftp_directory_listing_parser_netware_unittest.cc",
1526       "ftp/ftp_directory_listing_parser_os2_unittest.cc",
1527       "ftp/ftp_directory_listing_parser_unittest.cc",
1528       "ftp/ftp_directory_listing_parser_unittest.h",
1529       "ftp/ftp_directory_listing_parser_vms_unittest.cc",
1530       "ftp/ftp_directory_listing_parser_windows_unittest.cc",
1531       "ftp/ftp_network_transaction_unittest.cc",
1532       "ftp/ftp_util_unittest.cc",
1533       "url_request/url_request_ftp_job_unittest.cc",
1534     ]
1535   }
1537   if (!enable_built_in_dns) {
1538     sources -= [
1539       "dns/address_sorter_posix_unittest.cc",
1540       "dns/address_sorter_unittest.cc",
1541     ]
1542   }
1544   # Always need use_v8_in_net to be 1 to run on Android, so just remove
1545   # net_unittest's dependency on v8 when using icu alternatives instead of
1546   # setting use_v8_in_net to 0.
1547   if (use_v8_in_net && !use_icu_alternatives_on_android) {
1548     deps += [ ":net_with_v8" ]
1549   } else {
1550     sources -= [
1551       "proxy/proxy_resolver_v8_tracing_unittest.cc",
1552       "proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc",
1553       "proxy/proxy_resolver_v8_unittest.cc",
1554     ]
1555   }
1557   if (use_v8_in_net && !is_android) {
1558     deps += [
1559       ":net_browser_services",
1560       ":net_utility_services",
1561       "//mojo/environment:chromium",
1562       "//third_party/mojo/src/mojo/edk/system",
1563     ]
1564   } else {
1565     sources -= [
1566       "dns/host_resolver_mojo_unittest.cc",
1567       "dns/mojo_host_resolver_impl_unittest.cc",
1568       "proxy/mojo_proxy_resolver_factory_impl_unittest.cc",
1569       "proxy/mojo_proxy_resolver_impl_unittest.cc",
1570       "proxy/mojo_proxy_resolver_v8_tracing_bindings_unittest.cc",
1571       "proxy/proxy_resolver_factory_mojo_unittest.cc",
1572       "proxy/proxy_service_mojo_unittest.cc",
1573     ]
1574   }
1576   if (!enable_mdns) {
1577     sources -= [
1578       "dns/mdns_cache_unittest.cc",
1579       "dns/mdns_client_unittest.cc",
1580       "dns/record_parsed_unittest.cc",
1581       "dns/record_rdata_unittest.cc",
1582     ]
1583   }
1585   if (is_ios) {
1586     # TODO(GYP)
1587     #  'actions': [
1588     #    {
1589     #      'action_name': 'copy_test_data',
1590     #      'variables': {
1591     #        'test_data_files': [
1592     #          'data/ssl/certificates/',
1593     #          'data/test.html',
1594     #          'data/url_request_unittest/',
1595     #          'data/verify_name_match_unittest/names/',
1596     #          'data/parse_certificate_unittest/',
1597     #        ],
1598     #        'test_data_prefix': 'net',
1599     #      },
1600     #      'includes': [ '../build/copy_test_data_ios.gypi' ],
1601     #    },
1602     #  ],
1603     sources -= [
1604       # TODO(droger): The following tests are disabled because the
1605       # implementation is missing or incomplete.
1606       # KeygenHandler::GenKeyAndSignChallenge() is not ported to iOS.
1607       "base/keygen_handler_unittest.cc",
1608       "disk_cache/backend_unittest.cc",
1609       "disk_cache/blockfile/block_files_unittest.cc",
1611       # Need to read input data files.
1612       "filter/gzip_filter_unittest.cc",
1613       "socket/ssl_server_socket_unittest.cc",
1614       "spdy/fuzzing/hpack_fuzz_util_test.cc",
1616       # Need TestServer.
1617       "cert_net/cert_net_fetcher_impl_unittest.cc",
1618       "proxy/proxy_script_fetcher_impl_unittest.cc",
1619       "socket/ssl_client_socket_unittest.cc",
1620       "url_request/url_fetcher_impl_unittest.cc",
1621       "url_request/url_request_context_builder_unittest.cc",
1623       # Needs GetAppOutput().
1624       "test/python_utils_unittest.cc",
1626       # The following tests are disabled because they don't apply to
1627       # iOS.
1628       # OS is not "linux" or "freebsd" or "openbsd".
1629       "socket/unix_domain_client_socket_posix_unittest.cc",
1630       "socket/unix_domain_server_socket_posix_unittest.cc",
1632       # See bug http://crbug.com/344533.
1633       "disk_cache/blockfile/index_table_v3_unittest.cc",
1634     ]
1635   }
1637   if (is_android) {
1638     sources -= [
1639       # See bug http://crbug.com/344533.
1640       "disk_cache/blockfile/index_table_v3_unittest.cc",
1641       "dns/dns_config_service_posix_unittest.cc",
1642     ]
1643     deps += [
1644       ":net_test_jni_headers",
1646       # TODO(mmenke):  This depends on test_support_base, which depends on
1647       #                icu.  Figure out a way to remove that dependency.
1648       "//testing/android/native_test:native_test_native_code",
1649     ]
1650     set_sources_assignment_filter([])
1651     sources += [ "base/address_tracker_linux_unittest.cc" ]
1652     set_sources_assignment_filter(sources_assignment_filter)
1653     isolate_file = "net_unittests.isolate"
1654   }
1656   if (use_icu_alternatives_on_android) {
1657     sources -= [
1658       "base/filename_util_unittest.cc",
1659       "base/net_util_icu_unittest.cc",
1660     ]
1661     deps -= [ "//base:i18n" ]
1662   }
1664   # Symbols for crashes when running tests on swarming.
1665   if (symbol_level > 0) {
1666     if (is_win) {
1667       data += [ "$root_out_dir/net_unittests.exe.pdb" ]
1668     } else if (is_mac) {
1669       data += [ "$root_out_dir/net_unittests.dSYM/" ]
1670     }
1671   }
1674 # !is_android && !is_win && !is_mac
1676 executable("net_perftests") {
1677   testonly = true
1678   sources = [
1679     "base/mime_sniffer_perftest.cc",
1680     "cookies/cookie_monster_perftest.cc",
1681     "disk_cache/blockfile/disk_cache_perftest.cc",
1682     "extras/sqlite/sqlite_persistent_cookie_store_perftest.cc",
1683     "proxy/proxy_resolver_perftest.cc",
1684     "udp/udp_socket_perftest.cc",
1685   ]
1687   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1688   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1689   deps = [
1690     ":extras",
1691     ":net",
1692     ":test_support",
1693     "//base",
1694     "//base:i18n",
1695     "//base/test:test_support_perf",
1696     "//testing/gtest",
1697     "//url",
1698   ]
1700   if (enable_websockets) {
1701     sources += [ "websockets/websocket_frame_perftest.cc" ]
1702   }
1704   if (use_v8_in_net) {
1705     deps += [ ":net_with_v8" ]
1706   } else {
1707     sources -= [ "proxy/proxy_resolver_perftest.cc" ]
1708   }