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