chromium/ios/web_view/BUILD.gn

# Copyright 2016 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/apple/tweak_info_plist.gni")
import("//build/config/ios/ios_sdk.gni")
import("//build/config/ios/rules.gni")
import("//build/config/locales.gni")
import("//components/grpc_support/include/headers.gni")
import("//ios/build/config.gni")
import("//ios/web/public/js_messaging/optimize_js.gni")
import("//ios/web_view/features.gni")
import("//ios/web_view/repack.gni")
import("//testing/test.gni")
import("//tools/grit/repack.gni")

group("all_tests") {
  testonly = true
  deps = [
    ":ios_web_view_inttests",
    ":ios_web_view_unittests",
  ]
}

config("config") {
  # TODO(crbug.com/40120082): This will only guarantee ios/web_view source files
  # are extension safe. We also need to pass this flag to all all dependencies.
  common_flags = [ "-fapplication-extension" ]
  cflags_objc = common_flags
  cflags_objcc = common_flags
  defines = [ "CWV_IMPLEMENTATION" ]
  frameworks = [
    "CoreGraphics.framework",
    "Foundation.framework",
    "MobileCoreServices.framework",
    "UIKit.framework",
  ]
}

# These are defined as vars so they can be shared with different targets below.
ios_web_view_public_headers = [
  "public/cwv_autofill_controller.h",
  "public/cwv_autofill_controller_delegate.h",
  "public/cwv_autofill_data_manager.h",
  "public/cwv_autofill_data_manager_observer.h",
  "public/cwv_autofill_form.h",
  "public/cwv_autofill_profile.h",
  "public/cwv_autofill_suggestion.h",
  "public/cwv_back_forward_list.h",
  "public/cwv_back_forward_list_item.h",
  "public/cwv_cert_status.h",
  "public/cwv_credential_provider_extension_utils.h",
  "public/cwv_credit_card.h",
  "public/cwv_credit_card_saver.h",
  "public/cwv_credit_card_verifier.h",
  "public/cwv_defines.h",
  "public/cwv_download_task.h",
  "public/cwv_export.h",
  "public/cwv_favicon.h",
  "public/cwv_find_in_page_controller.h",
  "public/cwv_flags.h",
  "public/cwv_html_element.h",
  "public/cwv_identity.h",
  "public/cwv_leak_check_credential.h",
  "public/cwv_leak_check_service.h",
  "public/cwv_leak_check_service_observer.h",
  "public/cwv_lookalike_url_handler.h",
  "public/cwv_metrics_provider.h",
  "public/cwv_navigation_action.h",
  "public/cwv_navigation_delegate.h",
  "public/cwv_navigation_response.h",
  "public/cwv_navigation_type.h",
  "public/cwv_password.h",
  "public/cwv_preferences.h",
  "public/cwv_preview_element_info.h",
  "public/cwv_reuse_check_service.h",
  "public/cwv_ssl_error_handler.h",
  "public/cwv_ssl_status.h",
  "public/cwv_suggestion_type.h",
  "public/cwv_sync_controller.h",
  "public/cwv_sync_controller_data_source.h",
  "public/cwv_sync_controller_delegate.h",
  "public/cwv_sync_errors.h",
  "public/cwv_translation_controller.h",
  "public/cwv_translation_controller_delegate.h",
  "public/cwv_translation_language.h",
  "public/cwv_translation_policy.h",
  "public/cwv_trusted_vault_observer.h",
  "public/cwv_trusted_vault_provider.h",
  "public/cwv_trusted_vault_utils.h",
  "public/cwv_ui_delegate.h",
  "public/cwv_unsafe_url_handler.h",
  "public/cwv_user_content_controller.h",
  "public/cwv_user_script.h",
  "public/cwv_weak_check_utils.h",
  "public/cwv_web_view.h",
  "public/cwv_web_view_configuration.h",
  "public/cwv_x509_certificate.h",
]

ios_web_view_sources = [
  "internal/affiliations/web_view_affiliation_service_factory.h",
  "internal/affiliations/web_view_affiliation_service_factory.mm",
  "internal/app/application_context.h",
  "internal/app/application_context.mm",
  "internal/app/web_view_io_thread.h",
  "internal/app/web_view_io_thread.mm",
  "internal/autofill/cwv_autofill_client_ios_bridge.h",
  "internal/autofill/cwv_autofill_controller.mm",
  "internal/autofill/cwv_autofill_controller_internal.h",
  "internal/autofill/cwv_autofill_data_manager.mm",
  "internal/autofill/cwv_autofill_data_manager_internal.h",
  "internal/autofill/cwv_autofill_form.mm",
  "internal/autofill/cwv_autofill_form_internal.h",
  "internal/autofill/cwv_autofill_profile.mm",
  "internal/autofill/cwv_autofill_profile_internal.h",
  "internal/autofill/cwv_autofill_suggestion.mm",
  "internal/autofill/cwv_autofill_suggestion_internal.h",
  "internal/autofill/cwv_credit_card.mm",
  "internal/autofill/cwv_credit_card_internal.h",
  "internal/autofill/cwv_credit_card_saver.mm",
  "internal/autofill/cwv_credit_card_saver_internal.h",
  "internal/autofill/cwv_credit_card_verifier.mm",
  "internal/autofill/cwv_credit_card_verifier_internal.h",
  "internal/autofill/ios_web_view_payments_autofill_client.h",
  "internal/autofill/ios_web_view_payments_autofill_client.mm",
  "internal/autofill/web_view_autocomplete_history_manager_factory.h",
  "internal/autofill/web_view_autocomplete_history_manager_factory.mm",
  "internal/autofill/web_view_autofill_client_ios.h",
  "internal/autofill/web_view_autofill_client_ios.mm",
  "internal/autofill/web_view_autofill_log_router_factory.h",
  "internal/autofill/web_view_autofill_log_router_factory.mm",
  "internal/autofill/web_view_personal_data_manager_factory.h",
  "internal/autofill/web_view_personal_data_manager_factory.mm",
  "internal/autofill/web_view_strike_database_factory.h",
  "internal/autofill/web_view_strike_database_factory.mm",
  "internal/browser_state_keyed_service_factories.h",
  "internal/browser_state_keyed_service_factories.mm",
  "internal/browser_state_prefs.h",
  "internal/browser_state_prefs.mm",
  "internal/component_updater/web_view_component_updater_configurator.h",
  "internal/component_updater/web_view_component_updater_configurator.mm",
  "internal/cwv_back_forward_list.mm",
  "internal/cwv_back_forward_list_internal.h",
  "internal/cwv_back_forward_list_item.mm",
  "internal/cwv_back_forward_list_item_internal.h",
  "internal/cwv_download_task.mm",
  "internal/cwv_download_task_internal.h",
  "internal/cwv_favicon.mm",
  "internal/cwv_favicon_internal.h",
  "internal/cwv_find_in_page_controller.mm",
  "internal/cwv_find_in_page_controller_internal.h",
  "internal/cwv_flags.mm",
  "internal/cwv_flags_internal.h",
  "internal/cwv_html_element.mm",
  "internal/cwv_html_element_internal.h",
  "internal/cwv_lookalike_url_handler.mm",
  "internal/cwv_lookalike_url_handler_internal.h",
  "internal/cwv_navigation_action.mm",
  "internal/cwv_navigation_action_internal.h",
  "internal/cwv_navigation_response.mm",
  "internal/cwv_navigation_response_internal.h",
  "internal/cwv_navigation_type.mm",
  "internal/cwv_navigation_type_internal.h",
  "internal/cwv_preferences.mm",
  "internal/cwv_preferences_internal.h",
  "internal/cwv_preview_element_info.mm",
  "internal/cwv_preview_element_info_internal.h",
  "internal/cwv_ssl_error_handler.mm",
  "internal/cwv_ssl_error_handler_internal.h",
  "internal/cwv_ssl_status.mm",
  "internal/cwv_ssl_status_internal.h",
  "internal/cwv_ssl_util.h",
  "internal/cwv_ssl_util.mm",
  "internal/cwv_user_content_controller.mm",
  "internal/cwv_user_content_controller_internal.h",
  "internal/cwv_user_script.mm",
  "internal/cwv_web_view.mm",
  "internal/cwv_web_view_configuration.mm",
  "internal/cwv_web_view_configuration_internal.h",
  "internal/cwv_web_view_internal.h",
  "internal/cwv_x509_certificate.mm",
  "internal/cwv_x509_certificate_internal.h",
  "internal/ios_global_state_web_view_configuration.mm",
  "internal/js_messaging/web_view_scripts_java_script_feature.h",
  "internal/js_messaging/web_view_scripts_java_script_feature.mm",
  "internal/language/web_view_accept_languages_service_factory.h",
  "internal/language/web_view_accept_languages_service_factory.mm",
  "internal/language/web_view_language_model_manager_factory.h",
  "internal/language/web_view_language_model_manager_factory.mm",
  "internal/language/web_view_url_language_histogram_factory.h",
  "internal/language/web_view_url_language_histogram_factory.mm",
  "internal/metrics/cwv_metrics_provider.mm",
  "internal/metrics/cwv_metrics_provider_internal.h",
  "internal/passwords/cwv_credential_provider_extension_utils.mm",
  "internal/passwords/cwv_leak_check_credential.mm",
  "internal/passwords/cwv_leak_check_credential_internal.h",
  "internal/passwords/cwv_leak_check_service.mm",
  "internal/passwords/cwv_leak_check_service_internal.h",
  "internal/passwords/cwv_password.mm",
  "internal/passwords/cwv_password_internal.h",
  "internal/passwords/cwv_reuse_check_service.mm",
  "internal/passwords/cwv_reuse_check_service_internal.h",
  "internal/passwords/cwv_weak_check_utils.mm",
  "internal/passwords/cwv_weak_check_utils_internal.h",
  "internal/passwords/web_view_account_password_store_factory.h",
  "internal/passwords/web_view_account_password_store_factory.mm",
  "internal/passwords/web_view_bulk_leak_check_service_factory.h",
  "internal/passwords/web_view_bulk_leak_check_service_factory.mm",
  "internal/passwords/web_view_password_feature_manager.h",
  "internal/passwords/web_view_password_feature_manager.mm",
  "internal/passwords/web_view_password_manager_client.h",
  "internal/passwords/web_view_password_manager_client.mm",
  "internal/passwords/web_view_password_manager_log_router_factory.h",
  "internal/passwords/web_view_password_manager_log_router_factory.mm",
  "internal/passwords/web_view_password_requirements_service_factory.h",
  "internal/passwords/web_view_password_requirements_service_factory.mm",
  "internal/passwords/web_view_password_reuse_manager_factory.h",
  "internal/passwords/web_view_password_reuse_manager_factory.mm",
  "internal/passwords/web_view_profile_password_store_factory.h",
  "internal/passwords/web_view_profile_password_store_factory.mm",
  "internal/safe_browsing/cwv_unsafe_url_handler.mm",
  "internal/safe_browsing/cwv_unsafe_url_handler_internal.h",
  "internal/safe_browsing/web_view_safe_browsing_client.h",
  "internal/safe_browsing/web_view_safe_browsing_client.mm",
  "internal/safe_browsing/web_view_safe_browsing_client_factory.h",
  "internal/safe_browsing/web_view_safe_browsing_client_factory.mm",
  "internal/signin/account_capabilities_fetcher_factory_ios_web_view.h",
  "internal/signin/account_capabilities_fetcher_factory_ios_web_view.mm",
  "internal/signin/account_capabilities_fetcher_ios_web_view.h",
  "internal/signin/account_capabilities_fetcher_ios_web_view.mm",
  "internal/signin/cwv_identity.mm",
  "internal/signin/ios_web_view_signin_client.h",
  "internal/signin/ios_web_view_signin_client.mm",
  "internal/signin/web_view_device_accounts_provider_impl.h",
  "internal/signin/web_view_device_accounts_provider_impl.mm",
  "internal/signin/web_view_gaia_auth_fetcher.h",
  "internal/signin/web_view_gaia_auth_fetcher.mm",
  "internal/signin/web_view_identity_manager_factory.h",
  "internal/signin/web_view_identity_manager_factory.mm",
  "internal/signin/web_view_signin_client_factory.h",
  "internal/signin/web_view_signin_client_factory.mm",
  "internal/sync/cwv_sync_controller.mm",
  "internal/sync/cwv_sync_controller_internal.h",
  "internal/sync/cwv_trusted_vault_observer.mm",
  "internal/sync/cwv_trusted_vault_observer_internal.h",
  "internal/sync/cwv_trusted_vault_utils.mm",
  "internal/sync/web_view_data_type_store_service_factory.h",
  "internal/sync/web_view_data_type_store_service_factory.mm",
  "internal/sync/web_view_device_info_sync_service_factory.h",
  "internal/sync/web_view_device_info_sync_service_factory.mm",
  "internal/sync/web_view_gcm_profile_service_factory.h",
  "internal/sync/web_view_gcm_profile_service_factory.mm",
  "internal/sync/web_view_instance_id_profile_service_factory.h",
  "internal/sync/web_view_instance_id_profile_service_factory.mm",
  "internal/sync/web_view_profile_invalidation_provider_factory.h",
  "internal/sync/web_view_profile_invalidation_provider_factory.mm",
  "internal/sync/web_view_sync_client.h",
  "internal/sync/web_view_sync_client.mm",
  "internal/sync/web_view_sync_invalidations_service_factory.h",
  "internal/sync/web_view_sync_invalidations_service_factory.mm",
  "internal/sync/web_view_sync_service_factory.h",
  "internal/sync/web_view_sync_service_factory.mm",
  "internal/sync/web_view_trusted_vault_client.h",
  "internal/sync/web_view_trusted_vault_client.mm",
  "internal/translate/cwv_translation_controller.mm",
  "internal/translate/cwv_translation_controller_internal.h",
  "internal/translate/cwv_translation_language.mm",
  "internal/translate/cwv_translation_language_internal.h",
  "internal/translate/cwv_translation_policy.mm",
  "internal/translate/web_view_translate_client.h",
  "internal/translate/web_view_translate_client.mm",
  "internal/translate/web_view_translate_ranker_factory.h",
  "internal/translate/web_view_translate_ranker_factory.mm",
  "internal/translate/web_view_translate_service.h",
  "internal/translate/web_view_translate_service.mm",
  "internal/utils/nsobject_description_utils.h",
  "internal/utils/nsobject_description_utils.mm",
  "internal/web_view_browser_state.h",
  "internal/web_view_browser_state.mm",
  "internal/web_view_download_manager.h",
  "internal/web_view_download_manager.mm",
  "internal/web_view_global_state_util.h",
  "internal/web_view_java_script_dialog_presenter.h",
  "internal/web_view_java_script_dialog_presenter.mm",
  "internal/web_view_message_handler_java_script_feature.h",
  "internal/web_view_message_handler_java_script_feature.mm",
  "internal/web_view_url_request_context_getter.h",
  "internal/web_view_url_request_context_getter.mm",
  "internal/web_view_web_client.h",
  "internal/web_view_web_client.mm",
  "internal/web_view_web_main_delegate.h",
  "internal/web_view_web_main_delegate.mm",
  "internal/web_view_web_main_parts.h",
  "internal/web_view_web_main_parts.mm",
  "internal/web_view_web_state_policy_decider.h",
  "internal/web_view_web_state_policy_decider.mm",
  "internal/webdata_services/web_view_web_data_service_wrapper_factory.h",
  "internal/webdata_services/web_view_web_data_service_wrapper_factory.mm",
  "internal/webui/web_view_sync_internals_ui.h",
  "internal/webui/web_view_sync_internals_ui.mm",
  "internal/webui/web_view_web_ui_ios_controller_factory.h",
  "internal/webui/web_view_web_ui_ios_controller_factory.mm",
  "internal/webui/web_view_web_ui_provider.mm",
]

ios_web_view_deps = [
  ":web_view_resources",
  "//base",
  "//components/affiliations/core/browser:affiliations",
  "//components/autofill/core/browser",
  "//components/autofill/core/common",
  "//components/autofill/ios/browser",
  "//components/autofill/ios/browser:util",
  "//components/autofill/ios/form_util",
  "//components/autofill/ios/form_util:form_handler_feature",
  "//components/browser_sync",
  "//components/component_updater",
  "//components/component_updater/installer_policies",
  "//components/flags_ui",
  "//components/flags_ui:switches",
  "//components/gcm_driver",
  "//components/history/core/common",
  "//components/image_fetcher/ios",
  "//components/infobars/core",
  "//components/invalidation",
  "//components/invalidation/impl",
  "//components/keyed_service/core",
  "//components/keyed_service/ios",
  "//components/language/core/browser",
  "//components/language/core/common",
  "//components/language/core/language_model",
  "//components/language/ios/browser",
  "//components/leveldb_proto",
  "//components/lookalikes/core",
  "//components/metrics:library_support",
  "//components/metrics/demographics",
  "//components/os_crypt/async/browser",
  "//components/password_manager/core/browser",
  "//components/password_manager/core/browser/affiliation:affiliation_fetching",
  "//components/password_manager/core/browser/features:password_features",
  "//components/password_manager/core/browser/generation:core",
  "//components/password_manager/core/browser/leak_detection:leak_detection",
  "//components/password_manager/core/browser/sharing",
  "//components/password_manager/core/common",
  "//components/password_manager/ios",
  "//components/plus_addresses/settings",
  "//components/plus_addresses/webdata",
  "//components/pref_registry",
  "//components/prefs",
  "//components/profile_metrics",
  "//components/proxy_config",
  "//components/safe_browsing/core/common:safe_browsing_prefs",
  "//components/safe_browsing/ios/browser:allow_list",
  "//components/security_interstitials/core:unsafe_resource",
  "//components/security_state/ios",
  "//components/services/patch:in_process",
  "//components/services/unzip:in_process",
  "//components/sessions:session_id",
  "//components/signin/core/browser",
  "//components/signin/internal/identity_manager",
  "//components/signin/ios/browser",
  "//components/signin/public/base",
  "//components/signin/public/identity_manager",
  "//components/signin/public/identity_manager/ios",
  "//components/signin/public/webdata",
  "//components/ssl_errors",
  "//components/strings",
  "//components/sync",
  "//components/sync/invalidations",
  "//components/sync_device_info",
  "//components/translate/core/browser",
  "//components/translate/core/common",
  "//components/translate/ios/browser",
  "//components/trusted_vault",
  "//components/unified_consent",
  "//components/update_client",
  "//components/update_client:common_impl",
  "//components/url_formatter",
  "//components/variations",
  "//components/variations/net",
  "//components/version_info",
  "//components/version_info:version_string",
  "//components/web_resource",
  "//components/webdata_services",
  "//google_apis",
  "//ios/components/credential_provider_extension:password_spec_fetcher",
  "//ios/components/credential_provider_extension:password_util",
  "//ios/components/io_thread",
  "//ios/components/security_interstitials",
  "//ios/components/security_interstitials/https_only_mode:feature",
  "//ios/components/security_interstitials/lookalikes",
  "//ios/components/security_interstitials/safe_browsing",
  "//ios/components/security_interstitials/safe_browsing:util",
  "//ios/components/webui:provider",
  "//ios/components/webui:url_constants",
  "//ios/components/webui/sync_internals",
  "//ios/net",
  "//ios/third_party/webkit",
  "//ios/web/common",
  "//ios/web/common:user_agent",
  "//ios/web/navigation:wk_navigation_util",
  "//ios/web/public",
  "//ios/web/public/browsing_data",
  "//ios/web/public/deprecated",
  "//ios/web/public/download",
  "//ios/web/public/find_in_page",
  "//ios/web/public/init",
  "//ios/web/public/js_messaging",
  "//ios/web/public/security",
  "//ios/web/public/session:session",
  "//ios/web/public/session/proto",
  "//ios/web/public/web_view_only",
  "//ios/web/public/webui",
  "//ios/web/web_state/ui:wk_web_view_configuration_provider_header",
  "//ios/web/webui",
  "//ios/web_view/internal/js_messaging:cwv_messaging_js",
  "//net",
  "//net:extras",
  "//services/metrics/public/cpp:metrics_cpp",
  "//services/network:network_service",
  "//ui/base",
  "//ui/display",
  "//url",
]

source_set("web_view_sources") {
  sources = ios_web_view_public_headers
  sources += ios_web_view_sources

  public_deps = ios_web_view_deps
  deps = [ "//components/version_info:channel" ]
  configs += [ ":config" ]
}

action("web_view_umbrella_header") {
  script = "//build/config/ios/generate_umbrella_header.py"

  full_header_path = target_gen_dir + "/" + ios_web_view_output_name + ".h"
  outputs = [ full_header_path ]

  args = [
    "--output-path",
    rebase_path(full_header_path, root_build_dir),
  ]

  args += rebase_path(ios_web_view_public_headers, root_build_dir)
}

tweak_info_plist("info_plist") {
  info_plists = [ "Info.plist" ]
}

ios_framework_bundle("web_view") {
  output_name = ios_web_view_output_name
  info_plist_target = ":info_plist"

  ldflags = [ "-fapplication-extension" ]

  public_headers = get_target_outputs(":web_view_umbrella_header")
  public_headers += ios_web_view_public_headers

  sources = ios_web_view_public_headers
  sources += [ "internal/web_view_global_state_util.mm" ]

  deps = [
    ":web_view_sources",
    "//ios/third_party/webkit",
    "//ios/web/public/init",
    "//testing/gtest:ios_coverage_utils",
  ]
  deps += [ ":web_view_umbrella_header" ]

  configs += [ ":config" ]
}

source_set("run_all_unittests") {
  testonly = true
  sources = [ "test/run_all_unittests.cc" ]
  deps = [
    "//base",
    "//base/test:test_support",
    "//mojo/core/embedder",
  ]
}

test("ios_web_view_unittests") {
  testonly = true
  sources = [
    "internal/autofill/cwv_autofill_controller_unittest.mm",
    "internal/autofill/cwv_autofill_data_manager_unittest.mm",
    "internal/autofill/cwv_autofill_form_unittest.mm",
    "internal/autofill/cwv_autofill_profile_unittest.mm",
    "internal/autofill/cwv_autofill_suggestion_unittest.mm",
    "internal/autofill/cwv_credit_card_saver_unittest.mm",
    "internal/autofill/cwv_credit_card_unittest.mm",
    "internal/autofill/cwv_credit_card_verifier_unittest.mm",
    "internal/cwv_download_task_unittest.mm",
    "internal/cwv_favicon_unittest.mm",
    "internal/cwv_flags_unittest.mm",
    "internal/cwv_html_element_unittest.mm",
    "internal/cwv_lookalike_url_handler_unittest.mm",
    "internal/cwv_preferences_unittest.mm",
    "internal/cwv_preview_element_info_unittest.mm",
    "internal/cwv_ssl_error_handler_unittest.mm",
    "internal/cwv_ssl_status_unittest.mm",
    "internal/cwv_web_view_configuration_internal_unittest.mm",
    "internal/cwv_web_view_unittest.mm",
    "internal/cwv_x509_certificate_unittest.mm",
    "internal/metrics/cwv_metrics_provider_unittest.mm",
    "internal/passwords/cwv_credential_provider_extension_utils_unittest.mm",
    "internal/passwords/cwv_leak_check_credential_unittest.mm",
    "internal/passwords/cwv_leak_check_service_unittest.mm",
    "internal/passwords/cwv_password_unittest.mm",
    "internal/passwords/cwv_reuse_check_service_unittest.mm",
    "internal/passwords/cwv_weak_check_utils_unittest.mm",
    "internal/passwords/web_view_password_manager_client_unittest.mm",
    "internal/safe_browsing/cwv_unsafe_url_handler_unittest.mm",
    "internal/signin/account_capabilities_fetcher_ios_web_view_unittest.mm",
    "internal/signin/cwv_identity_unittest.mm",
    "internal/signin/web_view_device_accounts_provider_impl_unittest.mm",
    "internal/signin/web_view_gaia_auth_fetcher_unittest.mm",
    "internal/sync/cwv_sync_controller_unittest.mm",
    "internal/sync/cwv_trusted_vault_observer_unittest.mm",
    "internal/translate/cwv_translation_controller_unittest.mm",
    "internal/translate/cwv_translation_language_unittest.mm",
    "internal/translate/cwv_translation_policy_unittest.mm",
    "internal/web_view_global_state_util_stub.mm",
    "internal/web_view_web_client_unittest.mm",
  ]

  deps = [
    ":run_all_unittests",
    ":web_view_sources",
    "test:test_support",
    "//base/test:test_support",
    "//components/affiliations/core/browser:test_support",
    "//components/autofill/core/browser:test_support",
    "//components/autofill/ios/browser:test_support",
    "//components/autofill/ios/form_util:test_support",
    "//components/invalidation/impl:test_support",
    "//components/password_manager/core/browser:test_support",
    "//components/password_manager/core/browser/leak_detection:test_support",
    "//components/prefs:test_support",
    "//components/signin/public/base:test_support",
    "//components/signin/public/identity_manager:test_support",
    "//components/sync:test_support",
    "//components/sync_device_info:test_support",
    "//components/translate/core/browser:test_support",
    "//components/translate/core/language_detection",
    "//ios/web/common:uikit",
    "//ios/web/common:web_view_creation_util",
    "//ios/web/public/js_messaging",
    "//ios/web/public/security",
    "//ios/web/public/test",
    "//ios/web/public/test:test_fixture",
    "//net:test_support",
    "//testing/gtest",
    "//third_party/ocmock",
  ]

  assert_no_deps = ios_assert_no_deps
}

test("ios_web_view_inttests") {
  testonly = true

  deps = [ "//ios/web_view/test:inttests" ]

  bundle_deps = [ ":web_view+bundle" ]

  assert_no_deps = ios_assert_no_deps
}

repack_locales("repack_locales") {
  visibility = [ ":web_view_resources" ]
  source_patterns = [
    "${root_gen_dir}/components/strings/components_strings_",
    "${root_gen_dir}/components/strings/components_locale_settings_",
    "${root_gen_dir}/ui/strings/app_locale_settings_",
    "${root_gen_dir}/ui/strings/ax_strings_",
    "${root_gen_dir}/ui/strings/ui_strings_",
  ]

  deps = [
    "//components/strings:components_locale_settings",
    "//components/strings:components_strings",
    "//ui/strings:app_locale_settings",
    "//ui/strings:ax_strings",
    "//ui/strings:ui_strings",
  ]
  input_locales = platform_pak_locales
  output_locales = locales_as_apple_outputs
  copy_data_to_bundle = true
}

repack("repack_resources") {
  visibility = [ ":web_view_resources" ]
  deps = [
    "//components/resources:components_resources",
    "//components/sync/service/resources",
    "//ios/web:resources",
    "//ui/resources",
  ]
  sources = [
    "$root_gen_dir/components/components_resources.pak",
    "$root_gen_dir/components/sync_service_sync_internals_resources.pak",
    "$root_gen_dir/ios/web/ios_web_resources.pak",
    "$root_gen_dir/ui/resources/webui_resources.pak",
  ]
  output = "$target_gen_dir/web_view_resources.pak"
  copy_data_to_bundle = true
}

ios_web_view_repack_all_scales("repack_scalable_resources") {
  visibility = [ ":web_view_resources" ]
  scales = [
    "100",
    "200",
    "300",
  ]
}

group("web_view_resources") {
  visibility = [ "//ios/web_view:*" ]
  deps = [
    ":repack_locales",
    ":repack_resources",
    ":repack_scalable_resources",
  ]
}

_package_dir = "$root_out_dir/ios_web_view"

action("ios_web_view_generate_license") {
  _license_path = "$_package_dir/LICENSE"

  script = "//tools/licenses/licenses.py"
  inputs = [ "//buildtools/$host_os/gn" ]
  outputs = [ _license_path ]
  args = [
    "license_file",
    rebase_path(_license_path, root_build_dir),
    "--gn-target",
    "//ios/web_view",
    "--gn-out-dir",
    ".",
    "--target-os",
    "ios",
  ]
}

copy("ios_web_view_package_copy") {
  sources = [
    "$root_out_dir/$ios_web_view_output_name.framework",
    "//AUTHORS",
    "//chrome/VERSION",
  ]
  outputs = [ "$_package_dir/{{source_file_part}}" ]

  deps = [ ":web_view" ]
}

if (enable_dsyms) {
  action("ios_web_view_dsym_archive") {
    script = "//chrome/tools/build/mac/archive_symbols.py"

    # These are the dSYMs that will be archived. The sources list must be
    # the target outputs that correspond to the dSYMs (since a dSYM is a
    # directory it cannot be listed as a source file). The targets that
    # generate both the dSYM and binary image are listed in deps.
    _dsyms = [ "$root_out_dir/$ios_web_view_output_name.dSYM" ]

    sources = [ "$root_out_dir/$ios_web_view_output_name.framework" ]

    _output = "$_package_dir/$ios_web_view_output_name.dSYM.tar.bz2"

    outputs = [ _output ]

    args = [ rebase_path(_output, root_build_dir) ] +
           rebase_path(_dsyms, root_build_dir)

    deps = [ ":web_view" ]
  }
} else {
  group("ios_web_view_dsym_archive") {
  }
}

group("ios_web_view_package") {
  deps = [
    ":ios_web_view_dsym_archive",
    ":ios_web_view_generate_license",
    ":ios_web_view_package_copy",
  ]
}