# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//build/config/chromeos/ui_mode.gni") import("//mojo/public/tools/bindings/mojom.gni") import("//net/features.gni") import("//services/network/public/cpp/features.gni") import("//testing/libfuzzer/fuzzer_test.gni") component("network_service") { sources = [ "chunked_data_pipe_upload_data_stream.cc", "chunked_data_pipe_upload_data_stream.h", "conditional_cache_deletion_helper.cc", "conditional_cache_deletion_helper.h", "cookie_access_delegate_impl.cc", "cookie_access_delegate_impl.h", "cookie_manager.cc", "cookie_manager.h", "cookie_settings.cc", "cookie_settings.h", "cors/cors_url_loader.cc", "cors/cors_url_loader.h", "cors/cors_url_loader_factory.cc", "cors/cors_url_loader_factory.h", "cors/preflight_controller.cc", "cors/preflight_controller.h", "crash_keys.cc", "crash_keys.h", "crl_set_distributor.cc", "crl_set_distributor.h", "cross_origin_read_blocking_exception_for_plugin.cc", "cross_origin_read_blocking_exception_for_plugin.h", "data_pipe_element_reader.cc", "data_pipe_element_reader.h", "dns_config_change_manager.cc", "dns_config_change_manager.h", "host_resolver.cc", "host_resolver.h", "host_resolver_mdns_listener.cc", "host_resolver_mdns_listener.h", "http_auth_cache_copier.cc", "http_auth_cache_copier.h", "http_cache_data_counter.cc", "http_cache_data_counter.h", "http_cache_data_remover.cc", "http_cache_data_remover.h", "http_server_properties_pref_delegate.cc", "http_server_properties_pref_delegate.h", "ignore_errors_cert_verifier.cc", "ignore_errors_cert_verifier.h", "keepalive_statistics_recorder.cc", "keepalive_statistics_recorder.h", "legacy_tls_config_distributor.cc", "legacy_tls_config_distributor.h", "mojo_host_resolver_impl.cc", "mojo_host_resolver_impl.h", "net_log_exporter.cc", "net_log_exporter.h", "net_log_proxy_sink.cc", "net_log_proxy_sink.h", "network_change_manager.cc", "network_change_manager.h", "network_context.cc", "network_context.h", "network_qualities_pref_delegate.cc", "network_qualities_pref_delegate.h", "network_quality_estimator_manager.cc", "network_quality_estimator_manager.h", "network_service.cc", "network_service.h", "network_service_network_delegate.cc", "network_service_network_delegate.h", "network_service_proxy_delegate.cc", "network_service_proxy_delegate.h", "network_usage_accumulator.cc", "network_usage_accumulator.h", "origin_policy/origin_policy_constants.h", "origin_policy/origin_policy_fetcher.cc", "origin_policy/origin_policy_fetcher.h", "origin_policy/origin_policy_header_values.cc", "origin_policy/origin_policy_header_values.h", "origin_policy/origin_policy_manager.cc", "origin_policy/origin_policy_manager.h", "origin_policy/origin_policy_parsed_header.cc", "origin_policy/origin_policy_parsed_header.h", "origin_policy/origin_policy_parser.cc", "origin_policy/origin_policy_parser.h", "p2p/socket.cc", "p2p/socket.h", "p2p/socket_manager.cc", "p2p/socket_manager.h", "p2p/socket_tcp.cc", "p2p/socket_tcp.h", "p2p/socket_tcp_server.cc", "p2p/socket_tcp_server.h", "p2p/socket_throttler.cc", "p2p/socket_throttler.h", "p2p/socket_udp.cc", "p2p/socket_udp.h", "pending_callback_chain.cc", "pending_callback_chain.h", "proxy_auto_config_library.cc", "proxy_auto_config_library.h", "proxy_config_service_mojo.cc", "proxy_config_service_mojo.h", "proxy_lookup_request.cc", "proxy_lookup_request.h", "proxy_resolver_factory_mojo.cc", "proxy_resolver_factory_mojo.h", "proxy_resolving_client_socket.cc", "proxy_resolving_client_socket.h", "proxy_resolving_client_socket_factory.cc", "proxy_resolving_client_socket_factory.h", "proxy_resolving_socket_factory_mojo.cc", "proxy_resolving_socket_factory_mojo.h", "proxy_resolving_socket_mojo.cc", "proxy_resolving_socket_mojo.h", "proxy_service_mojo.cc", "proxy_service_mojo.h", "quic_transport.cc", "quic_transport.h", "resolve_host_request.cc", "resolve_host_request.h", "resource_scheduler/resource_scheduler.cc", "resource_scheduler/resource_scheduler.h", "resource_scheduler/resource_scheduler_client.cc", "resource_scheduler/resource_scheduler_client.h", "resource_scheduler/resource_scheduler_params_manager.cc", "resource_scheduler/resource_scheduler_params_manager.h", "restricted_cookie_manager.cc", "restricted_cookie_manager.h", "sec_header_helpers.cc", "sec_header_helpers.h", "session_cleanup_cookie_store.cc", "session_cleanup_cookie_store.h", "socket_data_pump.cc", "socket_data_pump.h", "socket_factory.cc", "socket_factory.h", "ssl_config_service_mojo.cc", "ssl_config_service_mojo.h", "ssl_config_type_converter.cc", "ssl_config_type_converter.h", "tcp_bound_socket.cc", "tcp_bound_socket.h", "tcp_connected_socket.cc", "tcp_connected_socket.h", "tcp_server_socket.cc", "tcp_server_socket.h", "throttling/network_conditions.cc", "throttling/network_conditions.h", "throttling/scoped_throttling_token.cc", "throttling/scoped_throttling_token.h", "throttling/throttling_controller.cc", "throttling/throttling_controller.h", "throttling/throttling_network_interceptor.cc", "throttling/throttling_network_interceptor.h", "throttling/throttling_network_transaction.cc", "throttling/throttling_network_transaction.h", "throttling/throttling_network_transaction_factory.cc", "throttling/throttling_network_transaction_factory.h", "throttling/throttling_upload_data_stream.cc", "throttling/throttling_upload_data_stream.h", "tls_client_socket.cc", "tls_client_socket.h", "tls_socket_factory.cc", "tls_socket_factory.h", "transitional_url_loader_factory_owner.cc", "transitional_url_loader_factory_owner.h", "udp_socket.cc", "udp_socket.h", "upload_progress_tracker.cc", "upload_progress_tracker.h", "url_loader.cc", "url_loader.h", "url_loader_factory.cc", "url_loader_factory.h", "url_request_context_builder_mojo.cc", "url_request_context_builder_mojo.h", "url_request_context_owner.cc", "url_request_context_owner.h", ] if (enable_mdns) { sources += [ "mdns_responder.cc", "mdns_responder.h", ] } if (!is_ios) { sources += [ "websocket.cc", "websocket.h", "websocket_factory.cc", "websocket_factory.h", "websocket_throttler.cc", "websocket_throttler.h", ] } if (is_ash) { sources += [ "cert_verifier_with_trust_anchors.cc", "cert_verifier_with_trust_anchors.h", "dhcp_pac_file_fetcher_mojo.cc", "dhcp_pac_file_fetcher_mojo.h", "nss_temp_certs_cache_chromeos.cc", "nss_temp_certs_cache_chromeos.h", ] } if (is_linux || is_chromeos) { sources += [ "network_sandbox_hook_linux.cc", "network_sandbox_hook_linux.h", ] } configs += [ "//build/config/compiler:wexit_time_destructors" ] deps = [ "//base", "//build:chromecast_buildflags", "//build:chromeos_buildflags", "//components/content_settings/core/common", "//components/cookie_config", "//components/domain_reliability", "//components/network_session_configurator/browser", "//components/network_session_configurator/common", "//components/os_crypt", "//components/prefs", "//jingle:fake_ssl_socket", "//mojo/public/cpp/bindings", "//mojo/public/cpp/system", "//net", "//net:extras", "//services/network/first_party_sets", "//services/network/public/cpp", "//services/network/public/cpp:crash_keys", "//services/network/public/cpp/cert_verifier:cert_verifier_creation", "//services/network/public/cpp/cert_verifier:mojo_cert_verifier", "//services/network/public/mojom", "//services/network/public/proto", "//services/network/trust_tokens", "//services/service_manager/public/cpp", "//services/service_manager/public/mojom", "//third_party/webrtc_overrides:webrtc_component", "//url", ] public_deps = [ "//services/network/public/cpp:buildflags" ] if (is_ct_supported) { sources += [ "expect_ct_reporter.cc", "expect_ct_reporter.h", "sct_auditing_cache.cc", "sct_auditing_cache.h", ] deps += [ "//components/certificate_transparency" ] } if (is_linux || is_chromeos) { deps += [ "//sandbox/linux:sandbox_services", "//sandbox/policy", ] } if (is_android) { deps += [ "//crypto", "//third_party/boringssl", ] } if (is_win) { deps += [ "//sandbox/win:sandbox" ] } defines = [ "IS_NETWORK_SERVICE_IMPL" ] } source_set("tests") { testonly = true sources = [ "chunked_data_pipe_upload_data_stream_unittest.cc", "cookie_manager_unittest.cc", "cookie_settings_unittest.cc", "cors/cors_url_loader_factory_unittest.cc", "cors/cors_url_loader_unittest.cc", "cors/preflight_controller_unittest.cc", "data_pipe_element_reader_unittest.cc", "dns_config_change_manager_unittest.cc", "host_resolver_unittest.cc", "http_cache_data_counter_unittest.cc", "http_cache_data_remover_unittest.cc", "ignore_errors_cert_verifier_unittest.cc", "keepalive_statistics_recorder_unittest.cc", "mojo_host_resolver_impl_unittest.cc", "net_log_proxy_sink_unittest.cc", "network_change_manager_unittest.cc", "network_context_unittest.cc", "network_qualities_pref_delegate_unittest.cc", "network_quality_estimator_manager_unittest.cc", "network_service_proxy_delegate_unittest.cc", "network_service_unittest.cc", "network_usage_accumulator_unittest.cc", "origin_policy/origin_policy_manager_unittest.cc", "origin_policy/origin_policy_parsed_header_unittest.cc", "origin_policy/origin_policy_parser_unittest.cc", "p2p/socket_tcp_server_unittest.cc", "p2p/socket_tcp_unittest.cc", "p2p/socket_test_utils.cc", "p2p/socket_test_utils.h", "p2p/socket_udp_unittest.cc", "pending_callback_chain_unittest.cc", "proxy_auto_config_library_unittest.cc", "proxy_config_service_mojo_unittest.cc", "proxy_resolving_client_socket_unittest.cc", "proxy_resolving_socket_mojo_unittest.cc", "quic_transport_unittest.cc", "resource_scheduler/resource_scheduler_params_manager_unittest.cc", "resource_scheduler/resource_scheduler_unittest.cc", "restricted_cookie_manager_unittest.cc", "sec_header_helpers_unittest.cc", "session_cleanup_cookie_store_unittest.cc", "socket_data_pump_unittest.cc", "ssl_config_service_mojo_unittest.cc", "tcp_bound_socket_unittest.cc", "tcp_socket_unittest.cc", "test/test_url_loader_factory_unittest.cc", "test_chunked_data_pipe_getter.cc", "test_chunked_data_pipe_getter.h", "throttling/throttling_controller_unittest.cc", "tls_client_socket_unittest.cc", "transitional_url_loader_factory_owner_unittest.cc", "udp_socket_unittest.cc", "upload_progress_tracker_unittest.cc", "url_loader_unittest.cc", ] if (enable_mdns) { sources += [ "mdns_responder_unittest.cc" ] } if (!is_ios) { sources += [ "proxy_resolver_factory_mojo_unittest.cc", "proxy_service_mojo_unittest.cc", "test_mojo_proxy_resolver_factory.cc", "test_mojo_proxy_resolver_factory.h", "url_request_context_builder_mojo_unittest.cc", "websocket_throttler_unittest.cc", ] data = [ "//net/tools/testserver/", "//services/test/data", "//third_party/pywebsocket3/src/mod_pywebsocket/", "//third_party/tlslite/", ] } if (is_ash) { sources += [ "cert_verifier_with_trust_anchors_unittest.cc", "dhcp_pac_file_fetcher_mojo_unittest.cc", "nss_temp_certs_cache_chromeos_unittest.cc", ] } deps = [ ":network_service", ":test_support", "//base", "//build:chromeos_buildflags", "//components/network_session_configurator/browser", "//components/prefs:test_support", "//components/variations:test_support", "//crypto:test_support", "//jingle:fake_ssl_socket", "//mojo/public/cpp/bindings", "//mojo/public/cpp/system", "//net", "//net:extras", "//net:quic_test_tools", "//net:simple_quic_tools", "//net:test_support", "//net/http:transport_security_state_unittest_data_default", "//services/network/first_party_sets", "//services/network/first_party_sets:tests", "//services/network/public/cpp", "//services/network/public/cpp:buildflags", "//services/network/public/cpp/cert_verifier:cert_verifier_creation", "//services/network/public/mojom", "//services/network/public/proto", "//services/network/trust_tokens", "//services/network/trust_tokens:tests", "//services/service_manager/public/cpp", "//services/service_manager/public/cpp/test:test_support", "//testing/gmock", "//testing/gtest", ] if (is_ct_supported) { sources += [ "expect_ct_reporter_unittest.cc", "sct_auditing_cache_unittest.cc", ] deps += [ "//components/certificate_transparency" ] } if (!is_ios) { deps += [ "//services/proxy_resolver:lib" ] } } source_set("test_support") { testonly = true sources = [ "mojo_socket_test_util.cc", "mojo_socket_test_util.h", "test/fake_test_cert_verifier_params_factory.cc", "test/fake_test_cert_verifier_params_factory.h", "test/test_cookie_manager.cc", "test/test_cookie_manager.h", "test/test_data_pipe_getter.cc", "test/test_data_pipe_getter.h", "test/test_dns_util.cc", "test/test_dns_util.h", "test/test_network_connection_tracker.cc", "test/test_network_connection_tracker.h", "test/test_network_context.h", "test/test_network_context_client.cc", "test/test_network_context_client.h", "test/test_network_quality_tracker.cc", "test/test_network_quality_tracker.h", "test/test_network_service_client.cc", "test/test_network_service_client.h", "test/test_resource_scheduler.h", "test/test_shared_url_loader_factory.cc", "test/test_shared_url_loader_factory.h", "test/test_url_loader_client.cc", "test/test_url_loader_client.h", "test/test_url_loader_factory.cc", "test/test_url_loader_factory.h", "test/test_utils.cc", "test/test_utils.h", "test/udp_socket_test_util.cc", "test/udp_socket_test_util.h", ] if (is_ash) { sources += [ "mock_mojo_dhcp_wpad_url_client.cc", "mock_mojo_dhcp_wpad_url_client.h", ] } public_deps = [ "//services/network/public/cpp", "//services/network/public/cpp:buildflags", "//services/network/public/mojom", "//services/network/trust_tokens:test_support", ] deps = [ "//base", "//build:chromeos_buildflags", "//mojo/public/cpp/bindings", "//net", "//net:test_support", "//services/network:network_service", "//testing/gtest", ] } fuzzer_test("network_content_security_policy_fuzzer") { sources = [ "content_security_policy_fuzzer.cc" ] deps = [ "//base", "//net", "//services/network:network_service", "//services/network/public/cpp", "//services/network/public/mojom", ] dict = "//testing/libfuzzer/fuzzers/dicts/content_security_policy.dict" seed_corpus = "//testing/libfuzzer/fuzzers/content_security_policy_corpus" } fuzzer_test("origin_policy_parser_fuzzer") { sources = [ "origin_policy/origin_policy_parser_fuzzer.cc" ] deps = [ "//base", "//net", "//services/network:network_service", "//services/network/public/cpp", "//services/network/public/mojom", ] dict = "origin_policy/origin_policy_parser_fuzzer.dict" seed_corpus = "origin_policy/origin_policy_parser_fuzzer_corpus" }