Move android_app_version_* into an inner variables dict.
[chromium-blink-merge.git] / net / BUILD.gn
blob79bd614f1877cb0aa23e7ddb97805287b26b2f10
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")
13 # TODO(cjhopman): //build/config/android/rules.gni also imports grit_rule.gni.
14 # Currently, that file can't be imported multiple times.  Make this always
15 # imported when http://crbug.com/393704 is fixed.
16 if (!is_android) {
17   import("//tools/grit/grit_rule.gni")
20 if (is_android) {
21   import("//build/config/android/config.gni")
22   import("//build/config/android/rules.gni")
23 } else if (is_mac) {
24   import("//build/config/mac/mac_sdk.gni")
27 # The list of net files is kept in net.gypi. Read it.
28 gypi_values = exec_script("//build/gypi_to_gn.py",
29                           [ rebase_path("net.gypi") ],
30                           "scope",
31                           [ "net.gypi" ])
33 # Disable Kerberos on ChromeOS, Android and iOS, at least for now. It needs
34 # configuration (krb5.conf and so on).
35 use_kerberos = !is_chromeos && !is_android && !is_ios
37 # The way the cache uses mmap() is inefficient on some Android devices. If
38 # this flag is set, we hackily avoid using mmap() in the disk cache. We are
39 # pretty confident that mmap-ing the index would not hurt any existing x86
40 # android devices, but we cannot be so sure about the variety of ARM devices.
41 # So enable it for x86 only for now.
42 posix_avoid_mmap = is_android && current_cpu != "x86"
44 # WebSockets and socket stream code are used everywhere except iOS.
45 enable_websockets = !is_ios
46 use_v8_in_net = !is_ios
47 enable_built_in_dns = !is_ios
48 disable_ftp_support = is_ios
50 declare_args() {
51   # Disables support for file URLs.  File URL support requires use of icu.
52   disable_file_support = false
55 config("net_config") {
56   defines = []
57   if (posix_avoid_mmap) {
58     defines += [ "POSIX_AVOID_MMAP" ]
59   }
60   if (disable_file_support) {
61     defines += [ "DISABLE_FILE_SUPPORT" ]
62   }
65 component("net") {
66   sources =
67       gypi_values.net_nacl_common_sources + gypi_values.net_non_nacl_sources
69   cflags = []
70   defines = [
71     # TODO(GYP) Note that he GYP file supports linux_link_kerberos (defaults to
72     # 0) which implies that we run pkg_config on kerberos and link to that
73     # rather than setting this define which will dynamically open it. That
74     # doesn't seem to be set in the regular builds, so we're skipping this
75     # capability here.
76     "DLOPEN_KERBEROS",
77     "NET_IMPLEMENTATION",
78   ]
80   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
81   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
82   public_configs = [ ":net_config" ]
83   include_dirs = []
85   public_deps = [
86     "//crypto",
87     "//crypto:platform",
88     "//url",
89   ]
90   deps = [
91     ":net_resources",
92     "//base",
93     "//base:prefs",
94     "//base/third_party/dynamic_annotations",
95     "//net/base/registry_controlled_domains",
96     "//sdch",
97     "//third_party/zlib",
98     "//url",
99   ]
101   if (use_kerberos) {
102     defines += [ "USE_KERBEROS" ]
103     if (is_android) {
104       include_dirs += [ "/usr/include/kerberosV" ]
105     }
106   } else {
107     sources -= [
108       "http/http_auth_gssapi_posix.cc",
109       "http/http_auth_gssapi_posix.h",
110       "http/http_auth_handler_negotiate.cc",
111       "http/http_auth_handler_negotiate.h",
112     ]
113   }
115   if (is_posix) {
116     if (posix_avoid_mmap) {
117       sources -= [ "disk_cache/blockfile/mapped_file_posix.cc" ]
118     } else {
119       sources -= [ "disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc" ]
120     }
121   }
123   if (disable_file_support) {
124     sources -= [
125       "base/directory_lister.cc",
126       "base/directory_lister.h",
127       "url_request/file_protocol_handler.cc",
128       "url_request/file_protocol_handler.h",
129       "url_request/url_request_file_dir_job.cc",
130       "url_request/url_request_file_dir_job.h",
131       "url_request/url_request_file_job.cc",
132       "url_request/url_request_file_job.h",
133     ]
134   }
136   if (disable_ftp_support) {
137     sources -= [
138       "ftp/ftp_auth_cache.cc",
139       "ftp/ftp_auth_cache.h",
140       "ftp/ftp_ctrl_response_buffer.cc",
141       "ftp/ftp_ctrl_response_buffer.h",
142       "ftp/ftp_directory_listing_parser.cc",
143       "ftp/ftp_directory_listing_parser.h",
144       "ftp/ftp_directory_listing_parser_ls.cc",
145       "ftp/ftp_directory_listing_parser_ls.h",
146       "ftp/ftp_directory_listing_parser_netware.cc",
147       "ftp/ftp_directory_listing_parser_netware.h",
148       "ftp/ftp_directory_listing_parser_os2.cc",
149       "ftp/ftp_directory_listing_parser_os2.h",
150       "ftp/ftp_directory_listing_parser_vms.cc",
151       "ftp/ftp_directory_listing_parser_vms.h",
152       "ftp/ftp_directory_listing_parser_windows.cc",
153       "ftp/ftp_directory_listing_parser_windows.h",
154       "ftp/ftp_network_layer.cc",
155       "ftp/ftp_network_layer.h",
156       "ftp/ftp_network_session.cc",
157       "ftp/ftp_network_session.h",
158       "ftp/ftp_network_transaction.cc",
159       "ftp/ftp_network_transaction.h",
160       "ftp/ftp_request_info.h",
161       "ftp/ftp_response_info.cc",
162       "ftp/ftp_response_info.h",
163       "ftp/ftp_server_type_histograms.cc",
164       "ftp/ftp_server_type_histograms.h",
165       "ftp/ftp_transaction.h",
166       "ftp/ftp_transaction_factory.h",
167       "ftp/ftp_util.cc",
168       "ftp/ftp_util.h",
169       "url_request/ftp_protocol_handler.cc",
170       "url_request/ftp_protocol_handler.h",
171       "url_request/url_request_ftp_job.cc",
172       "url_request/url_request_ftp_job.h",
173     ]
174   }
176   if (enable_built_in_dns) {
177     defines += [ "ENABLE_BUILT_IN_DNS" ]
178   } else {
179     sources -= [
180       "dns/address_sorter_posix.cc",
181       "dns/address_sorter_posix.h",
182       "dns/dns_client.cc",
183     ]
184   }
186   if (use_openssl) {
187     sources -= [
188       "base/nss_memio.c",
189       "base/nss_memio.h",
190       "cert/ct_log_verifier_nss.cc",
191       "cert/ct_objects_extractor_nss.cc",
192       "cert/jwk_serializer_nss.cc",
193       "cert/scoped_nss_types.h",
194       "cert/test_root_certs_nss.cc",
195       "cert/x509_util_nss.cc",
196       "cert/x509_util_nss.h",
197       "ocsp/nss_ocsp.cc",
198       "ocsp/nss_ocsp.h",
199       "quic/crypto/aead_base_decrypter_nss.cc",
200       "quic/crypto/aead_base_encrypter_nss.cc",
201       "quic/crypto/aes_128_gcm_12_decrypter_nss.cc",
202       "quic/crypto/aes_128_gcm_12_encrypter_nss.cc",
203       "quic/crypto/chacha20_poly1305_decrypter_nss.cc",
204       "quic/crypto/chacha20_poly1305_encrypter_nss.cc",
205       "quic/crypto/channel_id_nss.cc",
206       "quic/crypto/p256_key_exchange_nss.cc",
207       "socket/nss_ssl_util.cc",
208       "socket/nss_ssl_util.h",
209       "socket/ssl_client_socket_nss.cc",
210       "socket/ssl_client_socket_nss.h",
211       "socket/ssl_server_socket_nss.cc",
212       "socket/ssl_server_socket_nss.h",
213     ]
214     if (is_chromeos) {
215       sources -= [
216         "cert/nss_cert_database_chromeos.cc",
217         "cert/nss_cert_database_chromeos.h",
218         "cert/nss_profile_filter_chromeos.cc",
219         "cert/nss_profile_filter_chromeos.h",
220       ]
221     }
222     if (is_linux) {
223       # These are always removed for non-Linux cases below.
224       sources -= [
225         "base/crypto_module_nss.cc",
226         "base/keygen_handler_nss.cc",
227         "cert/cert_database_nss.cc",
228         "cert/nss_cert_database.cc",
229         "cert/nss_cert_database.h",
230         "cert/x509_certificate_nss.cc",
231         "third_party/mozilla_security_manager/nsKeygenHandler.cpp",
232         "third_party/mozilla_security_manager/nsKeygenHandler.h",
233         "third_party/mozilla_security_manager/nsNSSCertificateDB.cpp",
234         "third_party/mozilla_security_manager/nsNSSCertificateDB.h",
235         "third_party/mozilla_security_manager/nsPKCS12Blob.cpp",
236         "third_party/mozilla_security_manager/nsPKCS12Blob.h",
237       ]
238     }
239     if (is_ios) {
240       # Always removed for !ios below.
241       sources -= [
242         "cert/cert_verify_proc_nss.cc",
243         "cert/cert_verify_proc_nss.h",
244       ]
245     }
246     if (is_win) {
247       sources -= [ "cert/sha256_legacy_support_nss_win.cc" ]
248     }
249   } else {
250     sources -= [
251       "base/crypto_module_openssl.cc",
252       "cert/ct_log_verifier_openssl.cc",
253       "cert/ct_objects_extractor_openssl.cc",
254       "cert/jwk_serializer_openssl.cc",
255       "cert/x509_util_openssl.cc",
256       "cert/x509_util_openssl.h",
257       "quic/crypto/aead_base_decrypter_openssl.cc",
258       "quic/crypto/aead_base_encrypter_openssl.cc",
259       "quic/crypto/aes_128_gcm_12_decrypter_openssl.cc",
260       "quic/crypto/aes_128_gcm_12_encrypter_openssl.cc",
261       "quic/crypto/chacha20_poly1305_decrypter_openssl.cc",
262       "quic/crypto/chacha20_poly1305_encrypter_openssl.cc",
263       "quic/crypto/channel_id_openssl.cc",
264       "quic/crypto/p256_key_exchange_openssl.cc",
265       "quic/crypto/scoped_evp_aead_ctx.cc",
266       "quic/crypto/scoped_evp_aead_ctx.h",
267       "socket/ssl_client_socket_openssl.cc",
268       "socket/ssl_client_socket_openssl.h",
269       "socket/ssl_server_socket_openssl.cc",
270       "socket/ssl_server_socket_openssl.h",
271       "socket/ssl_session_cache_openssl.cc",
272       "socket/ssl_session_cache_openssl.h",
273       "ssl/openssl_platform_key.h",
274       "ssl/openssl_ssl_util.cc",
275       "ssl/openssl_ssl_util.h",
276     ]
277     if (is_mac) {
278       sources -= [ "ssl/openssl_platform_key_mac.cc" ]
279     }
280     if (is_win) {
281       sources -= [
282         "cert/sha256_legacy_support_openssl_win.cc",
283         "ssl/openssl_platform_key_win.cc",
284       ]
285     }
286   }
288   if (!use_openssl_certs) {
289     sources -= [
290       "base/keygen_handler_openssl.cc",
291       "base/openssl_private_key_store.h",
292       "base/openssl_private_key_store_memory.cc",
293       "cert/cert_database_openssl.cc",
294       "cert/cert_verify_proc_openssl.cc",
295       "cert/cert_verify_proc_openssl.h",
296       "cert/test_root_certs_openssl.cc",
297       "cert/x509_certificate_openssl.cc",
298       "ssl/openssl_client_key_store.cc",
299       "ssl/openssl_client_key_store.h",
300     ]
301     if (is_android) {
302       sources -= [ "base/openssl_private_key_store_android.cc" ]
303     }
304   } else if (is_android) {
305     # Android doesn't use these even when using OpenSSL.
306     sources -= [
307       "base/openssl_private_key_store_memory.cc",
308       "cert/cert_database_openssl.cc",
309       "cert/cert_verify_proc_openssl.cc",
310       "cert/test_root_certs_openssl.cc",
311     ]
312   }
314   if (use_glib && !is_chromeos) {
315     configs += [ "//build/config/linux:gconf" ]
316     deps += [ "//build/config/linux:gio" ]
317   }
319   if (is_linux) {
320     configs += [ "//build/config/linux:libresolv" ]
321   } else {
322     sources -= [
323       "base/crypto_module_nss.cc",
324       "base/keygen_handler_nss.cc",
325       "cert/cert_database_nss.cc",
326       "cert/nss_cert_database.cc",
327       "cert/nss_cert_database.h",
328       "cert/x509_certificate_nss.cc",
329       "third_party/mozilla_security_manager/nsKeygenHandler.cpp",
330       "third_party/mozilla_security_manager/nsKeygenHandler.h",
331       "third_party/mozilla_security_manager/nsNSSCertificateDB.cpp",
332       "third_party/mozilla_security_manager/nsNSSCertificateDB.h",
333       "third_party/mozilla_security_manager/nsPKCS12Blob.cpp",
334       "third_party/mozilla_security_manager/nsPKCS12Blob.h",
335     ]
337     if (!is_ios && !use_openssl) {
338       # These files are part of the partial implementation of NSS on iOS so
339       # keep them in that case.
340       sources -= [
341         "cert/test_root_certs_nss.cc",
342         "ocsp/nss_ocsp.cc",
343         "ocsp/nss_ocsp.h",
344       ]
345     }
346   }
348   if (!use_nss_certs) {
349     sources -= [
350       "ssl/client_cert_store_nss.cc",
351       "ssl/client_cert_store_nss.h",
352     ]
353     if (!is_ios) {
354       # These files are part of the partial implementation of NSS on iOS so
355       # keep them in that case (even though use_nss_certs is not set).
356       sources -= [
357         "cert/cert_verify_proc_nss.cc",
358         "cert/cert_verify_proc_nss.h",
359       ]
360     }
361     if (is_chromeos) {
362       # These were already removed on non-ChromeOS.
363       sources -= [
364         "ssl/client_cert_store_chromeos.cc",
365         "ssl/client_cert_store_chromeos.h",
366       ]
367     }
368   }
370   if (!enable_websockets) {
371     sources -= [
372       "websockets/websocket_basic_handshake_stream.cc",
373       "websockets/websocket_basic_handshake_stream.h",
374       "websockets/websocket_basic_stream.cc",
375       "websockets/websocket_basic_stream.h",
376       "websockets/websocket_channel.cc",
377       "websockets/websocket_channel.h",
378       "websockets/websocket_deflate_predictor.h",
379       "websockets/websocket_deflate_predictor_impl.cc",
380       "websockets/websocket_deflate_predictor_impl.h",
381       "websockets/websocket_deflate_stream.cc",
382       "websockets/websocket_deflate_stream.h",
383       "websockets/websocket_deflater.cc",
384       "websockets/websocket_deflater.h",
385       "websockets/websocket_errors.cc",
386       "websockets/websocket_errors.h",
387       "websockets/websocket_extension.cc",
388       "websockets/websocket_extension.h",
389       "websockets/websocket_extension_parser.cc",
390       "websockets/websocket_extension_parser.h",
391       "websockets/websocket_frame.cc",
392       "websockets/websocket_frame.h",
393       "websockets/websocket_frame_parser.cc",
394       "websockets/websocket_frame_parser.h",
395       "websockets/websocket_handshake_challenge.cc",
396       "websockets/websocket_handshake_challenge.h",
397       "websockets/websocket_handshake_constants.cc",
398       "websockets/websocket_handshake_constants.h",
399       "websockets/websocket_handshake_request_info.cc",
400       "websockets/websocket_handshake_request_info.h",
401       "websockets/websocket_handshake_response_info.cc",
402       "websockets/websocket_handshake_response_info.h",
403       "websockets/websocket_handshake_stream_base.h",
404       "websockets/websocket_handshake_stream_create_helper.cc",
405       "websockets/websocket_handshake_stream_create_helper.h",
406       "websockets/websocket_inflater.cc",
407       "websockets/websocket_inflater.h",
408       "websockets/websocket_mux.h",
409       "websockets/websocket_stream.cc",
410       "websockets/websocket_stream.h",
411     ]
412   }
414   if (!enable_mdns) {
415     sources -= [
416       "dns/mdns_cache.cc",
417       "dns/mdns_cache.h",
418       "dns/mdns_client.cc",
419       "dns/mdns_client.h",
420       "dns/mdns_client_impl.cc",
421       "dns/mdns_client_impl.h",
422       "dns/record_parsed.cc",
423       "dns/record_parsed.h",
424       "dns/record_rdata.cc",
425       "dns/record_rdata.h",
426     ]
427   }
429   if (is_win) {
430     sources -= [
431       "http/http_auth_handler_ntlm_portable.cc",
432       "socket/socket_libevent.cc",
433       "socket/socket_libevent.h",
434       "socket/tcp_socket_libevent.cc",
435       "socket/tcp_socket_libevent.h",
436       "udp/udp_socket_libevent.cc",
437       "udp/udp_socket_libevent.h",
438     ]
439   } else {  # !is_win
440     sources -= [
441       "base/winsock_init.cc",
442       "base/winsock_init.h",
443       "base/winsock_util.cc",
444       "base/winsock_util.h",
445       "proxy/proxy_resolver_winhttp.cc",
446       "proxy/proxy_resolver_winhttp.h",
447     ]
448   }
450   if (is_mac) {
451     libs = [
452       "Foundation.framework",
453       "Security.framework",
454       "SystemConfiguration.framework",
455       "resolv",
456     ]
457   }
459   if (is_ios) {
460     # Add back some sources that were otherwise filtered out. iOS additionally
461     # doesn't set USE_NSS but needs some of the files.
462     set_sources_assignment_filter([])
463     sources += [
464       "base/net_util_mac.cc",
465       "base/net_util_mac.h",
466       "base/network_change_notifier_mac.cc",
467       "base/network_config_watcher_mac.cc",
468       "base/platform_mime_util_mac.mm",
469       "cert/cert_verify_proc_nss.cc",
470       "cert/cert_verify_proc_nss.h",
471       "cert/test_root_certs_nss.cc",
472       "cert/x509_util_nss.cc",
473       "cert/x509_util_nss.h",
474       "ocsp/nss_ocsp.cc",
475       "ocsp/nss_ocsp.h",
476       "proxy/proxy_resolver_mac.cc",
477       "proxy/proxy_server_mac.cc",
478     ]
479     set_sources_assignment_filter(sources_assignment_filter)
481     sources -= [ "disk_cache/blockfile/file_posix.cc" ]
482     libs = [
483       "CFNetwork.framework",
484       "MobileCoreServices.framework",
485       "Security.framework",
486       "SystemConfiguration.framework",
487       "resolv",
488     ]
489   }
491   if (is_ios || is_mac) {
492     sources += gypi_values.net_base_mac_ios_sources
493   }
495   if (is_android) {
496     # Add some Linux sources that were excluded by the filter, but which
497     # are needed.
498     set_sources_assignment_filter([])
499     sources += [
500       "base/address_tracker_linux.cc",
501       "base/address_tracker_linux.h",
502       "base/net_util_linux.cc",
503       "base/net_util_linux.h",
504       "base/platform_mime_util_linux.cc",
505     ]
506     set_sources_assignment_filter(sources_assignment_filter)
508     if (!is_android_webview_build) {
509       deps += [ ":net_jni_headers" ]
510     }
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     "net_resources.rc",
538   ]
541 static_library("extras") {
542   sources = gypi_values.net_extras_sources
543   configs += [ "//build/config/compiler:wexit_time_destructors" ]
544   deps = [
545     ":net",
546     "//base",
547     "//sql:sql",
548   ]
551 static_library("http_server") {
552   sources = [
553     "server/http_connection.cc",
554     "server/http_connection.h",
555     "server/http_server.cc",
556     "server/http_server.h",
557     "server/http_server_request_info.cc",
558     "server/http_server_request_info.h",
559     "server/http_server_response_info.cc",
560     "server/http_server_response_info.h",
561     "server/web_socket.cc",
562     "server/web_socket.h",
563     "server/web_socket_encoder.cc",
564     "server/web_socket_encoder.h",
565   ]
566   configs += [
567     "//build/config/compiler:no_size_t_to_int_warning",
568     "//build/config/compiler:wexit_time_destructors",
569   ]
570   deps = [
571     ":net",
572     "//base",
573   ]
576 executable("dump_cache") {
577   testonly = true
578   sources = [
579     "tools/dump_cache/cache_dumper.cc",
580     "tools/dump_cache/cache_dumper.h",
581     "tools/dump_cache/dump_cache.cc",
582     "tools/dump_cache/dump_files.cc",
583     "tools/dump_cache/dump_files.h",
584     "tools/dump_cache/simple_cache_dumper.cc",
585     "tools/dump_cache/simple_cache_dumper.h",
586     "tools/dump_cache/url_to_filename_encoder.cc",
587     "tools/dump_cache/url_to_filename_encoder.h",
588     "tools/dump_cache/url_utilities.cc",
589     "tools/dump_cache/url_utilities.h",
590   ]
592   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
593   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
595   deps = [
596     "//base",
597     ":net",
598     ":test_support",
599   ]
602 source_set("test_support") {
603   testonly = true
604   sources = [
605     "base/captured_net_log_entry.cc",
606     "base/captured_net_log_entry.h",
607     "base/capturing_net_log.cc",
608     "base/capturing_net_log.h",
609     "base/capturing_net_log_observer.cc",
610     "base/capturing_net_log_observer.h",
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     "proxy/mock_proxy_resolver.cc",
640     "proxy/mock_proxy_resolver.h",
641     "proxy/mock_proxy_script_fetcher.cc",
642     "proxy/mock_proxy_script_fetcher.h",
643     "proxy/proxy_config_service_common_unittest.cc",
644     "proxy/proxy_config_service_common_unittest.h",
645     "socket/socket_test_util.cc",
646     "socket/socket_test_util.h",
647     "test/cert_test_util.cc",
648     "test/cert_test_util.h",
649     "test/cert_test_util_nss.cc",
650     "test/ct_test_util.cc",
651     "test/ct_test_util.h",
652     "test/embedded_test_server/embedded_test_server.cc",
653     "test/embedded_test_server/embedded_test_server.h",
654     "test/embedded_test_server/http_connection.cc",
655     "test/embedded_test_server/http_connection.h",
656     "test/embedded_test_server/http_request.cc",
657     "test/embedded_test_server/http_request.h",
658     "test/embedded_test_server/http_response.cc",
659     "test/embedded_test_server/http_response.h",
660     "test/event_waiter.h",
661     "test/net_test_suite.cc",
662     "test/net_test_suite.h",
663     "test/python_utils.cc",
664     "test/python_utils.h",
665     "test/spawned_test_server/base_test_server.cc",
666     "test/spawned_test_server/base_test_server.h",
667     "test/spawned_test_server/local_test_server.cc",
668     "test/spawned_test_server/local_test_server.h",
669     "test/spawned_test_server/local_test_server_posix.cc",
670     "test/spawned_test_server/local_test_server_win.cc",
671     "test/spawned_test_server/remote_test_server.cc",
672     "test/spawned_test_server/remote_test_server.h",
673     "test/spawned_test_server/spawned_test_server.h",
674     "test/spawned_test_server/spawner_communicator.cc",
675     "test/spawned_test_server/spawner_communicator.h",
676     "test/url_request/url_request_failed_job.cc",
677     "test/url_request/url_request_failed_job.h",
678     "test/url_request/url_request_mock_data_job.cc",
679     "test/url_request/url_request_mock_data_job.h",
680     "test/url_request/url_request_mock_http_job.cc",
681     "test/url_request/url_request_mock_http_job.h",
682     "test/url_request/url_request_slow_download_job.cc",
683     "test/url_request/url_request_slow_download_job.h",
684     "url_request/test_url_fetcher_factory.cc",
685     "url_request/test_url_fetcher_factory.h",
686     "url_request/test_url_request_interceptor.cc",
687     "url_request/test_url_request_interceptor.h",
688     "url_request/url_request_test_util.cc",
689     "url_request/url_request_test_util.h",
690   ]
692   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
693   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
695   public_deps = [
696     "//base",
697     "//base/test:test_support",
698     "//crypto",
699     "//net",
700     "//net/tools/tld_cleanup",
701     "//testing/gmock",
702     "//testing/gtest",
703     "//url",
704   ]
706   if (!is_ios) {
707     public_deps += [ "//third_party/protobuf:py_proto" ]
708   }
710   if (!use_openssl && (use_nss_certs || is_ios)) {
711     public_deps += [ "//crypto:platform" ]
712   }
714   if (!is_android) {
715     sources -= [
716       "test/spawned_test_server/remote_test_server.cc",
717       "test/spawned_test_server/remote_test_server.h",
718       "test/spawned_test_server/spawner_communicator.cc",
719       "test/spawned_test_server/spawner_communicator.h",
720     ]
721   }
723   if (use_v8_in_net) {
724     public_deps += [ ":net_with_v8" ]
725   }
727   if (!enable_mdns) {
728     sources -= [
729       "dns/mock_mdns_socket_factory.cc",
730       "dns/mock_mdns_socket_factory.h",
731     ]
732   }
734   if (!use_nss_certs) {
735     sources -= [ "test/cert_test_util_nss.cc" ]
736   }
739 source_set("balsa") {
740   sources = [
741     "tools/balsa/balsa_enums.h",
742     "tools/balsa/balsa_frame.cc",
743     "tools/balsa/balsa_frame.h",
744     "tools/balsa/balsa_headers.cc",
745     "tools/balsa/balsa_headers.h",
746     "tools/balsa/balsa_headers_token_utils.cc",
747     "tools/balsa/balsa_headers_token_utils.h",
748     "tools/balsa/balsa_visitor_interface.h",
749     "tools/balsa/http_message_constants.cc",
750     "tools/balsa/http_message_constants.h",
751     "tools/balsa/noop_balsa_visitor.h",
752     "tools/balsa/simple_buffer.cc",
753     "tools/balsa/simple_buffer.h",
754     "tools/balsa/split.cc",
755     "tools/balsa/split.h",
756     "tools/balsa/string_piece_utils.h",
757     "tools/quic/spdy_utils.cc",
758     "tools/quic/spdy_utils.h",
759   ]
760   deps = [
761     ":net",
762     "//base",
763     "//url",
764   ]
767 if (use_v8_in_net) {
768   component("net_with_v8") {
769     sources = [
770       "proxy/proxy_resolver_v8.cc",
771       "proxy/proxy_resolver_v8.h",
772       "proxy/proxy_resolver_v8_tracing.cc",
773       "proxy/proxy_resolver_v8_tracing.h",
774       "proxy/proxy_service_v8.cc",
775       "proxy/proxy_service_v8.h",
776     ]
778     defines = [ "NET_IMPLEMENTATION" ]
779     configs += [
780       "//build/config/compiler:no_size_t_to_int_warning",
781       "//build/config/compiler:wexit_time_destructors",
782     ]
784     public_deps = [
785       ":net",
786     ]
787     deps = [
788       "//base",
789       "//gin",
790       "//url",
791       "//v8",
792     ]
793   }
796 if (use_v8_in_net && !is_android) {
797   source_set("net_browser_services") {
798     sources = [
799       "dns/mojo_host_resolver_impl.cc",
800       "dns/mojo_host_resolver_impl.h",
801       "proxy/in_process_mojo_proxy_resolver_factory.cc",
802       "proxy/in_process_mojo_proxy_resolver_factory.h",
803       "proxy/mojo_proxy_resolver_factory.h",
804       "proxy/proxy_resolver_mojo.cc",
805       "proxy/proxy_resolver_mojo.h",
806       "proxy/proxy_service_mojo.cc",
807       "proxy/proxy_service_mojo.h",
808     ]
810     public_deps = [
811       ":mojo_type_converters",
812       ":net",
813       "//base",
814       "//mojo/common",
815       "//net/interfaces",
816       "//third_party/mojo/src/mojo/public/cpp/bindings",
818       # NOTE(amistry): As long as we support in-process Mojo v8 PAC, we need
819       # this dependency since in_process_mojo_proxy_resolver_factory creates
820       # the utility process side Mojo services in the browser process.
821       # Ultimately, this will go away when we only support out-of-process.
822       ":net_utility_services",
823     ]
824   }
826   source_set("mojo_type_converters") {
827     sources = [
828       "dns/mojo_host_type_converters.cc",
829       "dns/mojo_host_type_converters.h",
830       "proxy/mojo_proxy_type_converters.cc",
831       "proxy/mojo_proxy_type_converters.h",
832     ]
834     public_deps = [
835       ":net",
836       "//net/interfaces",
837       "//third_party/mojo/src/mojo/public/cpp/bindings",
838     ]
839   }
841   source_set("net_utility_services") {
842     sources = [
843       "dns/host_resolver_mojo.cc",
844       "dns/host_resolver_mojo.h",
845       "proxy/load_state_change_coalescer.cc",
846       "proxy/load_state_change_coalescer.h",
847       "proxy/mojo_proxy_resolver_factory_impl.cc",
848       "proxy/mojo_proxy_resolver_factory_impl.h",
849       "proxy/mojo_proxy_resolver_impl.cc",
850       "proxy/mojo_proxy_resolver_impl.h",
851     ]
853     public_deps = [
854       ":mojo_type_converters",
855       ":net",
856       "//mojo/common",
857       "//net/interfaces",
858       "//third_party/mojo/src/mojo/public/cpp/bindings",
859     ]
860   }
863 if (!is_ios && !is_android) {
864   executable("crash_cache") {
865     testonly = true
866     sources = [
867       "tools/crash_cache/crash_cache.cc",
868     ]
870     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
871     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
872     deps = [
873       ":net",
874       ":test_support",
875       "//base",
876     ]
877   }
879   executable("crl_set_dump") {
880     testonly = true
881     sources = [
882       "tools/crl_set_dump/crl_set_dump.cc",
883     ]
885     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
886     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
887     deps = [
888       ":net",
889       "//base",
890     ]
891   }
893   executable("dns_fuzz_stub") {
894     testonly = true
895     sources = [
896       "tools/dns_fuzz_stub/dns_fuzz_stub.cc",
897     ]
899     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
900     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
901     deps = [
902       ":net",
903       "//base",
904     ]
905   }
907   executable("gdig") {
908     testonly = true
909     sources = [
910       "tools/gdig/file_net_log.cc",
911       "tools/gdig/gdig.cc",
912     ]
913     deps = [
914       ":net",
915       "//base",
916     ]
917   }
919   executable("get_server_time") {
920     testonly = true
921     sources = [
922       "tools/get_server_time/get_server_time.cc",
923     ]
925     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
926     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
927     deps = [
928       ":net",
929       "//base",
930       "//base:i18n",
931       "//url",
932     ]
933   }
935   executable("hpack_example_generator") {
936     testonly = true
937     sources = [
938       "spdy/fuzzing/hpack_example_generator.cc",
939     ]
941     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
942     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
943     deps = [
944       "//base",
945       ":net",
946     ]
947   }
949   executable("hpack_fuzz_mutator") {
950     testonly = true
951     sources = [
952       "spdy/fuzzing/hpack_fuzz_mutator.cc",
953     ]
955     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
956     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
957     deps = [
958       "//base",
959       ":net",
960     ]
961   }
963   executable("hpack_fuzz_wrapper") {
964     testonly = true
965     sources = [
966       "spdy/fuzzing/hpack_fuzz_wrapper.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   if (use_v8_in_net) {
978     executable("net_watcher") {
979       testonly = true
980       sources = [
981         "tools/net_watcher/net_watcher.cc",
982       ]
983       deps = [
984         ":net",
985         ":net_with_v8",
986         "//base",
987       ]
989       if (is_desktop_linux) {
990         configs += [
991           "//build/config/linux:gconf",
992           "//build/config/linux:glib",
993         ]
994         deps += [ "//build/config/linux:gio" ]
995       }
996     }
997   }
999   executable("run_testserver") {
1000     testonly = true
1001     sources = [
1002       "tools/testserver/run_testserver.cc",
1003     ]
1004     deps = [
1005       ":net",  # TODO(brettw) bug 363749: this shouldn't be necessary. It's not
1006                # in the GYP build, and can be removed when the bug is fixed.
1008       ":test_support",
1009       "//base",
1010       "//base/test:test_support",
1011       "//testing/gtest",
1012     ]
1013   }
1015   executable("stress_cache") {
1016     testonly = true
1017     sources = [
1018       "tools/stress_cache/stress_cache.cc",
1019     ]
1021     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1022     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1023     deps = [
1024       ":net",
1025       ":test_support",
1026       "//base",
1027     ]
1028   }
1030   executable("tld_cleanup") {
1031     sources = [
1032       "tools/tld_cleanup/tld_cleanup.cc",
1033     ]
1035     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1036     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1037     deps = [
1038       "//base",
1039       "//base:i18n",
1040       "//net/tools/tld_cleanup",
1041     ]
1042   }
1045 if (is_linux) {
1046   static_library("epoll_server") {
1047     sources = [
1048       "tools/epoll_server/epoll_server.cc",
1049       "tools/epoll_server/epoll_server.h",
1050     ]
1051     deps = [
1052       ":net",
1053       "//base",
1054     ]
1055   }
1057   static_library("flip_in_mem_edsm_server_base") {
1058     testonly = true
1059     sources = [
1060       "tools/dump_cache/url_to_filename_encoder.cc",
1061       "tools/dump_cache/url_to_filename_encoder.h",
1062       "tools/dump_cache/url_utilities.cc",
1063       "tools/dump_cache/url_utilities.h",
1064       "tools/flip_server/acceptor_thread.cc",
1065       "tools/flip_server/acceptor_thread.h",
1066       "tools/flip_server/constants.h",
1067       "tools/flip_server/create_listener.cc",
1068       "tools/flip_server/create_listener.h",
1069       "tools/flip_server/flip_config.cc",
1070       "tools/flip_server/flip_config.h",
1071       "tools/flip_server/http_interface.cc",
1072       "tools/flip_server/http_interface.h",
1073       "tools/flip_server/loadtime_measurement.h",
1074       "tools/flip_server/mem_cache.cc",
1075       "tools/flip_server/mem_cache.h",
1076       "tools/flip_server/output_ordering.cc",
1077       "tools/flip_server/output_ordering.h",
1078       "tools/flip_server/ring_buffer.cc",
1079       "tools/flip_server/ring_buffer.h",
1080       "tools/flip_server/sm_connection.cc",
1081       "tools/flip_server/sm_connection.h",
1082       "tools/flip_server/sm_interface.h",
1083       "tools/flip_server/spdy_interface.cc",
1084       "tools/flip_server/spdy_interface.h",
1085       "tools/flip_server/spdy_ssl.cc",
1086       "tools/flip_server/spdy_ssl.h",
1087       "tools/flip_server/spdy_util.cc",
1088       "tools/flip_server/spdy_util.h",
1089       "tools/flip_server/streamer_interface.cc",
1090       "tools/flip_server/streamer_interface.h",
1091     ]
1092     deps = [
1093       ":balsa",
1094       ":epoll_server",
1095       ":net",
1096       "//base",
1097       "//third_party/boringssl",
1098     ]
1099   }
1101   executable("flip_in_mem_edsm_server_unittests") {
1102     testonly = true
1103     sources = [
1104       "tools/flip_server/flip_test_utils.cc",
1105       "tools/flip_server/flip_test_utils.h",
1106       "tools/flip_server/http_interface_test.cc",
1107       "tools/flip_server/mem_cache_test.cc",
1108       "tools/flip_server/run_all_tests.cc",
1109       "tools/flip_server/spdy_interface_test.cc",
1110     ]
1111     deps = [
1112       ":balsa",
1113       ":flip_in_mem_edsm_server_base",
1114       ":net",
1115       ":test_support",
1116       "//testing/gtest",
1117       "//testing/gmock",
1118       "//third_party/boringssl",
1119     ]
1120   }
1122   executable("flip_in_mem_edsm_server") {
1123     testonly = true
1124     sources = [
1125       "tools/flip_server/flip_in_mem_edsm_server.cc",
1126     ]
1127     deps = [
1128       ":balsa",
1129       ":flip_in_mem_edsm_server_base",
1130       ":net",
1131       "//base",
1132     ]
1133   }
1135   source_set("epoll_quic_tools") {
1136     sources = [
1137       "tools/quic/quic_client.cc",
1138       "tools/quic/quic_client.h",
1139       "tools/quic/quic_default_packet_writer.cc",
1140       "tools/quic/quic_default_packet_writer.h",
1141       "tools/quic/quic_epoll_clock.cc",
1142       "tools/quic/quic_epoll_clock.h",
1143       "tools/quic/quic_epoll_connection_helper.cc",
1144       "tools/quic/quic_epoll_connection_helper.h",
1145       "tools/quic/quic_packet_reader.cc",
1146       "tools/quic/quic_packet_reader.h",
1147       "tools/quic/quic_packet_writer_wrapper.cc",
1148       "tools/quic/quic_packet_writer_wrapper.h",
1149       "tools/quic/quic_server.cc",
1150       "tools/quic/quic_server.h",
1151       "tools/quic/quic_socket_utils.cc",
1152       "tools/quic/quic_socket_utils.h",
1153     ]
1154     deps = [
1155       ":balsa",
1156       ":epoll_server",
1157       ":net",
1158       "//base",
1159       "//base/third_party/dynamic_annotations",
1160       "//crypto",
1161       "//third_party/boringssl",
1162       "//url",
1163     ]
1164   }
1166   executable("epoll_quic_client") {
1167     sources = [
1168       "tools/quic/quic_client_bin.cc",
1169     ]
1170     deps = [
1171       ":balsa",
1172       ":epoll_server",
1173       ":epoll_quic_tools",
1174       ":net",
1175       ":simple_quic_tools",
1176       "//base",
1177       "//third_party/boringssl",
1178     ]
1179   }
1181   executable("epoll_quic_server") {
1182     sources = [
1183       "tools/quic/quic_server_bin.cc",
1184     ]
1185     deps = [
1186       ":balsa",
1187       ":epoll_server",
1188       ":epoll_quic_tools",
1189       ":net",
1190       ":simple_quic_tools",
1191       "//base",
1192       "//third_party/boringssl",
1193     ]
1194   }
1197 if (is_android) {
1198   generate_jni("net_jni_headers") {
1199     sources = [
1200       "android/java/src/org/chromium/net/AndroidCertVerifyResult.java",
1201       "android/java/src/org/chromium/net/AndroidKeyStore.java",
1202       "android/java/src/org/chromium/net/AndroidNetworkLibrary.java",
1203       "android/java/src/org/chromium/net/AndroidPrivateKey.java",
1204       "android/java/src/org/chromium/net/GURLUtils.java",
1205       "android/java/src/org/chromium/net/NetworkChangeNotifier.java",
1206       "android/java/src/org/chromium/net/ProxyChangeListener.java",
1207       "android/java/src/org/chromium/net/X509Util.java",
1208     ]
1209     jni_package = "net"
1210   }
1211   generate_jni("net_test_jni_headers") {
1212     sources = [
1213       "android/javatests/src/org/chromium/net/AndroidKeyStoreTestUtil.java",
1214     ]
1215     jni_package = "net"
1216   }
1219 if (is_android || is_linux) {
1220   executable("disk_cache_memory_test") {
1221     testonly = true
1222     sources = [
1223       "tools/disk_cache_memory_test/disk_cache_memory_test.cc",
1224     ]
1225     deps = [
1226       ":net",
1227       "//base",
1228     ]
1229   }
1232 source_set("simple_quic_tools") {
1233   sources = [
1234     "tools/quic/quic_client_session.cc",
1235     "tools/quic/quic_client_session.h",
1236     "tools/quic/quic_dispatcher.cc",
1237     "tools/quic/quic_dispatcher.h",
1238     "tools/quic/quic_in_memory_cache.cc",
1239     "tools/quic/quic_in_memory_cache.h",
1240     "tools/quic/quic_per_connection_packet_writer.cc",
1241     "tools/quic/quic_per_connection_packet_writer.h",
1242     "tools/quic/quic_server_session.cc",
1243     "tools/quic/quic_server_session.h",
1244     "tools/quic/quic_simple_client.cc",
1245     "tools/quic/quic_simple_client.h",
1246     "tools/quic/quic_simple_per_connection_packet_writer.cc",
1247     "tools/quic/quic_simple_per_connection_packet_writer.h",
1248     "tools/quic/quic_simple_server.cc",
1249     "tools/quic/quic_simple_server.h",
1250     "tools/quic/quic_simple_server_packet_writer.cc",
1251     "tools/quic/quic_simple_server_packet_writer.h",
1252     "tools/quic/quic_spdy_client_stream.cc",
1253     "tools/quic/quic_spdy_client_stream.h",
1254     "tools/quic/quic_spdy_server_stream.cc",
1255     "tools/quic/quic_spdy_server_stream.h",
1256     "tools/quic/quic_time_wait_list_manager.cc",
1257     "tools/quic/quic_time_wait_list_manager.h",
1258     "tools/quic/synchronous_host_resolver.cc",
1259     "tools/quic/synchronous_host_resolver.h",
1260   ]
1261   deps = [
1262     ":net",
1263     "//base",
1264     "//base/third_party/dynamic_annotations",
1265     "//url",
1266   ]
1269 executable("quic_client") {
1270   sources = [
1271     "tools/quic/quic_simple_client_bin.cc",
1272   ]
1273   deps = [
1274     ":net",
1275     ":simple_quic_tools",
1276     "//base",
1277     "//url",
1278   ]
1281 executable("quic_server") {
1282   sources = [
1283     "tools/quic/quic_simple_server_bin.cc",
1284   ]
1285   deps = [
1286     ":net",
1287     ":simple_quic_tools",
1288     "//base",
1289     "//third_party/boringssl",
1290   ]
1293 # TODO(GYP) make this compile on Android, we need some native test deps done.
1294 # TODO(GYP) Also doesn't work on Windows; dependency on boringssl is wrong.
1295 # TODO(GYP) Also doesn't work on Mac, need to figure out why not.
1296 if (!is_android && !is_win && !is_mac) {
1297   test("net_unittests") {
1298     sources = gypi_values.net_test_sources
1300     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1301     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1302     defines = []
1304     deps = [
1305       ":extras",
1306       ":http_server",
1307       ":net",
1308       ":epoll_quic_tools",
1309       ":simple_quic_tools",
1310       ":test_support",
1311       "//base",
1312       "//base:i18n",
1313       "//base:prefs_test_support",
1314       "//base/allocator",
1315       "//base/third_party/dynamic_annotations",
1316       "//crypto",
1317       "//crypto:platform",
1318       "//crypto:test_support",
1319       "//gin",
1320       "//net/base/registry_controlled_domains",
1321       "//sql",
1322       "//testing/gmock",
1323       "//testing/gtest",
1324       "//third_party/zlib",
1325       "//url",
1326     ]
1328     if (is_linux) {
1329       sources += gypi_values.net_linux_test_sources
1330       deps += [
1331         ":balsa",
1332         ":epoll_server",
1333         ":flip_in_mem_edsm_server_base",
1334         ":epoll_quic_tools",
1335       ]
1336     }
1338     if (is_mac || is_ios) {
1339       sources += gypi_values.net_base_test_mac_ios_sources
1340     }
1342     if (is_chromeos) {
1343       sources -= [ "proxy/proxy_config_service_linux_unittest.cc" ]
1344     }
1346     if (is_android) {
1347       sources -= [
1348         # See bug http://crbug.com/344533.
1349         "disk_cache/blockfile/index_table_v3_unittest.cc",
1351         # No res_ninit() et al on Android, so this doesn't make a lot of
1352         # sense.
1353         "dns/dns_config_service_posix_unittest.cc",
1354       ]
1355       deps += [
1356         ":net_javatests",  # FIXME(brettw)
1357         ":net_test_jni_headers",
1358       ]
1359     }
1361     if (v8_use_external_startup_data) {
1362       deps += [ "//gin" ]
1363     }
1365     if (!use_nss_certs) {
1366       sources -= [ "ssl/client_cert_store_nss_unittest.cc" ]
1367       if (is_chromeos) {  # Already removed for all non-ChromeOS builds.
1368         sources -= [ "ssl/client_cert_store_chromeos_unittest.cc" ]
1369       }
1370     }
1372     if (use_openssl) {
1373       # When building for OpenSSL, we need to exclude NSS specific tests
1374       # or functionality not supported by OpenSSL yet.
1375       # TODO(bulach): Add equivalent tests when the underlying
1376       #               functionality is ported to OpenSSL.
1377       sources -= [
1378         "cert/nss_cert_database_unittest.cc",
1379         "cert/x509_util_nss_unittest.cc",
1380         "quic/test_tools/crypto_test_utils_nss.cc",
1381       ]
1382       if (is_chromeos) {
1383         # These were already removed in the non-ChromeOS case.
1384         sources -= [
1385           "cert/nss_cert_database_chromeos_unittest.cc",
1386           "cert/nss_profile_filter_chromeos_unittest.cc",
1387         ]
1388       }
1389     } else {
1390       sources -= [
1391         "cert/x509_util_openssl_unittest.cc",
1392         "quic/test_tools/crypto_test_utils_openssl.cc",
1393         "socket/ssl_client_socket_openssl_unittest.cc",
1394         "socket/ssl_session_cache_openssl_unittest.cc",
1395       ]
1396       if (!is_desktop_linux && !is_chromeos) {
1397         sources -= [ "cert/nss_cert_database_unittest.cc" ]
1398       }
1399     }
1401     if (use_kerberos) {
1402       defines += [ "USE_KERBEROS" ]
1403     } else {
1404       sources -= [
1405         "http/http_auth_gssapi_posix_unittest.cc",
1406         "http/http_auth_handler_negotiate_unittest.cc",
1407         "http/mock_gssapi_library_posix.cc",
1408         "http/mock_gssapi_library_posix.h",
1409       ]
1410     }
1412     if (use_openssl || (!is_desktop_linux && !is_chromeos && !is_ios)) {
1413       # Only include this test when on Posix and using NSS for
1414       # cert verification or on iOS (which also uses NSS for certs).
1415       sources -= [ "ocsp/nss_ocsp_unittest.cc" ]
1416     }
1418     if (!use_openssl_certs) {
1419       sources -= [ "ssl/openssl_client_key_store_unittest.cc" ]
1420     }
1422     if (!enable_websockets) {
1423       sources -= [
1424         "server/http_connection_unittest.cc",
1425         "server/http_server_response_info_unittest.cc",
1426         "server/http_server_unittest.cc",
1427         "server/web_socket_encoder_unittest.cc",
1428         "websockets/websocket_basic_stream_test.cc",
1429         "websockets/websocket_channel_test.cc",
1430         "websockets/websocket_deflate_predictor_impl_test.cc",
1431         "websockets/websocket_deflate_stream_test.cc",
1432         "websockets/websocket_deflater_test.cc",
1433         "websockets/websocket_end_to_end_test.cc",
1434         "websockets/websocket_errors_test.cc",
1435         "websockets/websocket_extension_parser_test.cc",
1436         "websockets/websocket_frame_parser_test.cc",
1437         "websockets/websocket_frame_test.cc",
1438         "websockets/websocket_handshake_challenge_test.cc",
1439         "websockets/websocket_handshake_stream_create_helper_test.cc",
1440         "websockets/websocket_inflater_test.cc",
1441         "websockets/websocket_stream_test.cc",
1442         "websockets/websocket_test_util.cc",
1443         "websockets/websocket_test_util.h",
1444       ]
1445       deps -= [ ":http_server" ]
1446     }
1448     if (disable_file_support) {
1449       sources -= [
1450         "base/directory_lister_unittest.cc",
1451         "url_request/url_request_file_job_unittest.cc",
1452       ]
1453     }
1455     if (disable_ftp_support) {
1456       sources -= [
1457         "ftp/ftp_auth_cache_unittest.cc",
1458         "ftp/ftp_ctrl_response_buffer_unittest.cc",
1459         "ftp/ftp_directory_listing_parser_ls_unittest.cc",
1460         "ftp/ftp_directory_listing_parser_netware_unittest.cc",
1461         "ftp/ftp_directory_listing_parser_os2_unittest.cc",
1462         "ftp/ftp_directory_listing_parser_unittest.cc",
1463         "ftp/ftp_directory_listing_parser_unittest.h",
1464         "ftp/ftp_directory_listing_parser_vms_unittest.cc",
1465         "ftp/ftp_directory_listing_parser_windows_unittest.cc",
1466         "ftp/ftp_network_transaction_unittest.cc",
1467         "ftp/ftp_util_unittest.cc",
1468         "url_request/url_request_ftp_job_unittest.cc",
1469       ]
1470     }
1472     if (!enable_built_in_dns) {
1473       sources -= [
1474         "dns/address_sorter_posix_unittest.cc",
1475         "dns/address_sorter_unittest.cc",
1476       ]
1477     }
1479     # Always need use_v8_in_net to be 1 to run on Android, so just remove
1480     # net_unittest's dependency on v8 when using icu alternatives instead of
1481     # setting use_v8_in_net to 0.
1482     if (use_v8_in_net && !use_icu_alternatives_on_android) {
1483       deps += [ ":net_with_v8" ]
1484     } else {
1485       sources -= [
1486         "proxy/proxy_resolver_v8_tracing_unittest.cc",
1487         "proxy/proxy_resolver_v8_unittest.cc",
1488       ]
1489     }
1491     if (use_v8_in_net && !is_android) {
1492       deps += [
1493         ":net_browser_services",
1494         ":net_utility_services",
1495         "//mojo/environment:chromium",
1496         "//third_party/mojo/src/mojo/edk/system",
1497       ]
1498     } else {
1499       sources -= [
1500         "dns/host_resolver_mojo_unittest.cc",
1501         "dns/mojo_host_resolver_impl_unittest.cc",
1502         "proxy/load_state_change_coalescer_unittest.cc",
1503         "proxy/mojo_proxy_resolver_factory_impl_unittest.cc",
1504         "proxy/mojo_proxy_resolver_impl_unittest.cc",
1505         "proxy/proxy_resolver_mojo_unittest.cc",
1506         "proxy/proxy_service_mojo_unittest.cc",
1507       ]
1508     }
1510     if (!enable_mdns) {
1511       sources -= [
1512         "dns/mdns_cache_unittest.cc",
1513         "dns/mdns_client_unittest.cc",
1514         "dns/record_parsed_unittest.cc",
1515         "dns/record_rdata_unittest.cc",
1516       ]
1517     }
1519     if (is_ios) {
1520       # TODO(GYP)
1521       #  'actions': [
1522       #    {
1523       #      'action_name': 'copy_test_data',
1524       #      'variables': {
1525       #        'test_data_files': [
1526       #          'data/ssl/certificates/',
1527       #          'data/test.html',
1528       #          'data/url_request_unittest/',
1529       #        ],
1530       #        'test_data_prefix': 'net',
1531       #      },
1532       #      'includes': [ '../build/copy_test_data_ios.gypi' ],
1533       #    },
1534       #  ],
1535       sources -= [
1536         # TODO(droger): The following tests are disabled because the
1537         # implementation is missing or incomplete.
1538         # KeygenHandler::GenKeyAndSignChallenge() is not ported to iOS.
1539         "base/keygen_handler_unittest.cc",
1540         "disk_cache/backend_unittest.cc",
1541         "disk_cache/blockfile/block_files_unittest.cc",
1543         # Need to read input data files.
1544         "filter/gzip_filter_unittest.cc",
1545         "socket/ssl_server_socket_unittest.cc",
1546         "spdy/fuzzing/hpack_fuzz_util_test.cc",
1548         # Need TestServer.
1549         "proxy/proxy_script_fetcher_impl_unittest.cc",
1550         "socket/ssl_client_socket_unittest.cc",
1551         "url_request/url_fetcher_impl_unittest.cc",
1552         "url_request/url_request_context_builder_unittest.cc",
1554         # Needs GetAppOutput().
1555         "test/python_utils_unittest.cc",
1557         # The following tests are disabled because they don't apply to
1558         # iOS.
1559         # OS is not "linux" or "freebsd" or "openbsd".
1560         "socket/unix_domain_client_socket_posix_unittest.cc",
1561         "socket/unix_domain_listen_socket_posix_unittest.cc",
1562         "socket/unix_domain_server_socket_posix_unittest.cc",
1564         # See bug http://crbug.com/344533.
1565         "disk_cache/blockfile/index_table_v3_unittest.cc",
1566       ]
1567     }
1569     if (is_android) {
1570       sources -= [ "dns/dns_config_service_posix_unittest.cc" ]
1572       # TODO(GYP)
1573       # # TODO(mmenke):  This depends on test_support_base, which depends on
1574       # #                icu.  Figure out a way to remove that dependency.
1575       # 'dependencies': [
1576       #   '../testing/android/native_test.gyp:native_test_native_code',
1577       # ]
1579       set_sources_assignment_filter([])
1580       sources += [ "base/address_tracker_linux_unittest.cc" ]
1581       set_sources_assignment_filter(sources_assignment_filter)
1582     }
1584     if (use_icu_alternatives_on_android) {
1585       sources -= [
1586         "base/filename_util_unittest.cc",
1587         "base/net_util_icu_unittest.cc",
1588       ]
1589       deps -= [ "//base:i18n" ]
1590     }
1591   }
1592 }  # !is_android && !is_win && !is_mac
1594 executable("net_perftests") {
1595   testonly = true
1596   sources = [
1597     "cookies/cookie_monster_perftest.cc",
1598     "disk_cache/blockfile/disk_cache_perftest.cc",
1599     "proxy/proxy_resolver_perftest.cc",
1600     "udp/udp_socket_perftest.cc",
1601   ]
1603   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1604   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1605   deps = [
1606     "//base",
1607     "//base:i18n",
1608     "//base/test:test_support_perf",
1609     "//testing/gtest",
1610     "//url",
1611     ":net",
1612     ":test_support",
1613   ]
1615   if (enable_websockets) {
1616     sources += [ "websockets/websocket_frame_perftest.cc" ]
1617   }
1619   if (use_v8_in_net) {
1620     deps += [ ":net_with_v8" ]
1621   } else {
1622     sources -= [ "proxy/proxy_resolver_perftest.cc" ]
1623   }
1625   if (is_win && icu_use_data_file) {
1626     # This is needed to trigger the dll copy step on windows.
1627     # TODO(mark): Specifying this here shouldn't be necessary.
1628     deps += [ "//third_party/icu:icudata" ]
1629   }