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