# Copyright 2014 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/buildflag_header.gni")
import("//build/config/features.gni")
import("//build/config/jumbo.gni")
import("//components/sync/protocol/protocol_sources.gni")
import("//testing/test.gni")

jumbo_static_library("sync") {
  sources = [
    "base/bind_to_task_runner.h",
    "base/cancelation_observer.cc",
    "base/cancelation_observer.h",
    "base/cancelation_signal.cc",
    "base/cancelation_signal.h",
    "base/cryptographer.cc",
    "base/cryptographer.h",
    "base/data_type_histogram.cc",
    "base/data_type_histogram.h",
    "base/encryptor.h",
    "base/enum_set.h",
    "base/experiments.h",
    "base/extensions_activity.cc",
    "base/extensions_activity.h",
    "base/get_session_name.cc",
    "base/get_session_name.h",
    "base/get_session_name_ios.h",
    "base/get_session_name_ios.mm",
    "base/get_session_name_linux.cc",
    "base/get_session_name_linux.h",
    "base/get_session_name_mac.h",
    "base/get_session_name_mac.mm",
    "base/get_session_name_win.cc",
    "base/get_session_name_win.h",
    "base/hash_util.cc",
    "base/hash_util.h",
    "base/immutable.h",
    "base/invalidation_adapter.cc",
    "base/invalidation_adapter.h",
    "base/invalidation_helper.cc",
    "base/invalidation_helper.h",
    "base/invalidation_interface.cc",
    "base/invalidation_interface.h",
    "base/logging.cc",
    "base/logging.h",
    "base/model_type.h",
    "base/nigori.cc",
    "base/nigori.h",
    "base/node_ordinal.cc",
    "base/node_ordinal.h",
    "base/ordinal.h",
    "base/passphrase_type.cc",
    "base/passphrase_type.h",
    "base/pref_names.cc",
    "base/pref_names.h",
    "base/progress_marker_map.cc",
    "base/progress_marker_map.h",
    "base/proto_value_ptr.h",
    "base/report_unrecoverable_error.cc",
    "base/report_unrecoverable_error.h",
    "base/stop_source.h",
    "base/sync_prefs.cc",
    "base/sync_prefs.h",
    "base/sync_stop_metadata_fate.cc",
    "base/sync_stop_metadata_fate.h",
    "base/syncer_error.cc",
    "base/syncer_error.h",
    "base/system_encryptor.cc",
    "base/system_encryptor.h",
    "base/time.cc",
    "base/time.h",
    "base/unique_position.cc",
    "base/unique_position.h",
    "base/unrecoverable_error_handler.h",
    "base/unrecoverable_error_info.cc",
    "base/unrecoverable_error_info.h",
    "base/weak_handle.cc",
    "base/weak_handle.h",
    "device_info/device_count_metrics_provider.cc",
    "device_info/device_count_metrics_provider.h",
    "device_info/device_info.cc",
    "device_info/device_info.h",
    "device_info/device_info_sync_bridge.cc",
    "device_info/device_info_sync_bridge.h",
    "device_info/device_info_tracker.h",
    "device_info/device_info_util.cc",
    "device_info/device_info_util.h",
    "device_info/local_device_info_provider.h",
    "device_info/local_device_info_provider_impl.cc",
    "device_info/local_device_info_provider_impl.h",
    "driver/about_sync_util.cc",
    "driver/about_sync_util.h",
    "driver/async_directory_type_controller.cc",
    "driver/async_directory_type_controller.h",
    "driver/backend_migrator.cc",
    "driver/backend_migrator.h",
    "driver/clear_server_data_events.h",
    "driver/configure_context.h",
    "driver/data_type_controller.cc",
    "driver/data_type_controller.h",
    "driver/data_type_encryption_handler.cc",
    "driver/data_type_encryption_handler.h",
    "driver/data_type_manager.cc",
    "driver/data_type_manager.h",
    "driver/data_type_manager_impl.cc",
    "driver/data_type_manager_impl.h",
    "driver/data_type_manager_observer.h",
    "driver/data_type_status_table.cc",
    "driver/data_type_status_table.h",
    "driver/directory_data_type_controller.cc",
    "driver/directory_data_type_controller.h",
    "driver/frontend_data_type_controller.cc",
    "driver/frontend_data_type_controller.h",
    "driver/generic_change_processor.cc",
    "driver/generic_change_processor.h",
    "driver/generic_change_processor_factory.cc",
    "driver/generic_change_processor_factory.h",
    "driver/glue/sync_backend_host_core.cc",
    "driver/glue/sync_backend_host_core.h",
    "driver/glue/sync_backend_host_impl.cc",
    "driver/glue/sync_backend_host_impl.h",
    "driver/model_association_manager.cc",
    "driver/model_association_manager.h",
    "driver/model_associator.h",
    "driver/model_type_controller.cc",
    "driver/model_type_controller.h",
    "driver/proxy_data_type_controller.cc",
    "driver/proxy_data_type_controller.h",
    "driver/shared_change_processor.cc",
    "driver/shared_change_processor.h",
    "driver/shared_change_processor_ref.cc",
    "driver/shared_change_processor_ref.h",
    "driver/signin_manager_wrapper.cc",
    "driver/signin_manager_wrapper.h",
    "driver/startup_controller.cc",
    "driver/startup_controller.h",
    "driver/sync_api_component_factory.cc",
    "driver/sync_api_component_factory.h",
    "driver/sync_client.cc",
    "driver/sync_client.h",
    "driver/sync_driver_switches.cc",
    "driver/sync_driver_switches.h",
    "driver/sync_error_controller.cc",
    "driver/sync_error_controller.h",
    "driver/sync_service.cc",
    "driver/sync_service.h",
    "driver/sync_service_crypto.cc",
    "driver/sync_service_crypto.h",
    "driver/sync_service_observer.cc",
    "driver/sync_service_observer.h",
    "driver/sync_service_utils.cc",
    "driver/sync_service_utils.h",
    "driver/sync_stopped_reporter.cc",
    "driver/sync_stopped_reporter.h",
    "driver/sync_token_status.cc",
    "driver/sync_token_status.h",
    "driver/sync_type_preference_provider.h",
    "driver/sync_util.cc",
    "driver/sync_util.h",
    "driver/user_selectable_sync_type.h",
    "engine/commit_queue.cc",
    "engine/commit_queue.h",
    "engine/configure_reason.h",
    "engine/cycle/commit_counters.cc",
    "engine/cycle/commit_counters.h",
    "engine/cycle/model_neutral_state.cc",
    "engine/cycle/model_neutral_state.h",
    "engine/cycle/status_counters.cc",
    "engine/cycle/status_counters.h",
    "engine/cycle/sync_cycle_snapshot.cc",
    "engine/cycle/sync_cycle_snapshot.h",
    "engine/cycle/type_debug_info_observer.cc",
    "engine/cycle/type_debug_info_observer.h",
    "engine/cycle/update_counters.cc",
    "engine/cycle/update_counters.h",
    "engine/data_type_activation_response.cc",
    "engine/data_type_activation_response.h",
    "engine/data_type_association_stats.cc",
    "engine/data_type_association_stats.h",
    "engine/data_type_debug_info_listener.cc",
    "engine/data_type_debug_info_listener.h",
    "engine/engine_components_factory.h",
    "engine/engine_components_factory_impl.cc",
    "engine/engine_components_factory_impl.h",
    "engine/engine_util.cc",
    "engine/engine_util.h",
    "engine/events/protocol_event.cc",
    "engine/events/protocol_event.h",
    "engine/events/protocol_event_observer.cc",
    "engine/events/protocol_event_observer.h",
    "engine/model_safe_worker.cc",
    "engine/model_safe_worker.h",
    "engine/model_type_configurer.cc",
    "engine/model_type_configurer.h",
    "engine/model_type_connector.cc",
    "engine/model_type_connector.h",
    "engine/model_type_processor.cc",
    "engine/model_type_processor.h",
    "engine/model_type_processor_proxy.cc",
    "engine/model_type_processor_proxy.h",
    "engine/net/http_bridge.cc",
    "engine/net/http_bridge.h",
    "engine/net/http_bridge_network_resources.cc",
    "engine/net/http_bridge_network_resources.h",
    "engine/net/http_post_provider_factory.h",
    "engine/net/http_post_provider_interface.h",
    "engine/net/network_resources.h",
    "engine/non_blocking_sync_common.cc",
    "engine/non_blocking_sync_common.h",
    "engine/passive_model_worker.cc",
    "engine/passive_model_worker.h",
    "engine/polling_constants.cc",
    "engine/polling_constants.h",
    "engine/sequenced_model_worker.cc",
    "engine/sequenced_model_worker.h",
    "engine/shutdown_reason.h",
    "engine/sync_auth_provider.h",
    "engine/sync_backend_registrar.cc",
    "engine/sync_backend_registrar.h",
    "engine/sync_credentials.cc",
    "engine/sync_credentials.h",
    "engine/sync_encryption_handler.cc",
    "engine/sync_encryption_handler.h",
    "engine/sync_engine.cc",
    "engine/sync_engine.h",
    "engine/sync_engine_host.cc",
    "engine/sync_engine_host.h",
    "engine/sync_engine_switches.cc",
    "engine/sync_engine_switches.h",
    "engine/sync_manager.cc",
    "engine/sync_manager.h",
    "engine/sync_manager_factory.cc",
    "engine/sync_manager_factory.h",
    "engine/sync_status.cc",
    "engine/sync_status.h",
    "engine/sync_string_conversions.cc",
    "engine/sync_string_conversions.h",
    "engine/ui_model_worker.cc",
    "engine/ui_model_worker.h",
    "engine_impl/all_status.cc",
    "engine_impl/all_status.h",
    "engine_impl/apply_control_data_updates.cc",
    "engine_impl/apply_control_data_updates.h",
    "engine_impl/backoff_delay_provider.cc",
    "engine_impl/backoff_delay_provider.h",
    "engine_impl/clear_server_data.cc",
    "engine_impl/clear_server_data.h",
    "engine_impl/commit.cc",
    "engine_impl/commit.h",
    "engine_impl/commit_contribution.cc",
    "engine_impl/commit_contribution.h",
    "engine_impl/commit_contributor.cc",
    "engine_impl/commit_contributor.h",
    "engine_impl/commit_processor.cc",
    "engine_impl/commit_processor.h",
    "engine_impl/commit_util.cc",
    "engine_impl/commit_util.h",
    "engine_impl/conflict_resolver.cc",
    "engine_impl/conflict_resolver.h",
    "engine_impl/conflict_util.cc",
    "engine_impl/conflict_util.h",
    "engine_impl/cycle/data_type_debug_info_emitter.cc",
    "engine_impl/cycle/data_type_debug_info_emitter.h",
    "engine_impl/cycle/data_type_tracker.cc",
    "engine_impl/cycle/data_type_tracker.h",
    "engine_impl/cycle/debug_info_getter.h",
    "engine_impl/cycle/directory_type_debug_info_emitter.cc",
    "engine_impl/cycle/directory_type_debug_info_emitter.h",
    "engine_impl/cycle/non_blocking_type_debug_info_emitter.cc",
    "engine_impl/cycle/non_blocking_type_debug_info_emitter.h",
    "engine_impl/cycle/nudge_tracker.cc",
    "engine_impl/cycle/nudge_tracker.h",
    "engine_impl/cycle/status_controller.cc",
    "engine_impl/cycle/status_controller.h",
    "engine_impl/cycle/sync_cycle.cc",
    "engine_impl/cycle/sync_cycle.h",
    "engine_impl/cycle/sync_cycle_context.cc",
    "engine_impl/cycle/sync_cycle_context.h",
    "engine_impl/debug_info_event_listener.cc",
    "engine_impl/debug_info_event_listener.h",
    "engine_impl/directory_commit_contribution.cc",
    "engine_impl/directory_commit_contribution.h",
    "engine_impl/directory_commit_contributor.cc",
    "engine_impl/directory_commit_contributor.h",
    "engine_impl/directory_update_handler.cc",
    "engine_impl/directory_update_handler.h",
    "engine_impl/events/clear_server_data_request_event.cc",
    "engine_impl/events/clear_server_data_request_event.h",
    "engine_impl/events/clear_server_data_response_event.cc",
    "engine_impl/events/clear_server_data_response_event.h",
    "engine_impl/events/commit_request_event.cc",
    "engine_impl/events/commit_request_event.h",
    "engine_impl/events/commit_response_event.cc",
    "engine_impl/events/commit_response_event.h",
    "engine_impl/events/configure_get_updates_request_event.cc",
    "engine_impl/events/configure_get_updates_request_event.h",
    "engine_impl/events/get_updates_response_event.cc",
    "engine_impl/events/get_updates_response_event.h",
    "engine_impl/events/normal_get_updates_request_event.cc",
    "engine_impl/events/normal_get_updates_request_event.h",
    "engine_impl/events/poll_get_updates_request_event.cc",
    "engine_impl/events/poll_get_updates_request_event.h",
    "engine_impl/events/protocol_event_buffer.cc",
    "engine_impl/events/protocol_event_buffer.h",
    "engine_impl/get_commit_ids.cc",
    "engine_impl/get_commit_ids.h",
    "engine_impl/get_updates_delegate.cc",
    "engine_impl/get_updates_delegate.h",
    "engine_impl/get_updates_processor.cc",
    "engine_impl/get_updates_processor.h",
    "engine_impl/js_mutation_event_observer.cc",
    "engine_impl/js_mutation_event_observer.h",
    "engine_impl/js_sync_encryption_handler_observer.cc",
    "engine_impl/js_sync_encryption_handler_observer.h",
    "engine_impl/js_sync_manager_observer.cc",
    "engine_impl/js_sync_manager_observer.h",
    "engine_impl/loopback_server/loopback_connection_manager.cc",
    "engine_impl/loopback_server/loopback_connection_manager.h",
    "engine_impl/loopback_server/loopback_server.cc",
    "engine_impl/loopback_server/loopback_server.h",
    "engine_impl/loopback_server/loopback_server_entity.cc",
    "engine_impl/loopback_server/loopback_server_entity.h",
    "engine_impl/loopback_server/persistent_bookmark_entity.cc",
    "engine_impl/loopback_server/persistent_bookmark_entity.h",
    "engine_impl/loopback_server/persistent_permanent_entity.cc",
    "engine_impl/loopback_server/persistent_permanent_entity.h",
    "engine_impl/loopback_server/persistent_tombstone_entity.cc",
    "engine_impl/loopback_server/persistent_tombstone_entity.h",
    "engine_impl/loopback_server/persistent_unique_client_entity.cc",
    "engine_impl/loopback_server/persistent_unique_client_entity.h",
    "engine_impl/model_type_connector_proxy.cc",
    "engine_impl/model_type_connector_proxy.h",
    "engine_impl/model_type_registry.cc",
    "engine_impl/model_type_registry.h",
    "engine_impl/model_type_worker.cc",
    "engine_impl/model_type_worker.h",
    "engine_impl/net/server_connection_manager.cc",
    "engine_impl/net/server_connection_manager.h",
    "engine_impl/net/sync_server_connection_manager.cc",
    "engine_impl/net/sync_server_connection_manager.h",
    "engine_impl/net/url_translator.cc",
    "engine_impl/net/url_translator.h",
    "engine_impl/non_blocking_type_commit_contribution.cc",
    "engine_impl/non_blocking_type_commit_contribution.h",
    "engine_impl/nudge_handler.cc",
    "engine_impl/nudge_handler.h",
    "engine_impl/nudge_source.cc",
    "engine_impl/nudge_source.h",
    "engine_impl/process_updates_util.cc",
    "engine_impl/process_updates_util.h",
    "engine_impl/sync_cycle_event.cc",
    "engine_impl/sync_cycle_event.h",
    "engine_impl/sync_encryption_handler_impl.cc",
    "engine_impl/sync_encryption_handler_impl.h",
    "engine_impl/sync_engine_event_listener.cc",
    "engine_impl/sync_engine_event_listener.h",
    "engine_impl/sync_manager_impl.cc",
    "engine_impl/sync_manager_impl.h",
    "engine_impl/sync_scheduler.cc",
    "engine_impl/sync_scheduler.h",
    "engine_impl/sync_scheduler_impl.cc",
    "engine_impl/sync_scheduler_impl.h",
    "engine_impl/syncer.cc",
    "engine_impl/syncer.h",
    "engine_impl/syncer_proto_util.cc",
    "engine_impl/syncer_proto_util.h",
    "engine_impl/syncer_types.h",
    "engine_impl/syncer_util.cc",
    "engine_impl/syncer_util.h",
    "engine_impl/traffic_logger.cc",
    "engine_impl/traffic_logger.h",
    "engine_impl/update_applicator.cc",
    "engine_impl/update_applicator.h",
    "engine_impl/update_handler.cc",
    "engine_impl/update_handler.h",
    "engine_impl/uss_migrator.cc",
    "engine_impl/uss_migrator.h",
    "js/js_backend.h",
    "js/js_controller.h",
    "js/js_event_details.cc",
    "js/js_event_details.h",
    "js/js_event_handler.h",
    "js/sync_js_controller.cc",
    "js/sync_js_controller.h",
    "model/blocking_model_type_store.h",
    "model/change_processor.cc",
    "model/change_processor.h",
    "model/conflict_resolution.cc",
    "model/conflict_resolution.h",
    "model/data_batch.h",
    "model/data_type_activation_request.cc",
    "model/data_type_activation_request.h",
    "model/data_type_error_handler.h",
    "model/data_type_error_handler_impl.cc",
    "model/data_type_error_handler_impl.h",
    "model/entity_change.cc",
    "model/entity_change.h",
    "model/entity_data.cc",
    "model/entity_data.h",
    "model/local_change_observer.h",
    "model/metadata_batch.cc",
    "model/metadata_batch.h",
    "model/metadata_change_list.h",
    "model/model_error.cc",
    "model/model_error.h",
    "model/model_type_change_processor.cc",
    "model/model_type_change_processor.h",
    "model/model_type_store.h",
    "model/model_type_store_base.cc",
    "model/model_type_store_base.h",
    "model/model_type_store_service.h",
    "model/model_type_sync_bridge.cc",
    "model/model_type_sync_bridge.h",
    "model/mutable_data_batch.cc",
    "model/mutable_data_batch.h",
    "model/string_ordinal.h",
    "model/sync_change.cc",
    "model/sync_change.h",
    "model/sync_change_processor.cc",
    "model/sync_change_processor.h",
    "model/sync_data.cc",
    "model/sync_data.h",
    "model/sync_error.cc",
    "model/sync_error.h",
    "model/sync_error_factory.cc",
    "model/sync_error_factory.h",
    "model/sync_merge_result.cc",
    "model/sync_merge_result.h",
    "model/sync_metadata_store.h",
    "model/syncable_service.cc",
    "model/syncable_service.h",
    "model/time.h",
    "model_impl/blocking_model_type_store_impl.cc",
    "model_impl/blocking_model_type_store_impl.h",
    "model_impl/client_tag_based_model_type_processor.cc",
    "model_impl/client_tag_based_model_type_processor.h",
    "model_impl/forwarding_model_type_controller_delegate.cc",
    "model_impl/forwarding_model_type_controller_delegate.h",
    "model_impl/in_memory_metadata_change_list.cc",
    "model_impl/in_memory_metadata_change_list.h",
    "model_impl/model_type_store_backend.cc",
    "model_impl/model_type_store_backend.h",
    "model_impl/model_type_store_impl.cc",
    "model_impl/model_type_store_impl.h",
    "model_impl/model_type_store_service_impl.cc",
    "model_impl/model_type_store_service_impl.h",
    "model_impl/processor_entity_tracker.cc",
    "model_impl/processor_entity_tracker.h",
    "model_impl/proxy_model_type_controller_delegate.cc",
    "model_impl/proxy_model_type_controller_delegate.h",
    "model_impl/sync_metadata_store_change_list.cc",
    "model_impl/sync_metadata_store_change_list.h",
    "protocol/proto_enum_conversions.cc",
    "protocol/proto_enum_conversions.h",
    "protocol/proto_memory_estimations.cc",
    "protocol/proto_memory_estimations.h",
    "protocol/proto_value_conversions.cc",
    "protocol/proto_value_conversions.h",
    "protocol/proto_visitors.h",
    "protocol/sync_protocol_error.cc",
    "protocol/sync_protocol_error.h",
    "syncable/base_node.cc",
    "syncable/base_node.h",
    "syncable/base_transaction.cc",
    "syncable/base_transaction.h",
    "syncable/change_record.cc",
    "syncable/change_record.h",
    "syncable/change_reorder_buffer.cc",
    "syncable/change_reorder_buffer.h",
    "syncable/delete_journal.cc",
    "syncable/delete_journal.h",
    "syncable/dir_open_result.h",
    "syncable/directory.cc",
    "syncable/directory.h",
    "syncable/directory_backing_store.cc",
    "syncable/directory_backing_store.h",
    "syncable/directory_change_delegate.h",
    "syncable/entry.cc",
    "syncable/entry.h",
    "syncable/entry_kernel.cc",
    "syncable/entry_kernel.h",
    "syncable/in_memory_directory_backing_store.cc",
    "syncable/in_memory_directory_backing_store.h",
    "syncable/invalid_directory_backing_store.cc",
    "syncable/invalid_directory_backing_store.h",
    "syncable/metahandle_set.h",
    "syncable/model_neutral_mutable_entry.cc",
    "syncable/model_neutral_mutable_entry.h",
    "syncable/model_type.cc",
    "syncable/mutable_entry.cc",
    "syncable/mutable_entry.h",
    "syncable/nigori_handler.cc",
    "syncable/nigori_handler.h",
    "syncable/nigori_util.cc",
    "syncable/nigori_util.h",
    "syncable/on_disk_directory_backing_store.cc",
    "syncable/on_disk_directory_backing_store.h",
    "syncable/parent_child_index.cc",
    "syncable/parent_child_index.h",
    "syncable/read_node.cc",
    "syncable/read_node.h",
    "syncable/read_transaction.cc",
    "syncable/read_transaction.h",
    "syncable/scoped_kernel_lock.cc",
    "syncable/scoped_kernel_lock.h",
    "syncable/scoped_parent_child_index_updater.cc",
    "syncable/scoped_parent_child_index_updater.h",
    "syncable/syncable_base_transaction.cc",
    "syncable/syncable_base_transaction.h",
    "syncable/syncable_base_write_transaction.cc",
    "syncable/syncable_base_write_transaction.h",
    "syncable/syncable_changes_version.h",
    "syncable/syncable_columns.h",
    "syncable/syncable_delete_journal.cc",
    "syncable/syncable_delete_journal.h",
    "syncable/syncable_enum_conversions.cc",
    "syncable/syncable_enum_conversions.h",
    "syncable/syncable_id.cc",
    "syncable/syncable_id.h",
    "syncable/syncable_model_neutral_write_transaction.cc",
    "syncable/syncable_model_neutral_write_transaction.h",
    "syncable/syncable_proto_util.cc",
    "syncable/syncable_proto_util.h",
    "syncable/syncable_read_transaction.cc",
    "syncable/syncable_read_transaction.h",
    "syncable/syncable_util.cc",
    "syncable/syncable_util.h",
    "syncable/syncable_write_transaction.cc",
    "syncable/syncable_write_transaction.h",
    "syncable/transaction_observer.h",
    "syncable/user_share.cc",
    "syncable/user_share.h",
    "syncable/write_node.cc",
    "syncable/write_node.h",
    "syncable/write_transaction.cc",
    "syncable/write_transaction.h",
    "syncable/write_transaction_info.cc",
    "syncable/write_transaction_info.h",
    "user_events/fake_user_event_service.cc",
    "user_events/fake_user_event_service.h",
    "user_events/no_op_user_event_service.cc",
    "user_events/no_op_user_event_service.h",
    "user_events/trial_recorder.cc",
    "user_events/trial_recorder.h",
    "user_events/user_event_service.cc",
    "user_events/user_event_service.h",
    "user_events/user_event_service_impl.cc",
    "user_events/user_event_service_impl.h",
    "user_events/user_event_sync_bridge.cc",
    "user_events/user_event_sync_bridge.h",
  ]

  configs += [ "//build/config:precompiled_headers" ]

  public_deps = [
    "//base",
    "//components/sync/protocol",
    "//net",
    "//third_party/leveldatabase",
    "//url",
  ]
  deps = [
    "//base:i18n",
    "//base/third_party/dynamic_annotations",
    "//components/data_use_measurement/core",
    "//components/invalidation/public",
    "//components/keyed_service/core",
    "//components/metrics",
    "//components/os_crypt",
    "//components/pref_registry",
    "//components/prefs",
    "//components/reading_list/features:reading_list_buildflags",
    "//components/signin/core/browser",
    "//components/strings",
    "//components/variations",
    "//components/version_info",
    "//crypto",
    "//google_apis",
    "//services/identity/public/cpp",
    "//services/network/public/cpp",
    "//sql",
    "//third_party/cacheinvalidation",
    "//third_party/crc32c",
    "//third_party/zlib",
    "//third_party/zlib/google:compression_utils",
    "//ui/base",
  ]

  if (is_android) {
    deps += [ "//components/sync/android:jni_headers" ]
    sources += [ "android/model_type_helper.cc" ]
  }

  if (is_chromeos) {
    # Required by get_session_name.cc on Chrome OS.
    deps += [ "//chromeos" ]
  }

  if (is_mac) {
    libs = [
      "CoreFoundation.framework",
      "SystemConfiguration.framework",  # Required by get_session_name_mac.mm.
    ]
  }

  if (!is_ios) {
    sources += [
      "driver/sync_policy_handler.cc",
      "driver/sync_policy_handler.h",
    ]
    deps += [
      "//components/policy:generated",
      "//components/policy/core/browser",
    ]
  }

  configs += [ "//build/config/compiler:wexit_time_destructors" ]
}

static_library("test_support_base") {
  testonly = true
  sources = [
    "base/fake_encryptor.cc",
    "base/fake_encryptor.h",
    "base/mock_unrecoverable_error_handler.cc",
    "base/mock_unrecoverable_error_handler.h",
    "base/model_type_test_util.cc",
    "base/model_type_test_util.h",
    "base/test_unrecoverable_error_handler.cc",
    "base/test_unrecoverable_error_handler.h",
    "js/js_test_util.cc",
    "js/js_test_util.h",
    "test/callback_counter.h",
    "test/mock_invalidation.cc",
    "test/mock_invalidation.h",
    "test/mock_invalidation_tracker.cc",
    "test/mock_invalidation_tracker.h",
    "test/test_matchers.h",
    "test/trackable_mock_invalidation.cc",
    "test/trackable_mock_invalidation.h",
  ]

  public_deps = [
    "//base",
    "//testing/gmock",
    "//testing/gtest",
  ]

  deps = [
    ":sync",
  ]

  defines = [ "SYNC_TEST" ]
  configs += [ "//build/config/compiler:wexit_time_destructors" ]
}

static_library("test_support_engine") {
  testonly = true
  sources = [
    "engine/fake_model_type_connector.cc",
    "engine/fake_model_type_connector.h",
    "engine/fake_model_type_processor.cc",
    "engine/fake_model_type_processor.h",
    "engine/fake_sync_manager.cc",
    "engine/fake_sync_manager.h",
    "engine/sync_engine_host_stub.cc",
    "engine/sync_engine_host_stub.h",
    "engine/sync_manager_factory_for_profile_sync_test.cc",
    "engine/sync_manager_factory_for_profile_sync_test.h",
    "engine/test_engine_components_factory.cc",
    "engine/test_engine_components_factory.h",
    "engine_impl/cycle/mock_debug_info_getter.cc",
    "engine_impl/cycle/mock_debug_info_getter.h",
    "engine_impl/cycle/test_util.cc",
    "engine_impl/cycle/test_util.h",
    "engine_impl/sync_manager_for_profile_sync_test.cc",
    "engine_impl/sync_manager_for_profile_sync_test.h",
    "engine_impl/test_entry_factory.cc",
    "engine_impl/test_entry_factory.h",
    "syncable/test_user_share.cc",
    "syncable/test_user_share.h",
    "test/engine/fake_model_worker.cc",
    "test/engine/fake_model_worker.h",
    "test/engine/fake_sync_scheduler.cc",
    "test/engine/fake_sync_scheduler.h",
    "test/engine/mock_connection_manager.cc",
    "test/engine/mock_connection_manager.h",
    "test/engine/mock_model_type_processor.cc",
    "test/engine/mock_model_type_processor.h",
    "test/engine/mock_model_type_worker.cc",
    "test/engine/mock_model_type_worker.h",
    "test/engine/mock_nudge_handler.cc",
    "test/engine/mock_nudge_handler.h",
    "test/engine/mock_update_handler.cc",
    "test/engine/mock_update_handler.h",
    "test/engine/single_type_mock_server.cc",
    "test/engine/single_type_mock_server.h",
    "test/engine/test_directory_setter_upper.cc",
    "test/engine/test_directory_setter_upper.h",
    "test/engine/test_id_factory.h",
    "test/engine/test_syncable_utils.cc",
    "test/engine/test_syncable_utils.h",
    "test/fake_sync_encryption_handler.cc",
    "test/fake_sync_encryption_handler.h",
    "test/null_directory_change_delegate.cc",
    "test/null_directory_change_delegate.h",
    "test/null_transaction_observer.cc",
    "test/null_transaction_observer.h",
    "test/test_directory_backing_store.cc",
    "test/test_directory_backing_store.h",
    "test/test_transaction_observer.cc",
    "test/test_transaction_observer.h",
  ]

  public_deps = [
    ":test_support_base",
  ]

  deps = [
    ":sync",
  ]

  defines = [ "SYNC_TEST" ]
  configs += [ "//build/config/compiler:wexit_time_destructors" ]
}

static_library("test_support_model") {
  testonly = true
  sources = [
    "model/data_type_error_handler_mock.cc",
    "model/data_type_error_handler_mock.h",
    "model/fake_model_type_change_processor.cc",
    "model/fake_model_type_change_processor.h",
    "model/fake_model_type_controller_delegate.cc",
    "model/fake_model_type_controller_delegate.h",
    "model/fake_model_type_sync_bridge.cc",
    "model/fake_model_type_sync_bridge.h",
    "model/fake_sync_change_processor.cc",
    "model/fake_sync_change_processor.h",
    "model/fake_syncable_service.cc",
    "model/fake_syncable_service.h",
    "model/mock_model_type_change_processor.cc",
    "model/mock_model_type_change_processor.h",
    "model/model_type_store_test_util.cc",
    "model/model_type_store_test_util.h",
    "model/recording_model_type_change_processor.cc",
    "model/recording_model_type_change_processor.h",
    "model/stub_model_type_sync_bridge.cc",
    "model/stub_model_type_sync_bridge.h",
    "model/sync_change_processor_wrapper_for_test.cc",
    "model/sync_change_processor_wrapper_for_test.h",
    "model/sync_error_factory_mock.cc",
    "model/sync_error_factory_mock.h",
    "model/test_model_type_store_service.cc",
    "model/test_model_type_store_service.h",
  ]

  defines = [ "SYNC_TEST" ]

  public_deps = [
    ":test_support_base",
  ]

  deps = [
    ":sync",
  ]
}

static_library("test_support_driver") {
  testonly = true
  sources = [
    "device_info/local_device_info_provider_mock.cc",
    "device_info/local_device_info_provider_mock.h",
    "driver/async_directory_type_controller_mock.cc",
    "driver/async_directory_type_controller_mock.h",
    "driver/data_type_controller_mock.cc",
    "driver/data_type_controller_mock.h",
    "driver/data_type_manager_mock.cc",
    "driver/data_type_manager_mock.h",
    "driver/fake_data_type_controller.cc",
    "driver/fake_data_type_controller.h",
    "driver/fake_generic_change_processor.cc",
    "driver/fake_generic_change_processor.h",
    "driver/fake_sync_client.cc",
    "driver/fake_sync_client.h",
    "driver/fake_sync_service.cc",
    "driver/fake_sync_service.h",
    "driver/frontend_data_type_controller_mock.cc",
    "driver/frontend_data_type_controller_mock.h",
    "driver/model_associator_mock.cc",
    "driver/model_associator_mock.h",
    "driver/sync_api_component_factory_mock.cc",
    "driver/sync_api_component_factory_mock.h",
    "driver/sync_client_mock.cc",
    "driver/sync_client_mock.h",
    "engine/fake_sync_engine.cc",
    "engine/fake_sync_engine.h",
    "engine/mock_sync_engine.cc",
    "engine/mock_sync_engine.h",
    "model/change_processor_mock.cc",
    "model/change_processor_mock.h",
  ]

  public_deps = [
    ":test_support_base",
  ]

  deps = [
    ":sync",
    ":test_support_engine",
    "//components/signin/core/browser:account_info",
    "//components/sync_preferences:test_support",
    "//components/version_info",
    "//google_apis",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "base/bind_to_task_runner_unittest.cc",
    "base/cancelation_signal_unittest.cc",
    "base/cryptographer_unittest.cc",
    "base/data_type_histogram_unittest.cc",
    "base/enum_set_unittest.cc",
    "base/get_session_name_unittest.cc",
    "base/hash_util_unittest.cc",
    "base/immutable_unittest.cc",
    "base/nigori_unittest.cc",
    "base/node_ordinal_unittest.cc",
    "base/ordinal_unittest.cc",
    "base/proto_value_ptr_unittest.cc",
    "base/protobuf_unittest.cc",
    "base/sync_prefs_unittest.cc",
    "base/system_encryptor_unittest.cc",
    "base/unique_position_unittest.cc",
    "base/weak_handle_unittest.cc",
    "device_info/device_count_metrics_provider_unittest.cc",
    "device_info/device_info_sync_bridge_unittest.cc",
    "device_info/device_info_util_unittest.cc",
    "device_info/local_device_info_provider_impl_unittest.cc",
    "driver/about_sync_util_unittest.cc",
    "driver/async_directory_type_controller_unittest.cc",
    "driver/backend_migrator_unittest.cc",
    "driver/data_type_manager_impl_unittest.cc",
    "driver/frontend_data_type_controller_unittest.cc",
    "driver/generic_change_processor_unittest.cc",
    "driver/glue/sync_backend_host_impl_unittest.cc",
    "driver/model_association_manager_unittest.cc",
    "driver/model_type_controller_unittest.cc",
    "driver/shared_change_processor_unittest.cc",
    "driver/startup_controller_unittest.cc",
    "driver/sync_service_utils_unittest.cc",
    "driver/sync_stopped_reporter_unittest.cc",
    "driver/sync_util_unittest.cc",
    "engine/cycle/sync_cycle_snapshot_unittest.cc",
    "engine/model_safe_worker_unittest.cc",
    "engine/net/http_bridge_unittest.cc",
    "engine/sequenced_model_worker_unittest.cc",
    "engine/sync_backend_registrar_unittest.cc",
    "engine/ui_model_worker_unittest.cc",
    "engine_impl/apply_control_data_updates_unittest.cc",
    "engine_impl/backoff_delay_provider_unittest.cc",
    "engine_impl/cycle/data_type_debug_info_emitter_unittest.cc",
    "engine_impl/cycle/nudge_tracker_unittest.cc",
    "engine_impl/cycle/status_controller_unittest.cc",
    "engine_impl/debug_info_event_listener_unittest.cc",
    "engine_impl/directory_commit_contribution_unittest.cc",
    "engine_impl/directory_update_handler_unittest.cc",
    "engine_impl/events/protocol_event_buffer_unittest.cc",
    "engine_impl/get_updates_processor_unittest.cc",
    "engine_impl/js_mutation_event_observer_unittest.cc",
    "engine_impl/js_sync_encryption_handler_observer_unittest.cc",
    "engine_impl/js_sync_manager_observer_unittest.cc",
    "engine_impl/loopback_server/loopback_server_unittest.cc",
    "engine_impl/loopback_server/persistent_bookmark_entity_unittest.cc",
    "engine_impl/loopback_server/persistent_permanent_entity_unittest.cc",
    "engine_impl/loopback_server/persistent_tombstone_entity_unittest.cc",
    "engine_impl/loopback_server/persistent_unique_client_entity_unittest.cc",
    "engine_impl/model_type_registry_unittest.cc",
    "engine_impl/model_type_worker_unittest.cc",
    "engine_impl/net/sync_server_connection_manager_unittest.cc",
    "engine_impl/non_blocking_type_commit_contribution_unittest.cc",
    "engine_impl/sync_encryption_handler_impl_unittest.cc",
    "engine_impl/sync_manager_impl_unittest.cc",
    "engine_impl/sync_scheduler_impl_unittest.cc",
    "engine_impl/syncer_proto_util_unittest.cc",
    "engine_impl/syncer_unittest.cc",
    "engine_impl/syncer_util_unittest.cc",
    "engine_impl/uss_migrator_unittest.cc",
    "js/js_event_details_unittest.cc",
    "js/sync_js_controller_unittest.cc",
    "model/entity_data_unittest.cc",
    "model/model_type_sync_bridge_unittest.cc",
    "model/mutable_data_batch_unittest.cc",
    "model/sync_change_unittest.cc",
    "model/sync_data_unittest.cc",
    "model/sync_error_unittest.cc",
    "model/sync_merge_result_unittest.cc",
    "model_impl/client_tag_based_model_type_processor_unittest.cc",
    "model_impl/in_memory_metadata_change_list_unittest.cc",
    "model_impl/model_type_store_backend_unittest.cc",
    "model_impl/model_type_store_impl_unittest.cc",
    "model_impl/processor_entity_tracker_unittest.cc",
    "protocol/proto_enum_conversions_unittest.cc",
    "protocol/proto_value_conversions_unittest.cc",
    "syncable/change_record_unittest.cc",
    "syncable/directory_backing_store_unittest.cc",
    "syncable/directory_unittest.cc",
    "syncable/directory_unittest.h",
    "syncable/entry_kernel_unittest.cc",
    "syncable/model_type_unittest.cc",
    "syncable/nigori_util_unittest.cc",
    "syncable/parent_child_index_unittest.cc",
    "syncable/syncable_delete_journal_unittest.cc",
    "syncable/syncable_enum_conversions_unittest.cc",
    "syncable/syncable_id_unittest.cc",
    "syncable/syncable_unittest.cc",
    "user_events/trial_recorder_unittest.cc",
    "user_events/user_event_service_impl_unittest.cc",
    "user_events/user_event_sync_bridge_unittest.cc",
  ]

  configs += [ "//build/config:precompiled_headers" ]

  data = [
    "//chrome/test/data/sync/",
    "//net/tools/testserver/",
    "//third_party/pyftpdlib/",
    "//third_party/pywebsocket/src/mod_pywebsocket/",
    "//third_party/tlslite/",
    "$root_out_dir/pyproto/google/",
  ]

  deps = [
    ":sync",
    ":test_support_base",
    ":test_support_driver",
    ":test_support_engine",
    ":test_support_model",
    "//base",
    "//base/test:test_support",
    "//components/invalidation/impl",
    "//components/os_crypt:test_support",
    "//components/prefs:test_support",
    "//components/signin/core/browser:test_support",
    "//components/sync_preferences",
    "//components/sync_preferences:test_support",
    "//components/variations",
    "//components/version_info",
    "//components/version_info:version_string",
    "//google_apis",
    "//google_apis:test_support",
    "//net",
    "//net:test_support",
    "//services/network:test_support",
    "//services/network/public/cpp",
    "//sql",
    "//sql:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/crc32c",
    "//third_party/leveldatabase",
    "//third_party/protobuf:protobuf_lite",
    "//third_party/zlib/google:compression_utils",
    "//url",
  ]

  if (is_chromeos) {
    # Required by get_session_name_unittest.cc on Chrome OS.
    deps += [ "//chromeos" ]
  }

  if (is_ios) {
    sources -= [ "engine/net/http_bridge_unittest.cc" ]
  }

  if (!is_ios) {
    sources += [ "driver/sync_policy_handler_unittest.cc" ]
    deps += [
      "//components/policy:generated",
      "//components/policy/core/browser",
    ]
  }

  defines = [ "SYNC_TEST" ]
}

static_library("test_support_fake_server") {
  testonly = true
  sources = [
    "test/fake_server/bookmark_entity_builder.cc",
    "test/fake_server/bookmark_entity_builder.h",
    "test/fake_server/entity_builder_factory.cc",
    "test/fake_server/entity_builder_factory.h",
    "test/fake_server/fake_server.cc",
    "test/fake_server/fake_server.h",
    "test/fake_server/fake_server_http_post_provider.cc",
    "test/fake_server/fake_server_http_post_provider.h",
    "test/fake_server/fake_server_network_resources.cc",
    "test/fake_server/fake_server_network_resources.h",
    "test/fake_server/fake_server_verifier.cc",
    "test/fake_server/fake_server_verifier.h",
    "test/fake_server/sessions_hierarchy.cc",
    "test/fake_server/sessions_hierarchy.h",
  ]

  deps = [
    ":sync",
    "//base",
    "//net",
    "//testing/gtest",
    "//url",
  ]

  public_deps = [
    "//third_party/protobuf:protobuf_lite",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]
}

if (!is_ios && !is_android && !is_fuchsia) {
  static_library("test_support_testserver") {
    testonly = true
    sources = [
      "test/local_sync_test_server.cc",
      "test/local_sync_test_server.h",
    ]

    configs += [ "//build/config/compiler:wexit_time_destructors" ]

    public_deps = [
      "//base",
      "//net:test_support",
    ]
    deps = [
      ":sync",

      # The sync test server uses Python modules generated by the sync protos.
      "//third_party/protobuf:py_proto",
    ]
  }

  executable("run_sync_testserver") {
    testonly = true
    sources = [
      "tools/testserver/run_sync_testserver.cc",
    ]

    deps = [
      ":test_support_testserver",
      "//base",
      "//base/test:test_support",
      "//build/win:default_exe_manifest",
      "//net:test_support",
      "//testing/gtest",
    ]
  }
}

if (is_android) {
  import("//build/config/android/rules.gni")

  generate_jni("fake_server_jni") {
    testonly = true
    jni_package = "sync/test/fake_server"
    sources = [
      "//chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FakeServerHelper.java",
    ]
  }

  _test_support_prepared_protos_dir =
      "$root_gen_dir/test_support_proto_java_prepare/"
  action("test_support_proto_java_prepare") {
    script = "//components/sync/protocol/prepare_protos_for_java_tests.py"
    inputs = sync_protocol_sources
    outputs = process_file_template(
            sync_protocol_sources,
            [ "$_test_support_prepared_protos_dir/{{source_file_part}}" ])
    args = [
      "--output_dir",
      rebase_path(_test_support_prepared_protos_dir, root_build_dir),
    ]
    args += rebase_path(sync_protocol_sources, root_build_dir)
  }

  proto_java_library("test_support_proto_java") {
    proto_path = _test_support_prepared_protos_dir
    sources = get_target_outputs(":test_support_proto_java_prepare")
    deps = [
      ":test_support_proto_java_prepare",
    ]
  }

  android_library("sync_java_test_support") {
    testonly = true
    deps = [
      "android:sync_java",
      "//base:base_java",
      "//third_party/junit",
    ]
    java_files = [ "test/android/javatests/src/org/chromium/components/sync/test/util/MockSyncContentResolverDelegate.java" ]
  }

  static_library("test_support_fake_server_android") {
    testonly = true
    sources = [
      "test/fake_server/android/fake_server_helper_android.cc",
      "test/fake_server/android/fake_server_helper_android.h",
    ]
    deps = [
      ":fake_server_jni",
      ":sync",
      ":test_support_fake_server",
      "//base",
      "//testing/gtest",
      "//url:url",
    ]
  }
}