chromium/ios/net/BUILD.gn

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

import("//build/buildflag_header.gni")
import("//build/config/cronet/config.gni")
import("//ios/build/config.gni")
import("//testing/test.gni")
import("//url/features.gni")

buildflag_header("ios_net_buildflags") {
  header = "ios_net_buildflags.h"
  flags = [ "CRONET_BUILD=$is_cronet_build" ]
}

group("all_tests") {
  testonly = true
  deps = [ ":ios_net_unittests" ]
}

source_set("net") {
  deps = [
    ":ios_net_buildflags",
    "//base",
    "//net",
    "//url:buildflags",
  ]

  sources = [
    "cookies/cookie_cache.cc",
    "cookies/cookie_cache.h",
    "cookies/cookie_creation_time_manager.h",
    "cookies/cookie_creation_time_manager.mm",
    "cookies/cookie_notification_observer.h",
    "cookies/cookie_notification_observer.mm",
    "cookies/cookie_store_ios.h",
    "cookies/cookie_store_ios.mm",
    "cookies/cookie_store_ios_client.h",
    "cookies/cookie_store_ios_client.mm",
    "cookies/ns_http_system_cookie_store.h",
    "cookies/ns_http_system_cookie_store.mm",
    "cookies/system_cookie_store.h",
    "cookies/system_cookie_store.mm",
    "cookies/system_cookie_util.h",
    "cookies/system_cookie_util.mm",
    "crn_http_url_response.h",
    "crn_http_url_response.mm",
    "empty_nsurlcache.h",
    "empty_nsurlcache.mm",
    "http_cache_helper.cc",
    "http_cache_helper.h",
    "protocol_handler_util.h",
    "protocol_handler_util.mm",
    "url_scheme_util.h",
    "url_scheme_util.mm",
  ]

  if (!use_platform_icu_alternatives) {
    deps += [ "//base:i18n" ]
  }
}

source_set("network_protocol") {
  deps = [
    ":ios_net_buildflags",
    ":net",
    "//base",
    "//net",
    "//url:buildflags",
  ]

  sources = [
    "chunked_data_stream_uploader.cc",
    "chunked_data_stream_uploader.h",
    "clients/crn_network_client_protocol.h",
    "crn_http_protocol_handler.h",
    "crn_http_protocol_handler.mm",
    "crn_http_protocol_handler_proxy.h",
    "crn_http_protocol_handler_proxy_with_client_thread.h",
    "crn_http_protocol_handler_proxy_with_client_thread.mm",
    "http_protocol_logging.h",
    "http_protocol_logging.mm",
    "nsurlrequest_util.h",
    "nsurlrequest_util.mm",
  ]

  if (!use_platform_icu_alternatives) {
    deps += [ "//base:i18n" ]
  }
}

source_set("test_support") {
  testonly = true

  deps = [
    ":net",
    "//base",
    "//base/test:test_support",
    "//net:test_support",
  ]
  sources = [
    "cookies/cookie_store_ios_test_util.h",
    "cookies/cookie_store_ios_test_util.mm",
    "cookies/system_cookie_store_unittest_template.h",
    "url_test_util.cc",
    "url_test_util.h",
  ]
}

test("ios_net_unittests") {
  deps = [
    ":net",
    ":network_protocol",
    ":test_support",
    "//base",
    "//base/test:run_all_unittests",
    "//base/test:test_support",
    "//net:test_support",
    "//testing/gtest",
    "//url",
  ]

  sources = [
    "chunked_data_stream_uploader_unittest.cc",
    "cookies/cookie_cache_unittest.cc",
    "cookies/cookie_creation_time_manager_unittest.mm",
    "cookies/cookie_store_ios_unittest.mm",
    "cookies/ns_http_system_cookie_store_unittest.mm",
    "cookies/system_cookie_util_unittest.mm",
    "nsurlrequest_util_unittest.mm",
    "protocol_handler_util_unittest.mm",
    "url_scheme_util_unittest.mm",
  ]

  assert_no_deps = ios_assert_no_deps
}