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. 4 5 import("//build/config/crypto.gni") 6 import("//build/config/features.gni") 7 import("//build/config/ui.gni") 8 import("//tools/grit/grit_rule.gni") 9 import("//url/config.gni") 10 11 if (is_android) { 12 import("//build/config/android/config.gni") 13 import("//build/config/android/rules.gni") 14 } else if (is_mac) { 15 import("//build/config/mac/mac_sdk.gni") 16 } 17 18 # The list of net files is kept in net.gypi. Read it. 19 gypi_values = exec_script( 20 "//build/gypi_to_gn.py", 21 [ rebase_path("net.gypi") ], 22 "scope", 23 [ "net.gypi" ]) 24 25 # Disable Kerberos on ChromeOS, Android and iOS, at least for now. It needs 26 # configuration (krb5.conf and so on). 27 use_kerberos = !is_chromeos && !is_android && !is_ios 28 29 # The way the cache uses mmap() is inefficient on some Android devices. If 30 # this flag is set, we hackily avoid using mmap() in the disk cache. We are 31 # pretty confident that mmap-ing the index would not hurt any existing x86 32 # android devices, but we cannot be so sure about the variety of ARM devices. 33 # So enable it for x86 only for now. 34 posix_avoid_mmap = is_android && cpu_arch != "x86" 35 36 # WebSockets and socket stream code are used everywhere except iOS. 37 enable_websockets = !is_ios 38 use_v8_in_net = !is_ios 39 enable_built_in_dns = !is_ios 40 disable_ftp_support = is_ios 41 42 declare_args() { 43 # Disables support for file URLs. File URL support requires use of icu. 44 disable_file_support = false 45 } 46 47 config("net_config") { 48 defines = [] 49 if (posix_avoid_mmap) { 50 defines += [ "POSIX_AVOID_MMAP" ] 51 } 52 if (disable_file_support) { 53 defines += [ "DISABLE_FILE_SUPPORT" ] 54 } 55 } 56 57 # Disables Windows warning about size to int truncations. 58 # TODO(jschuh): crbug.com/167187 fix this and delete this config. 59 config("net_win_size_truncation") { 60 if (is_win) { 61 cflags = [ "/wd4267" ] 62 } 63 } 64 65 component("net") { 66 sources = 67 gypi_values.net_nacl_common_sources + 68 gypi_values.net_non_nacl_sources 69 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 ] 80 configs += [ ":net_win_size_truncation" ] 81 direct_dependent_configs = [ ":net_config" ] 82 include_dirs = [] 83 84 deps = [ 85 ":net_resources", 86 "//base", 87 "//base:i18n", 88 "//base/third_party/dynamic_annotations", 89 "//crypto", 90 "//crypto:platform", 91 "//net/base/registry_controlled_domains", 92 "//sdch", 93 "//third_party/icu", 94 "//third_party/zlib", 95 "//url", 96 ] 97 forward_dependent_configs_from = [ 98 "//crypto", 99 "//crypto:platform" 100 ] 101 102 if (use_kerberos) { 103 defines += [ "USE_KERBEROS" ] 104 if (is_android) { 105 include_dirs += [ "/usr/include/kerberosV" ] 106 } 107 } else { 108 sources -= [ 109 "http/http_auth_gssapi_posix.cc", 110 "http/http_auth_gssapi_posix.h", 111 "http/http_auth_handler_negotiate.h", 112 "http/http_auth_handler_negotiate.cc", 113 ] 114 } 115 116 if (is_posix) { 117 if (posix_avoid_mmap) { 118 sources -= [ "disk_cache/blockfile/mapped_file_posix.cc" ] 119 } else { 120 sources -= [ "disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc" ] 121 } 122 } 123 124 if (disable_file_support) { 125 sources -= [ 126 "base/directory_lister.cc", 127 "base/directory_lister.h", 128 "url_request/url_request_file_dir_job.cc", 129 "url_request/url_request_file_dir_job.h", 130 "url_request/url_request_file_job.cc", 131 "url_request/url_request_file_job.h", 132 "url_request/file_protocol_handler.cc", 133 "url_request/file_protocol_handler.h", 134 ] 135 } 136 137 if (disable_ftp_support) { 138 sources -= [ 139 "ftp/ftp_auth_cache.cc", 140 "ftp/ftp_auth_cache.h", 141 "ftp/ftp_ctrl_response_buffer.cc", 142 "ftp/ftp_ctrl_response_buffer.h", 143 "ftp/ftp_directory_listing_parser.cc", 144 "ftp/ftp_directory_listing_parser.h", 145 "ftp/ftp_directory_listing_parser_ls.cc", 146 "ftp/ftp_directory_listing_parser_ls.h", 147 "ftp/ftp_directory_listing_parser_netware.cc", 148 "ftp/ftp_directory_listing_parser_netware.h", 149 "ftp/ftp_directory_listing_parser_os2.cc", 150 "ftp/ftp_directory_listing_parser_os2.h", 151 "ftp/ftp_directory_listing_parser_vms.cc", 152 "ftp/ftp_directory_listing_parser_vms.h", 153 "ftp/ftp_directory_listing_parser_windows.cc", 154 "ftp/ftp_directory_listing_parser_windows.h", 155 "ftp/ftp_network_layer.cc", 156 "ftp/ftp_network_layer.h", 157 "ftp/ftp_network_session.cc", 158 "ftp/ftp_network_session.h", 159 "ftp/ftp_network_transaction.cc", 160 "ftp/ftp_network_transaction.h", 161 "ftp/ftp_request_info.h", 162 "ftp/ftp_response_info.cc", 163 "ftp/ftp_response_info.h", 164 "ftp/ftp_server_type_histograms.cc", 165 "ftp/ftp_server_type_histograms.h", 166 "ftp/ftp_transaction.h", 167 "ftp/ftp_transaction_factory.h", 168 "ftp/ftp_util.cc", 169 "ftp/ftp_util.h", 170 "url_request/ftp_protocol_handler.cc", 171 "url_request/ftp_protocol_handler.h", 172 "url_request/url_request_ftp_job.cc", 173 "url_request/url_request_ftp_job.h", 174 ] 175 } 176 177 if (enable_built_in_dns) { 178 defines += [ "ENABLE_BUILT_IN_DNS" ] 179 } else { 180 sources -= [ 181 "dns/address_sorter_posix.cc", 182 "dns/address_sorter_posix.h", 183 "dns/dns_client.cc", 184 ] 185 } 186 187 if (use_openssl) { 188 sources -= [ 189 "base/nss_memio.c", 190 "base/nss_memio.h", 191 "cert/ct_log_verifier_nss.cc", 192 "cert/ct_objects_extractor_nss.cc", 193 "cert/jwk_serializer_nss.cc", 194 "cert/scoped_nss_types.h", 195 "cert/x509_util_nss.cc", 196 "cert/x509_util_nss.h", 197 "quic/crypto/aead_base_decrypter_nss.cc", 198 "quic/crypto/aead_base_encrypter_nss.cc", 199 "quic/crypto/aes_128_gcm_12_decrypter_nss.cc", 200 "quic/crypto/aes_128_gcm_12_encrypter_nss.cc", 201 "quic/crypto/chacha20_poly1305_decrypter_nss.cc", 202 "quic/crypto/chacha20_poly1305_encrypter_nss.cc", 203 "quic/crypto/channel_id_nss.cc", 204 "quic/crypto/p256_key_exchange_nss.cc", 205 "socket/nss_ssl_util.cc", 206 "socket/nss_ssl_util.h", 207 "socket/ssl_client_socket_nss.cc", 208 "socket/ssl_client_socket_nss.h", 209 "socket/ssl_server_socket_nss.cc", 210 "socket/ssl_server_socket_nss.h", 211 ] 212 if (is_chromeos) { 213 sources -= [ 214 "cert/nss_cert_database_chromeos.cc", 215 "cert/nss_cert_database_chromeos.h", 216 "cert/nss_profile_filter_chromeos.cc", 217 "cert/nss_profile_filter_chromeos.h", 218 ] 219 } 220 if (is_linux) { 221 # These are always removed for non-Linux cases below. 222 sources -= [ 223 "base/crypto_module_nss.cc", 224 "base/keygen_handler_nss.cc", 225 "cert/cert_database_nss.cc", 226 "cert/nss_cert_database.cc", 227 "cert/nss_cert_database.h", 228 "cert/x509_certificate_nss.cc", 229 "third_party/mozilla_security_manager/nsKeygenHandler.cpp", 230 "third_party/mozilla_security_manager/nsKeygenHandler.h", 231 "third_party/mozilla_security_manager/nsNSSCertificateDB.cpp", 232 "third_party/mozilla_security_manager/nsNSSCertificateDB.h", 233 "third_party/mozilla_security_manager/nsPKCS12Blob.cpp", 234 "third_party/mozilla_security_manager/nsPKCS12Blob.h", 235 ] 236 } 237 if (is_ios) { 238 # Always removed for !ios below. 239 sources -= [ 240 "cert/cert_verify_proc_nss.cc", 241 "cert/cert_verify_proc_nss.h", 242 "cert/test_root_certs_nss.cc", 243 "ocsp/nss_ocsp.cc", 244 "ocsp/nss_ocsp.h", 245 ] 246 } 247 } else { 248 sources -= [ 249 "base/crypto_module_openssl.cc", 250 "base/keygen_handler_openssl.cc", 251 "cert/ct_log_verifier_openssl.cc", 252 "cert/ct_objects_extractor_openssl.cc", 253 "cert/jwk_serializer_openssl.cc", 254 "cert/x509_util_openssl.cc", 255 "cert/x509_util_openssl.h", 256 "quic/crypto/aead_base_decrypter_openssl.cc", 257 "quic/crypto/aead_base_encrypter_openssl.cc", 258 "quic/crypto/aes_128_gcm_12_decrypter_openssl.cc", 259 "quic/crypto/aes_128_gcm_12_encrypter_openssl.cc", 260 "quic/crypto/chacha20_poly1305_decrypter_openssl.cc", 261 "quic/crypto/chacha20_poly1305_encrypter_openssl.cc", 262 "quic/crypto/channel_id_openssl.cc", 263 "quic/crypto/p256_key_exchange_openssl.cc", 264 "quic/crypto/scoped_evp_aead_ctx.cc", 265 "quic/crypto/scoped_evp_aead_ctx.h", 266 "socket/openssl_ssl_util.cc", 267 "socket/openssl_ssl_util.h", 268 "socket/ssl_client_socket_openssl.cc", 269 "socket/ssl_client_socket_openssl.h", 270 "socket/ssl_server_socket_openssl.cc", 271 "socket/ssl_server_socket_openssl.h", 272 "socket/ssl_session_cache_openssl.cc", 273 "socket/ssl_session_cache_openssl.h", 274 ] 275 } 276 277 if (!use_openssl_certs) { 278 sources -= [ 279 "base/openssl_private_key_store.h", 280 "base/openssl_private_key_store_memory.cc", 281 "cert/cert_database_openssl.cc", 282 "cert/cert_verify_proc_openssl.cc", 283 "cert/cert_verify_proc_openssl.h", 284 "cert/test_root_certs_openssl.cc", 285 "cert/x509_certificate_openssl.cc", 286 "ssl/openssl_client_key_store.cc", 287 "ssl/openssl_client_key_store.h", 288 ] 289 if (is_android) { 290 sources -= [ 291 "base/openssl_private_key_store_android.cc", 292 ] 293 } 294 } else if (is_android) { 295 # Android doesn't use these even when using OpenSSL. 296 sources -= [ 297 "base/openssl_private_key_store_memory.cc", 298 "cert/cert_database_openssl.cc", 299 "cert/cert_verify_proc_openssl.cc", 300 "cert/test_root_certs_openssl.cc", 301 ] 302 } 303 304 if (use_glib) { 305 configs += [ "//build/config/linux:gconf" ] 306 deps += [ "//build/config/linux:gio" ] 307 } 308 309 if (is_linux) { 310 configs += [ "//build/config/linux:libresolv" ] 311 } else { 312 sources -= [ 313 "base/crypto_module_nss.cc", 314 "base/keygen_handler_nss.cc", 315 "cert/cert_database_nss.cc", 316 "cert/nss_cert_database.cc", 317 "cert/nss_cert_database.h", 318 "cert/x509_certificate_nss.cc", 319 "third_party/mozilla_security_manager/nsKeygenHandler.cpp", 320 "third_party/mozilla_security_manager/nsKeygenHandler.h", 321 "third_party/mozilla_security_manager/nsNSSCertificateDB.cpp", 322 "third_party/mozilla_security_manager/nsNSSCertificateDB.h", 323 "third_party/mozilla_security_manager/nsPKCS12Blob.cpp", 324 "third_party/mozilla_security_manager/nsPKCS12Blob.h", 325 ] 326 327 if (!is_ios) { 328 # These files are part of the partial implementation of NSS on iOS so 329 # keep them in that case. 330 sources -= [ 331 "cert/test_root_certs_nss.cc", 332 "ocsp/nss_ocsp.cc", 333 "ocsp/nss_ocsp.h", 334 ] 335 } 336 } 337 338 if (!use_nss_certs) { 339 sources -= [ 340 "ssl/client_cert_store_nss.cc", 341 "ssl/client_cert_store_nss.h", 342 ] 343 if (!is_ios) { 344 # These files are part of the partial implementation of NSS on iOS so 345 # keep them in that case (even though use_nss_certs is not set). 346 sources -= [ 347 "cert/cert_verify_proc_nss.cc", 348 "cert/cert_verify_proc_nss.h", 349 ] 350 } 351 if (is_chromeos) { 352 # These were already removed on non-ChromeOS. 353 sources -= [ 354 "ssl/client_cert_store_chromeos.cc", 355 "ssl/client_cert_store_chromeos.h", 356 ] 357 } 358 } 359 360 if (!enable_websockets) { 361 sources -= [ 362 "socket_stream/socket_stream.cc", 363 "socket_stream/socket_stream.h", 364 "socket_stream/socket_stream_job.cc", 365 "socket_stream/socket_stream_job.h", 366 "socket_stream/socket_stream_job_manager.cc", 367 "socket_stream/socket_stream_job_manager.h", 368 "socket_stream/socket_stream_metrics.cc", 369 "socket_stream/socket_stream_metrics.h", 370 "spdy/spdy_websocket_stream.cc", 371 "spdy/spdy_websocket_stream.h", 372 "websockets/websocket_basic_handshake_stream.cc", 373 "websockets/websocket_basic_handshake_stream.h", 374 "websockets/websocket_basic_stream.cc", 375 "websockets/websocket_basic_stream.h", 376 "websockets/websocket_channel.cc", 377 "websockets/websocket_channel.h", 378 "websockets/websocket_deflate_predictor.h", 379 "websockets/websocket_deflate_predictor_impl.cc", 380 "websockets/websocket_deflate_predictor_impl.h", 381 "websockets/websocket_deflate_stream.cc", 382 "websockets/websocket_deflate_stream.h", 383 "websockets/websocket_deflater.cc", 384 "websockets/websocket_deflater.h", 385 "websockets/websocket_errors.cc", 386 "websockets/websocket_errors.h", 387 "websockets/websocket_extension.cc", 388 "websockets/websocket_extension.h", 389 "websockets/websocket_extension_parser.cc", 390 "websockets/websocket_extension_parser.h", 391 "websockets/websocket_frame.cc", 392 "websockets/websocket_frame.h", 393 "websockets/websocket_frame_parser.cc", 394 "websockets/websocket_frame_parser.h", 395 "websockets/websocket_handshake_constants.cc", 396 "websockets/websocket_handshake_constants.h", 397 "websockets/websocket_handshake_handler.cc", 398 "websockets/websocket_handshake_handler.h", 399 "websockets/websocket_handshake_request_info.cc", 400 "websockets/websocket_handshake_request_info.h", 401 "websockets/websocket_handshake_response_info.cc", 402 "websockets/websocket_handshake_response_info.h", 403 "websockets/websocket_handshake_stream_base.h", 404 "websockets/websocket_handshake_stream_create_helper.cc", 405 "websockets/websocket_handshake_stream_create_helper.h", 406 "websockets/websocket_inflater.cc", 407 "websockets/websocket_inflater.h", 408 "websockets/websocket_job.cc", 409 "websockets/websocket_job.h", 410 "websockets/websocket_mux.h", 411 "websockets/websocket_net_log_params.cc", 412 "websockets/websocket_net_log_params.h", 413 "websockets/websocket_stream.cc", 414 "websockets/websocket_stream.h", 415 "websockets/websocket_throttle.cc", 416 "websockets/websocket_throttle.h", 417 ] 418 } 419 420 if (!enable_mdns) { 421 sources -= [ 422 "dns/mdns_cache.cc", 423 "dns/mdns_cache.h", 424 "dns/mdns_client.cc", 425 "dns/mdns_client.h", 426 "dns/mdns_client_impl.cc", 427 "dns/mdns_client_impl.h", 428 "dns/record_parsed.cc", 429 "dns/record_parsed.h", 430 "dns/record_rdata.cc", 431 "dns/record_rdata.h", 432 ] 433 } 434 435 if (is_win) { 436 sources -= [ 437 "http/http_auth_handler_ntlm_portable.cc", 438 "socket/tcp_socket_libevent.cc", 439 "socket/tcp_socket_libevent.h", 440 "udp/udp_socket_libevent.cc", 441 "udp/udp_socket_libevent.h", 442 ] 443 deps += [ 444 "//third_party/nss:nspr", 445 "//third_party/nss", 446 ] 447 } else { # !is_win 448 sources -= [ 449 "base/winsock_init.cc", 450 "base/winsock_init.h", 451 "base/winsock_util.cc", 452 "base/winsock_util.h", 453 "proxy/proxy_resolver_winhttp.cc", 454 "proxy/proxy_resolver_winhttp.h", 455 ] 456 } 457 458 if (is_mac) { 459 deps += [ 460 "//third_party/nss:nspr", 461 "//third_party/nss", 462 ] 463 libs = [ 464 "Foundation.framework", 465 "Security.framework", 466 "SystemConfiguration.framework", 467 "resolv", 468 ] 469 } 470 471 if (is_ios) { 472 # Add back some sources that were otherwise filtered out. iOS additionally 473 # doesn't set USE_NSS but needs some of the files. 474 set_sources_assignment_filter([]) 475 sources += [ 476 "base/network_change_notifier_mac.cc", 477 "base/network_config_watcher_mac.cc", 478 "base/platform_mime_util_mac.mm", 479 "cert/cert_verify_proc_nss.cc", 480 "cert/cert_verify_proc_nss.h", 481 "cert/test_root_certs_nss.cc", 482 "cert/x509_util_nss.cc", 483 "cert/x509_util_nss.h", 484 "proxy/proxy_resolver_mac.cc", 485 "proxy/proxy_server_mac.cc", 486 "ocsp/nss_ocsp.cc", 487 "ocsp/nss_ocsp.h", 488 ] 489 set_sources_assignment_filter(sources_assignment_filter) 490 491 sources -= [ "disk_cache/blockfile/file_posix.cc" ] 492 deps += [ 493 "//third_party/nss", 494 ] 495 libs = [ 496 "CFNetwork.framework", 497 "MobileCoreServices.framework", 498 "Security.framework", 499 "SystemConfiguration.framework", 500 "resolv", 501 ] 502 } 503 504 if (is_android) { 505 # Add some Linux sources that were excluded by the filter, but which 506 # are needed. 507 set_sources_assignment_filter([]) 508 sources += [ 509 "base/platform_mime_util_linux.cc", 510 "base/address_tracker_linux.cc", 511 "base/address_tracker_linux.h", 512 ] 513 set_sources_assignment_filter(sources_assignment_filter) 514 515 if (!is_android_webview_build) { 516 deps += [ ":net_jni_headers" ] 517 518 # The net/android/keystore_openssl.cc source file needs to access an 519 # OpenSSL-internal header. 520 include_dirs = [ "//third_party/openssl" ] 521 } 522 } 523 524 if (use_icu_alternatives_on_android) { 525 deps -= [ 526 "//base:i18n", 527 "//third_party/icu", 528 ] 529 sources -= [ 530 "base/filename_util_icu.cc", 531 "base/net_string_util_icu.cc", 532 "base/net_util_icu.cc", 533 ] 534 sources += [ 535 "base/net_string_util_icu_alternatives_android.cc", 536 "base/net_string_util_icu_alternatives_android.h", 537 ] 538 } 539 } 540 541 grit("net_resources") { 542 source = "base/net_resources.grd" 543 } 544 545 static_library("http_server") { 546 sources = [ 547 "server/http_connection.cc", 548 "server/http_connection.h", 549 "server/http_server.cc", 550 "server/http_server.h", 551 "server/http_server_request_info.cc", 552 "server/http_server_request_info.h", 553 "server/http_server_response_info.cc", 554 "server/http_server_response_info.h", 555 "server/web_socket.cc", 556 "server/web_socket.h", 557 ] 558 configs += [ "//build/config/compiler:wexit_time_destructors" ] 559 deps = [ 560 ":net", 561 "//base", 562 ] 563 } 564 565 executable("dump_cache") { 566 sources = [ 567 "tools/dump_cache/cache_dumper.cc", 568 "tools/dump_cache/cache_dumper.h", 569 "tools/dump_cache/dump_cache.cc", 570 "tools/dump_cache/dump_files.cc", 571 "tools/dump_cache/dump_files.h", 572 "tools/dump_cache/simple_cache_dumper.cc", 573 "tools/dump_cache/simple_cache_dumper.h", 574 "tools/dump_cache/upgrade_win.cc", 575 "tools/dump_cache/upgrade_win.h", 576 "tools/dump_cache/url_to_filename_encoder.cc", 577 "tools/dump_cache/url_to_filename_encoder.h", 578 "tools/dump_cache/url_utilities.h", 579 "tools/dump_cache/url_utilities.cc", 580 ] 581 582 configs += [ ":net_win_size_truncation" ] 583 584 deps = [ 585 "//base", 586 ":net", 587 ":test_support", 588 ] 589 } 590 591 source_set("test_support") { 592 sources = [ 593 "base/capturing_net_log.cc", 594 "base/capturing_net_log.h", 595 "base/load_timing_info_test_util.cc", 596 "base/load_timing_info_test_util.h", 597 "base/mock_file_stream.cc", 598 "base/mock_file_stream.h", 599 "base/test_completion_callback.cc", 600 "base/test_completion_callback.h", 601 "base/test_data_directory.cc", 602 "base/test_data_directory.h", 603 "cert/mock_cert_verifier.cc", 604 "cert/mock_cert_verifier.h", 605 "cookies/cookie_monster_store_test.cc", 606 "cookies/cookie_monster_store_test.h", 607 "cookies/cookie_store_test_callbacks.cc", 608 "cookies/cookie_store_test_callbacks.h", 609 "cookies/cookie_store_test_helpers.cc", 610 "cookies/cookie_store_test_helpers.h", 611 "disk_cache/disk_cache_test_base.cc", 612 "disk_cache/disk_cache_test_base.h", 613 "disk_cache/disk_cache_test_util.cc", 614 "disk_cache/disk_cache_test_util.h", 615 "dns/dns_test_util.cc", 616 "dns/dns_test_util.h", 617 "dns/mock_host_resolver.cc", 618 "dns/mock_host_resolver.h", 619 "dns/mock_mdns_socket_factory.cc", 620 "dns/mock_mdns_socket_factory.h", 621 "http/http_transaction_test_util.cc", 622 "http/http_transaction_test_util.h", 623 "proxy/mock_proxy_resolver.cc", 624 "proxy/mock_proxy_resolver.h", 625 "proxy/mock_proxy_script_fetcher.cc", 626 "proxy/mock_proxy_script_fetcher.h", 627 "proxy/proxy_config_service_common_unittest.cc", 628 "proxy/proxy_config_service_common_unittest.h", 629 "socket/socket_test_util.cc", 630 "socket/socket_test_util.h", 631 "test/cert_test_util.cc", 632 "test/cert_test_util.h", 633 "test/ct_test_util.cc", 634 "test/ct_test_util.h", 635 "test/embedded_test_server/embedded_test_server.cc", 636 "test/embedded_test_server/embedded_test_server.h", 637 "test/embedded_test_server/http_connection.cc", 638 "test/embedded_test_server/http_connection.h", 639 "test/embedded_test_server/http_request.cc", 640 "test/embedded_test_server/http_request.h", 641 "test/embedded_test_server/http_response.cc", 642 "test/embedded_test_server/http_response.h", 643 "test/net_test_suite.cc", 644 "test/net_test_suite.h", 645 "test/python_utils.cc", 646 "test/python_utils.h", 647 "test/spawned_test_server/base_test_server.cc", 648 "test/spawned_test_server/base_test_server.h", 649 "test/spawned_test_server/local_test_server_posix.cc", 650 "test/spawned_test_server/local_test_server_win.cc", 651 "test/spawned_test_server/local_test_server.cc", 652 "test/spawned_test_server/local_test_server.h", 653 "test/spawned_test_server/remote_test_server.cc", 654 "test/spawned_test_server/remote_test_server.h", 655 "test/spawned_test_server/spawned_test_server.h", 656 "test/spawned_test_server/spawner_communicator.cc", 657 "test/spawned_test_server/spawner_communicator.h", 658 "url_request/test_url_fetcher_factory.cc", 659 "url_request/test_url_fetcher_factory.h", 660 "url_request/url_request_test_util.cc", 661 "url_request/url_request_test_util.h", 662 ] 663 664 configs += [ ":net_win_size_truncation" ] 665 666 deps = [ 667 "//base", 668 "//base/test:test_support", 669 "//crypto:platform", 670 "//net", 671 "//net/tools/tld_cleanup", 672 "//testing/gmock", 673 "//testing/gtest", 674 "//url", 675 ] 676 677 if (is_ios) { 678 deps += [ "//third_party/nss" ] 679 } 680 681 if (!is_android) { 682 sources -= [ 683 "test/spawned_test_server/remote_test_server.cc", 684 "test/spawned_test_server/remote_test_server.h", 685 "test/spawned_test_server/spawner_communicator.cc", 686 "test/spawned_test_server/spawner_communicator.h", 687 ] 688 } 689 690 if (use_v8_in_net) { 691 deps += [ ":net_with_v8" ] 692 } 693 694 if (!enable_mdns) { 695 sources -= [ 696 "dns/mock_mdns_socket_factory.cc", 697 "dns/mock_mdns_socket_factory.h", 698 ] 699 } 700 701 forward_dependent_configs_from = deps 702 } 703 704 if (use_v8_in_net) { 705 component("net_with_v8") { 706 sources = [ 707 "proxy/proxy_resolver_v8.cc", 708 "proxy/proxy_resolver_v8.h", 709 "proxy/proxy_resolver_v8_tracing.cc", 710 "proxy/proxy_resolver_v8_tracing.h", 711 "proxy/proxy_service_v8.cc", 712 "proxy/proxy_service_v8.h", 713 ] 714 715 defines = [ "NET_IMPLEMENTATION" ] 716 configs += [ 717 ":net_win_size_truncation", 718 "//build/config/compiler:wexit_time_destructors", 719 ] 720 721 deps = [ 722 ":net", 723 "//base", 724 "//gin", 725 "//url", 726 "//v8", 727 ] 728 } 729 } 730 731 if (!is_ios && !is_android) { 732 executable("crash_cache") { 733 sources = [ "tools/crash_cache/crash_cache.cc" ] 734 configs += [ ":net_win_size_truncation" ] 735 deps = [ 736 ":net", 737 ":test_support", 738 "//base", 739 ] 740 } 741 742 executable("crl_set_dump") { 743 sources = [ "tools/crl_set_dump/crl_set_dump.cc" ] 744 configs += [ ":net_win_size_truncation" ] 745 deps = [ 746 ":net", 747 "//base", 748 ] 749 } 750 751 executable("dns_fuzz_stub") { 752 sources = [ "tools/dns_fuzz_stub/dns_fuzz_stub.cc" ] 753 configs += [ ":net_win_size_truncation" ] 754 deps = [ 755 ":net", 756 "//base", 757 ] 758 } 759 760 executable("gdig") { 761 sources = [ 762 "tools/gdig/file_net_log.cc", 763 "tools/gdig/gdig.cc", 764 ] 765 deps = [ 766 ":net", 767 "//base", 768 ] 769 } 770 771 executable("get_server_time") { 772 sources = [ "tools/get_server_time/get_server_time.cc" ] 773 configs += [ ":net_win_size_truncation" ] 774 deps = [ 775 ":net", 776 "//base", 777 "//base:i18n", 778 "//url", 779 ] 780 } 781 782 if (use_v8_in_net) { 783 executable("net_watcher") { 784 sources = [ "tools/net_watcher/net_watcher.cc" ] 785 deps = [ 786 ":net", 787 ":net_with_v8", 788 "//base", 789 ] 790 791 if (is_linux) { 792 configs += [ "//build/config/linux:gconf" ] 793 deps += [ "//build/config/linux:gio" ] 794 } 795 } 796 } 797 798 executable("run_testserver") { 799 sources = [ "tools/testserver/run_testserver.cc" ] 800 deps = [ 801 ":net", # TODO(brettw) bug 363749: this shouldn't be necessary. It's not 802 # in the GYP build, and can be removed when the bug is fixed. 803 ":test_support", 804 "//base", 805 "//base/test:test_support", 806 "//testing/gtest", 807 ] 808 } 809 810 executable("stress_cache") { 811 sources = [ "disk_cache/blockfile/stress_cache.cc" ] 812 configs += [ ":net_win_size_truncation" ] 813 deps = [ 814 ":net", 815 ":test_support", 816 "//base", 817 ] 818 } 819 820 executable("tld_cleanup") { 821 sources = [ "tools/tld_cleanup/tld_cleanup.cc" ] 822 configs += [ ":net_win_size_truncation" ] 823 deps = [ 824 "//base", 825 "//base:i18n", 826 "//net/tools/tld_cleanup", 827 ] 828 } 829 } 830 831 if (is_linux) { 832 source_set("balsa") { 833 sources = [ 834 "tools/balsa/balsa_enums.h", 835 "tools/balsa/balsa_frame.cc", 836 "tools/balsa/balsa_frame.h", 837 "tools/balsa/balsa_headers.cc", 838 "tools/balsa/balsa_headers.h", 839 "tools/balsa/balsa_headers_token_utils.cc", 840 "tools/balsa/balsa_headers_token_utils.h", 841 "tools/balsa/balsa_visitor_interface.h", 842 "tools/balsa/http_message_constants.cc", 843 "tools/balsa/http_message_constants.h", 844 "tools/balsa/noop_balsa_visitor.h", 845 "tools/balsa/simple_buffer.cc", 846 "tools/balsa/simple_buffer.h", 847 "tools/balsa/split.cc", 848 "tools/balsa/split.h", 849 "tools/balsa/string_piece_utils.h", 850 ] 851 deps = [ 852 ":net", 853 "//base", 854 ] 855 } 856 857 static_library("epoll_server") { 858 sources = [ 859 "tools/epoll_server/epoll_server.cc", 860 "tools/epoll_server/epoll_server.h", 861 ] 862 deps = [ 863 ":net", 864 "//base", 865 ] 866 } 867 868 static_library("flip_in_mem_edsm_server_base") { 869 sources = [ 870 "tools/dump_cache/url_to_filename_encoder.cc", 871 "tools/dump_cache/url_to_filename_encoder.h", 872 "tools/dump_cache/url_utilities.h", 873 "tools/dump_cache/url_utilities.cc", 874 "tools/flip_server/acceptor_thread.h", 875 "tools/flip_server/acceptor_thread.cc", 876 "tools/flip_server/create_listener.cc", 877 "tools/flip_server/create_listener.h", 878 "tools/flip_server/constants.h", 879 "tools/flip_server/flip_config.cc", 880 "tools/flip_server/flip_config.h", 881 "tools/flip_server/http_interface.cc", 882 "tools/flip_server/http_interface.h", 883 "tools/flip_server/loadtime_measurement.h", 884 "tools/flip_server/mem_cache.h", 885 "tools/flip_server/mem_cache.cc", 886 "tools/flip_server/output_ordering.cc", 887 "tools/flip_server/output_ordering.h", 888 "tools/flip_server/ring_buffer.cc", 889 "tools/flip_server/ring_buffer.h", 890 "tools/flip_server/sm_connection.cc", 891 "tools/flip_server/sm_connection.h", 892 "tools/flip_server/sm_interface.h", 893 "tools/flip_server/spdy_ssl.cc", 894 "tools/flip_server/spdy_ssl.h", 895 "tools/flip_server/spdy_interface.cc", 896 "tools/flip_server/spdy_interface.h", 897 "tools/flip_server/spdy_util.cc", 898 "tools/flip_server/spdy_util.h", 899 "tools/flip_server/streamer_interface.cc", 900 "tools/flip_server/streamer_interface.h", 901 ] 902 deps = [ 903 ":balsa", 904 ":epoll_server", 905 ":net", 906 "//base", 907 "//third_party/openssl", 908 ] 909 } 910 911 executable("flip_in_mem_edsm_server_unittests") { 912 sources = [ 913 "tools/flip_server/flip_test_utils.cc", 914 "tools/flip_server/flip_test_utils.h", 915 "tools/flip_server/http_interface_test.cc", 916 "tools/flip_server/mem_cache_test.cc", 917 "tools/flip_server/run_all_tests.cc", 918 "tools/flip_server/spdy_interface_test.cc", 919 ] 920 deps = [ 921 ":flip_in_mem_edsm_server_base", 922 ":net", 923 ":test_support", 924 "//testing/gtest", 925 "//testing/gmock", 926 "//third_party/openssl", 927 ] 928 } 929 930 executable("flip_in_mem_edsm_server") { 931 sources = [ "tools/flip_server/flip_in_mem_edsm_server.cc" ] 932 deps = [ 933 ":flip_in_mem_edsm_server_base", 934 ":net", 935 "//base", 936 ] 937 } 938 939 source_set("quic_base") { 940 sources = [ 941 "tools/quic/quic_client.cc", 942 "tools/quic/quic_client.h", 943 "tools/quic/quic_client_session.cc", 944 "tools/quic/quic_client_session.h", 945 "tools/quic/quic_default_packet_writer.cc", 946 "tools/quic/quic_default_packet_writer.h", 947 "tools/quic/quic_dispatcher.h", 948 "tools/quic/quic_dispatcher.cc", 949 "tools/quic/quic_epoll_clock.cc", 950 "tools/quic/quic_epoll_clock.h", 951 "tools/quic/quic_epoll_connection_helper.cc", 952 "tools/quic/quic_epoll_connection_helper.h", 953 "tools/quic/quic_in_memory_cache.cc", 954 "tools/quic/quic_in_memory_cache.h", 955 "tools/quic/quic_packet_writer_wrapper.cc", 956 "tools/quic/quic_packet_writer_wrapper.h", 957 "tools/quic/quic_server.cc", 958 "tools/quic/quic_server.h", 959 "tools/quic/quic_server_session.cc", 960 "tools/quic/quic_server_session.h", 961 "tools/quic/quic_socket_utils.cc", 962 "tools/quic/quic_socket_utils.h", 963 "tools/quic/quic_spdy_client_stream.cc", 964 "tools/quic/quic_spdy_client_stream.h", 965 "tools/quic/quic_spdy_server_stream.cc", 966 "tools/quic/quic_spdy_server_stream.h", 967 "tools/quic/quic_time_wait_list_manager.h", 968 "tools/quic/quic_time_wait_list_manager.cc", 969 "tools/quic/spdy_utils.cc", 970 "tools/quic/spdy_utils.h", 971 ] 972 deps = [ 973 ":balsa", 974 ":epoll_server", 975 ":net", 976 "//base", 977 "//base/third_party/dynamic_annotations", 978 "//crypto", 979 "//third_party/openssl", 980 "//url", 981 ] 982 } 983 984 executable("quic_client") { 985 sources = [ "tools/quic/quic_client_bin.cc" ] 986 deps = [ 987 ":quic_base", 988 ":net", 989 "//base", 990 "//third_party/openssl", 991 ] 992 } 993 994 executable("quic_server") { 995 sources = [ "tools/quic/quic_server_bin.cc" ] 996 deps = [ 997 ":quic_base", 998 ":net", 999 "//base", 1000 "//third_party/openssl", 1001 ] 1002 } 1003 } 1004 1005 if (is_android) { 1006 generate_jni("net_jni_headers") { 1007 sources = [ 1008 "android/java/src/org/chromium/net/AndroidCertVerifyResult.java", 1009 "android/java/src/org/chromium/net/AndroidKeyStore.java", 1010 "android/java/src/org/chromium/net/AndroidNetworkLibrary.java", 1011 "android/java/src/org/chromium/net/AndroidPrivateKey.java", 1012 "android/java/src/org/chromium/net/GURLUtils.java", 1013 "android/java/src/org/chromium/net/NetworkChangeNotifier.java", 1014 "android/java/src/org/chromium/net/ProxyChangeListener.java", 1015 "android/java/src/org/chromium/net/X509Util.java", 1016 ] 1017 jni_package = "net" 1018 } 1019 } 1020 1021 if (is_android || is_linux) { 1022 executable("disk_cache_memory_test") { 1023 sources = [ "tools/disk_cache_memory_test/disk_cache_memory_test.cc" ] 1024 deps = [ 1025 ":net", 1026 "//base", 1027 ] 1028 } 1029 } 1030 1031 # TODO(GYP) make this compile on Android, we need some native test deps done. 1032 if (!is_android) { 1033 1034 test("net_unittests") { 1035 sources = gypi_values.net_test_sources 1036 1037 configs += [ ":net_win_size_truncation" ] 1038 defines = [] 1039 1040 deps = [ 1041 ":http_server", 1042 ":net", 1043 ":test_support", 1044 "//base", 1045 "//base:i18n", 1046 "//base/allocator", 1047 "//base/third_party/dynamic_annotations", 1048 "//crypto", 1049 "//crypto:platform", 1050 "//net/base/registry_controlled_domains", 1051 "//testing/gmock", 1052 "//testing/gtest", 1053 "//third_party/zlib", 1054 "//url", 1055 ] 1056 1057 if (is_linux) { 1058 sources += gypi_values.net_linux_test_sources 1059 deps += [ 1060 ":balsa", 1061 ":epoll_server", 1062 ":flip_in_mem_edsm_server_base", 1063 ":quic_base", 1064 ] 1065 } 1066 1067 if (is_chromeos) { 1068 sources -= [ 1069 "base/network_change_notifier_linux_unittest.cc", 1070 "proxy/proxy_config_service_linux_unittest.cc", 1071 ] 1072 } 1073 1074 if (is_android) { 1075 sources -= [ 1076 # See bug http://crbug.com/344533. 1077 "disk_cache/blockfile/index_table_v3_unittest.cc", 1078 # No res_ninit() et al on Android, so this doesn't make a lot of 1079 # sense. 1080 "dns/dns_config_service_posix_unittest.cc", 1081 ] 1082 deps += [ 1083 ":net_javatests", # FIXME(brettw) 1084 ":net_test_jni_headers", 1085 ] 1086 } 1087 1088 if (!use_nss_certs) { 1089 sources -= [ 1090 "ssl/client_cert_store_nss_unittest.cc", 1091 ] 1092 if (is_chromeos) { # Already removed for all non-ChromeOS builds. 1093 sources -= [ 1094 "ssl/client_cert_store_chromeos_unittest.cc", 1095 ] 1096 } 1097 } 1098 1099 if (use_openssl) { 1100 # When building for OpenSSL, we need to exclude NSS specific tests 1101 # or functionality not supported by OpenSSL yet. 1102 # TODO(bulach): Add equivalent tests when the underlying 1103 # functionality is ported to OpenSSL. 1104 sources -= [ 1105 "cert/ct_objects_extractor_unittest.cc", 1106 "cert/multi_log_ct_verifier_unittest.cc", 1107 "cert/nss_cert_database_unittest.cc", 1108 "cert/nss_cert_database_chromeos_unittest.cc", 1109 "cert/nss_profile_filter_chromeos_unittest.cc", 1110 "cert/x509_util_nss_unittest.cc", 1111 "quic/test_tools/crypto_test_utils_nss.cc", 1112 ] 1113 } else { 1114 sources -= [ 1115 "cert/x509_util_openssl_unittest.cc", 1116 "quic/test_tools/crypto_test_utils_openssl.cc", 1117 "socket/ssl_client_socket_openssl_unittest.cc", 1118 "socket/ssl_session_cache_openssl_unittest.cc", 1119 ] 1120 if (!is_desktop_linux && !is_chromeos) { 1121 sources -= [ "cert/nss_cert_database_unittest.cc" ] 1122 } 1123 } 1124 1125 if (use_kerberos) { 1126 defines += [ "USE_KERBEROS" ] 1127 } else { 1128 sources -= [ 1129 "http/http_auth_gssapi_posix_unittest.cc", 1130 "http/http_auth_handler_negotiate_unittest.cc", 1131 "http/mock_gssapi_library_posix.cc", 1132 "http/mock_gssapi_library_posix.h", 1133 ] 1134 } 1135 1136 if (use_openssl || (!is_desktop_linux && !is_chromeos && !is_ios)) { 1137 # Only include this test when on Posix and using NSS for 1138 # cert verification or on iOS (which also uses NSS for certs). 1139 sources -= [ "ocsp/nss_ocsp_unittest.cc" ] 1140 } 1141 1142 if (!use_openssl_certs) { 1143 sources -= [ "ssl/openssl_client_key_store_unittest.cc" ] 1144 } 1145 1146 if (!enable_websockets) { 1147 sources -= [ 1148 "socket_stream/socket_stream_metrics_unittest.cc", 1149 "socket_stream/socket_stream_unittest.cc", 1150 "spdy/spdy_websocket_stream_unittest.cc", 1151 "websockets/websocket_basic_stream_test.cc", 1152 "websockets/websocket_channel_test.cc", 1153 "websockets/websocket_deflate_predictor_impl_test.cc", 1154 "websockets/websocket_deflate_stream_test.cc", 1155 "websockets/websocket_deflater_test.cc", 1156 "websockets/websocket_errors_test.cc", 1157 "websockets/websocket_extension_parser_test.cc", 1158 "websockets/websocket_frame_parser_test.cc", 1159 "websockets/websocket_frame_test.cc", 1160 "websockets/websocket_handshake_handler_spdy_test.cc", 1161 "websockets/websocket_handshake_handler_test.cc", 1162 "websockets/websocket_handshake_stream_create_helper_test.cc", 1163 "websockets/websocket_inflater_test.cc", 1164 "websockets/websocket_job_test.cc", 1165 "websockets/websocket_net_log_params_test.cc", 1166 "websockets/websocket_stream_test.cc", 1167 "websockets/websocket_test_util.cc", 1168 "websockets/websocket_test_util.h", 1169 "websockets/websocket_throttle_test.cc", 1170 ] 1171 } 1172 1173 if (disable_file_support) { 1174 sources -= [ 1175 "base/directory_lister_unittest.cc", 1176 "url_request/url_request_file_job_unittest.cc", 1177 ] 1178 } 1179 1180 if (disable_ftp_support) { 1181 sources -= [ 1182 "ftp/ftp_auth_cache_unittest.cc", 1183 "ftp/ftp_ctrl_response_buffer_unittest.cc", 1184 "ftp/ftp_directory_listing_parser_ls_unittest.cc", 1185 "ftp/ftp_directory_listing_parser_netware_unittest.cc", 1186 "ftp/ftp_directory_listing_parser_os2_unittest.cc", 1187 "ftp/ftp_directory_listing_parser_unittest.cc", 1188 "ftp/ftp_directory_listing_parser_unittest.h", 1189 "ftp/ftp_directory_listing_parser_vms_unittest.cc", 1190 "ftp/ftp_directory_listing_parser_windows_unittest.cc", 1191 "ftp/ftp_network_transaction_unittest.cc", 1192 "ftp/ftp_util_unittest.cc", 1193 "url_request/url_request_ftp_job_unittest.cc", 1194 ] 1195 } 1196 1197 if (!enable_built_in_dns) { 1198 sources -= [ 1199 "dns/address_sorter_posix_unittest.cc", 1200 "dns/address_sorter_unittest.cc", 1201 ] 1202 } 1203 1204 # Always need use_v8_in_net to be 1 to run on Android, so just remove 1205 # net_unittest's dependency on v8 when using icu alternatives instead of 1206 # setting use_v8_in_net to 0. 1207 if (use_v8_in_net && !use_icu_alternatives_on_android) { 1208 deps += [ ":net_with_v8" ] 1209 } else { 1210 sources -= [ 1211 "proxy/proxy_resolver_v8_unittest.cc", 1212 "proxy/proxy_resolver_v8_tracing_unittest.cc", 1213 ] 1214 } 1215 1216 if (!enable_mdns) { 1217 sources -= [ 1218 "dns/mdns_cache_unittest.cc", 1219 "dns/mdns_client_unittest.cc", 1220 "dns/record_parsed_unittest.cc", 1221 "dns/record_rdata_unittest.cc", 1222 ] 1223 } 1224 1225 if (is_ios) { 1226 # TODO(GYP) 1227 # 'actions': [ 1228 # { 1229 # 'action_name': 'copy_test_data', 1230 # 'variables': { 1231 # 'test_data_files': [ 1232 # 'data/ssl/certificates/', 1233 # 'data/test.html', 1234 # 'data/url_request_unittest/', 1235 # ], 1236 # 'test_data_prefix': 'net', 1237 # }, 1238 # 'includes': [ '../build/copy_test_data_ios.gypi' ], 1239 # }, 1240 # ], 1241 sources -= [ 1242 # TODO(droger): The following tests are disabled because the 1243 # implementation is missing or incomplete. 1244 # KeygenHandler::GenKeyAndSignChallenge() is not ported to iOS. 1245 "base/keygen_handler_unittest.cc", 1246 "disk_cache/backend_unittest.cc", 1247 "disk_cache/blockfile/block_files_unittest.cc", 1248 # Need to read input data files. 1249 "filter/gzip_filter_unittest.cc", 1250 "socket/ssl_server_socket_unittest.cc", 1251 "spdy/fuzzing/hpack_fuzz_util_test.cc", 1252 # Need TestServer. 1253 "proxy/proxy_script_fetcher_impl_unittest.cc", 1254 "socket/ssl_client_socket_unittest.cc", 1255 "url_request/url_fetcher_impl_unittest.cc", 1256 "url_request/url_request_context_builder_unittest.cc", 1257 # Needs GetAppOutput(). 1258 "test/python_utils_unittest.cc", 1259 1260 # The following tests are disabled because they don't apply to 1261 # iOS. 1262 # OS is not "linux" or "freebsd" or "openbsd". 1263 "socket/unix_domain_socket_posix_unittest.cc", 1264 1265 # See bug http://crbug.com/344533. 1266 "disk_cache/blockfile/index_table_v3_unittest.cc", 1267 ] 1268 } 1269 1270 if (is_android) { 1271 sources -= [ 1272 "dns/dns_config_service_posix_unittest.cc", 1273 ] 1274 # TODO(GYP) 1275 # # TODO(mmenke): This depends on test_support_base, which depends on 1276 # # icu. Figure out a way to remove that dependency. 1277 # 'dependencies': [ 1278 # '../testing/android/native_test.gyp:native_test_native_code', 1279 # ] 1280 1281 set_sources_assignment_filter([]) 1282 sources += [ "base/address_tracker_linux_unittest.cc" ] 1283 set_sources_assignment_filter(sources_assignment_filter) 1284 } 1285 1286 if (use_icu_alternatives_on_android) { 1287 sources -= [ 1288 "base/filename_util_unittest.cc", 1289 "base/net_util_icu_unittest.cc", 1290 ] 1291 deps -= [ "//base:i18n" ] 1292 } 1293 } 1294 1295 } # !is_android 1296