chromium/third_party/blink/renderer/platform/loader/BUILD.gn

# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//third_party/blink/renderer/build/scripts/scripts.gni")
import("//third_party/blink/renderer/platform/platform.gni")
import("//third_party/blink/renderer/platform/platform_generated.gni")

make_names("make_platform_loader_generated_fetch_initiator_type_names") {
  in_files = [ "fetch/fetch_initiator_type_names.json5" ]
  output_dir = "$blink_platform_output_dir/loader/fetch"
}

make_names("make_platform_loader_generated_delivery_type_names") {
  in_files = [ "fetch/delivery_type_names.json5" ]
  output_dir = "$blink_platform_output_dir/loader/fetch"
}

blink_platform_sources("loader") {
  sources = [
    "allowed_by_nosniff.cc",
    "allowed_by_nosniff.h",
    "child_url_loader_factory_bundle.cc",
    "cors/cors.cc",
    "cors/cors.h",
    "cors/cors_error_string.cc",
    "cors/cors_error_string.h",
    "fetch/back_forward_cache_loader_helper.h",
    "fetch/background_code_cache_host.cc",
    "fetch/background_code_cache_host.h",
    "fetch/body_text_decoder.h",
    "fetch/buffering_bytes_consumer.cc",
    "fetch/buffering_bytes_consumer.h",
    "fetch/bytes_consumer.cc",
    "fetch/bytes_consumer.h",
    "fetch/cached_metadata.cc",
    "fetch/cached_metadata.h",
    "fetch/client_hints_preferences.cc",
    "fetch/client_hints_preferences.h",
    "fetch/code_cache_host.h",
    "fetch/console_logger.h",
    "fetch/cross_origin_attribute_value.h",
    "fetch/data_pipe_bytes_consumer.cc",
    "fetch/data_pipe_bytes_consumer.h",
    "fetch/detachable_use_counter.h",
    "fetch/early_hints_preload_entry.h",
    "fetch/fetch_api_request_body_mojom_traits.cc",
    "fetch/fetch_api_request_body_mojom_traits.h",
    "fetch/fetch_client_settings_object.h",
    "fetch/fetch_client_settings_object_snapshot.cc",
    "fetch/fetch_client_settings_object_snapshot.h",
    "fetch/fetch_context.cc",
    "fetch/fetch_context.h",
    "fetch/fetch_initiator_info.h",
    "fetch/fetch_parameters.cc",
    "fetch/fetch_parameters.h",
    "fetch/fetch_utils.cc",
    "fetch/fetch_utils.h",
    "fetch/https_state.cc",
    "fetch/https_state.h",
    "fetch/integrity_metadata.cc",
    "fetch/integrity_metadata.h",
    "fetch/loader_freeze_mode.h",
    "fetch/loading_attribute_value.h",
    "fetch/loading_behavior_observer.h",
    "fetch/media_timing.h",
    "fetch/memory_cache.cc",
    "fetch/memory_cache.h",
    "fetch/null_resource_fetcher_properties.cc",
    "fetch/null_resource_fetcher_properties.h",
    "fetch/preload_key.h",
    "fetch/raw_resource.cc",
    "fetch/raw_resource.h",
    "fetch/render_blocking_behavior.h",
    "fetch/resource.cc",
    "fetch/resource.h",
    "fetch/resource_client.cc",
    "fetch/resource_client.h",
    "fetch/resource_client_walker.h",
    "fetch/resource_error.cc",
    "fetch/resource_error.h",
    "fetch/resource_fetcher.cc",
    "fetch/resource_fetcher.h",
    "fetch/resource_fetcher_properties.cc",
    "fetch/resource_fetcher_properties.h",
    "fetch/resource_finish_observer.h",
    "fetch/resource_load_observer.h",
    "fetch/resource_load_priority.h",
    "fetch/resource_load_scheduler.cc",
    "fetch/resource_load_scheduler.h",
    "fetch/resource_load_timing.cc",
    "fetch/resource_load_timing.h",
    "fetch/resource_loader.cc",
    "fetch/resource_loader.h",
    "fetch/resource_loader_options.cc",
    "fetch/resource_loader_options.h",
    "fetch/resource_loading_log.h",
    "fetch/resource_priority.h",
    "fetch/resource_request.cc",
    "fetch/resource_request.h",
    "fetch/resource_request_utils.cc",
    "fetch/resource_request_utils.h",
    "fetch/resource_response.cc",
    "fetch/resource_response.h",
    "fetch/resource_status.h",
    "fetch/resource_timing_utils.cc",
    "fetch/resource_timing_utils.h",
    "fetch/response_body_loader.cc",
    "fetch/response_body_loader.h",
    "fetch/response_body_loader_client.h",
    "fetch/script_cached_metadata_handler.cc",
    "fetch/script_cached_metadata_handler.h",
    "fetch/script_fetch_options.cc",
    "fetch/script_fetch_options.h",
    "fetch/service_worker_router_info.cc",
    "fetch/service_worker_router_info.h",
    "fetch/shared_buffer_bytes_consumer.cc",
    "fetch/shared_buffer_bytes_consumer.h",
    "fetch/stale_revalidation_resource_client.cc",
    "fetch/stale_revalidation_resource_client.h",
    "fetch/subresource_web_bundle.h",
    "fetch/subresource_web_bundle_list.cc",
    "fetch/subresource_web_bundle_list.h",
    "fetch/text_resource_decoder_options.cc",
    "fetch/text_resource_decoder_options.h",
    "fetch/trust_token_params_conversion.cc",
    "fetch/trust_token_params_conversion.h",
    "fetch/unique_identifier.cc",
    "fetch/unique_identifier.h",
    "fetch/url_loader/background_response_processor.h",
    "fetch/url_loader/background_url_loader.cc",
    "fetch/url_loader/background_url_loader.h",
    "fetch/url_loader/cached_metadata_handler.cc",
    "fetch/url_loader/cached_metadata_handler.h",
    "fetch/url_loader/code_cache_fetcher.cc",
    "fetch/url_loader/code_cache_fetcher.h",
    "fetch/url_loader/dedicated_or_shared_worker_fetch_context_impl.cc",
    "fetch/url_loader/dedicated_or_shared_worker_fetch_context_impl.h",
    "fetch/url_loader/mojo_url_loader_client.cc",
    "fetch/url_loader/mojo_url_loader_client.h",
    "fetch/url_loader/navigation_body_loader.cc",
    "fetch/url_loader/navigation_body_loader.h",
    "fetch/url_loader/request_conversion.cc",
    "fetch/url_loader/request_conversion.h",
    "fetch/url_loader/resource_request_client.h",
    "fetch/url_loader/resource_request_sender.cc",
    "fetch/url_loader/resource_request_sender.h",
    "fetch/url_loader/sync_load_context.cc",
    "fetch/url_loader/sync_load_context.h",
    "fetch/url_loader/sync_load_response.cc",
    "fetch/url_loader/sync_load_response.h",
    "fetch/url_loader/url_loader.cc",
    "fetch/url_loader/url_loader.h",
    "fetch/url_loader/url_loader_client.cc",
    "fetch/url_loader/url_loader_client.h",
    "fetch/url_loader/url_loader_factory.cc",
    "fetch/url_loader/url_loader_factory.h",
    "fetch/url_loader/worker_main_script_loader.cc",
    "fetch/url_loader/worker_main_script_loader.h",
    "fetch/url_loader/worker_main_script_loader_client.h",
    "fetch/worker_resource_timing_notifier.h",
    "internet_disconnected_url_loader.cc",
    "internet_disconnected_url_loader.h",
    "link_header.cc",
    "link_header.h",
    "mixed_content.cc",
    "mixed_content.h",
    "mixed_content_autoupgrade_status.h",
    "static_data_navigation_body_loader.cc",
    "static_data_navigation_body_loader.h",
    "subresource_integrity.cc",
    "subresource_integrity.h",
    "tracked_child_url_loader_factory_bundle.cc",
    "web_url_request_extra_data.cc",
    "web_url_request_util.cc",
  ]

  sources += get_target_outputs(
          ":make_platform_loader_generated_fetch_initiator_type_names")
  sources +=
      get_target_outputs(":make_platform_loader_generated_delivery_type_names")

  deps = [
    ":make_platform_loader_generated_delivery_type_names",
    ":make_platform_loader_generated_fetch_initiator_type_names",
    "//components/link_header_util",
    "//components/variations/net:net",
    "//net",
    "//services/metrics/public/cpp:ukm_builders",
    "//services/network/public/cpp",
    "//services/network/public/mojom:mojom_blink",
    "//third_party/blink/public/common:buildflags",
    "//third_party/blink/public/common:headers",
    "//third_party/blink/public/mojom:mojom_platform_blink",
    "//third_party/blink/renderer/platform:allow_discouraged_type",
    "//third_party/blink/renderer/platform/blob:blob",
    "//third_party/blink/renderer/platform/instrumentation:instrumentation",
    "//third_party/blink/renderer/platform/network:network",
    "//third_party/blink/renderer/platform/scheduler:scheduler",
  ]
  public_deps = [
    "//third_party/blink/public/mojom:mojom_platform_headers",
    "//third_party/blink/renderer/platform/heap:heap",
  ]
  allow_circular_includes_from =
      [ "//third_party/blink/renderer/platform/network:network" ]
}

source_set("unit_tests") {
  # This target defines test files for blink_platform_unittests and only the
  # blink_platform_unittests target should depend on it.
  visibility = [ "//third_party/blink/renderer/platform:*" ]
  testonly = true

  # Source files for blink_platform_unittests.
  sources = [
    "allowed_by_nosniff_test.cc",
    "cors/cors_test.cc",
    "fetch/buffering_bytes_consumer_test.cc",
    "fetch/bytes_consumer_test.cc",
    "fetch/cached_metadata_test.cc",
    "fetch/client_hints_preferences_test.cc",
    "fetch/data_pipe_bytes_consumer_test.cc",
    "fetch/fetch_api_request_body_mojom_traits_test.cc",
    "fetch/fetch_utils_test.cc",
    "fetch/memory_cache_correctness_test.cc",
    "fetch/memory_cache_test.cc",
    "fetch/raw_resource_test.cc",
    "fetch/resource_fetcher_properties_test.cc",
    "fetch/resource_fetcher_test.cc",
    "fetch/resource_load_scheduler_test.cc",
    "fetch/resource_loader_test.cc",
    "fetch/resource_request_test.cc",
    "fetch/resource_request_utils_test.cc",
    "fetch/resource_response_test.cc",
    "fetch/resource_test.cc",
    "fetch/response_body_loader_test.cc",
    "fetch/shared_buffer_bytes_consumer_test.cc",
    "fetch/url_loader/background_url_loader_unittest.cc",
    "fetch/url_loader/cached_metadata_handler_test.cc",
    "fetch/url_loader/mojo_url_loader_client_unittest.cc",
    "fetch/url_loader/navigation_body_loader_unittest.cc",
    "fetch/url_loader/resource_request_sender_unittest.cc",
    "fetch/url_loader/sync_load_context_unittest.cc",
    "fetch/url_loader/url_loader_unittest.cc",
    "fetch/url_loader/worker_main_script_loader_unittest.cc",
    "link_header_test.cc",
    "static_data_navigation_body_loader_test.cc",
    "subresource_integrity_test.cc",
  ]

  configs += [ "//third_party/blink/renderer/platform:blink_platform_config" ]

  deps = [
    "//base/test:test_support",
    "//mojo/public/cpp/test_support:test_utils",
    "//net:test_support",
    "//net/traffic_annotation:test_support",
    "//services/network:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/blink/public:test_headers",
    "//third_party/blink/renderer/platform:platform",
    "//third_party/blink/renderer/platform:test_support",
  ]
}

source_set("test_support") {
  # This target defines test files for platform:test_support that
  # blink_platform_unittests and blink_unittests can use.
  visibility = [ "//third_party/blink/renderer/platform:test_support" ]
  testonly = true

  # Source files that can be called from blink_platform_unittests and
  # blink_unittests.
  sources = [
    "testing/bytes_consumer_test_reader.cc",
    "testing/bytes_consumer_test_reader.h",
    "testing/fake_background_resource_fetch_assets.cc",
    "testing/fake_background_resource_fetch_assets.h",
    "testing/fake_resource_load_info_notifier.cc",
    "testing/fake_resource_load_info_notifier.h",
    "testing/fake_url_loader_factory_for_background_thread.cc",
    "testing/fake_url_loader_factory_for_background_thread.h",
    "testing/fetch_testing_platform_support.cc",
    "testing/fetch_testing_platform_support.h",
    "testing/mock_fetch_context.h",
    "testing/mock_resource.cc",
    "testing/mock_resource.h",
    "testing/mock_resource_client.h",
    "testing/replaying_bytes_consumer.cc",
    "testing/replaying_bytes_consumer.h",
    "testing/test_loader_factory.h",
    "testing/test_resource_fetcher_properties.cc",
    "testing/test_resource_fetcher_properties.h",
  ]

  configs += [
    "//third_party/blink/renderer:non_test_config",
    "//third_party/blink/renderer/platform:blink_platform_config",
  ]

  public_deps = [
    "//net",
    "//skia",
    "//third_party/blink/public:blink_headers",
    "//third_party/blink/renderer/platform:platform",
    "//third_party/blink/renderer/platform/blob:generator",
    "//third_party/blink/renderer/platform/heap:test_support",
    "//third_party/blink/renderer/platform/scheduler:test_support",
    "//third_party/icu",
  ]
}