# 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/config/features.gni")

component("sync") {
  public_deps = [
    ":sync_core",
    "//sync/protocol",
  ]
}

# GYP version: sync/sync.gyp:sync_core
source_set("sync_core") {
  sources = [
    "api/attachments/attachment.cc",
    "api/attachments/attachment.h",
    "api/attachments/attachment_id.cc",
    "api/attachments/attachment_id.h",
    "api/attachments/attachment_store.cc",
    "api/attachments/attachment_store.h",
    "api/attachments/fake_attachment_store.cc",
    "api/attachments/fake_attachment_store.h",
    "api/string_ordinal.h",
    "api/syncable_service.cc",
    "api/syncable_service.h",
    "api/sync_change.cc",
    "api/sync_change.h",
    "api/sync_change_processor.cc",
    "api/sync_change_processor.h",
    "api/sync_data.cc",
    "api/sync_data.h",
    "api/sync_error.cc",
    "api/sync_error_factory.cc",
    "api/sync_error_factory.h",
    "api/sync_error.h",
    "api/sync_merge_result.cc",
    "api/sync_merge_result.h",
    "api/time.h",
    "base/sync_export.h",
    "engine/all_status.cc",
    "engine/all_status.h",
    "engine/apply_control_data_updates.cc",
    "engine/apply_control_data_updates.h",
    "engine/backoff_delay_provider.cc",
    "engine/backoff_delay_provider.h",
    "engine/commit.cc",
    "engine/commit_contribution.cc",
    "engine/commit_contribution.h",
    "engine/commit_contributor.cc",
    "engine/commit_contributor.h",
    "engine/commit.h",
    "engine/commit_processor.cc",
    "engine/commit_processor.h",
    "engine/commit_util.cc",
    "engine/commit_util.h",
    "engine/conflict_resolver.cc",
    "engine/conflict_resolver.h",
    "engine/conflict_util.cc",
    "engine/conflict_util.h",
    "engine/directory_commit_contribution.cc",
    "engine/directory_commit_contribution.h",
    "engine/directory_commit_contributor.cc",
    "engine/directory_commit_contributor.h",
    "engine/directory_update_handler.cc",
    "engine/directory_update_handler.h",
    "engine/entity_tracker.cc",
    "engine/entity_tracker.h",
    "engine/get_commit_ids.cc",
    "engine/get_commit_ids.h",
    "engine/get_updates_delegate.cc",
    "engine/get_updates_delegate.h",
    "engine/get_updates_processor.cc",
    "engine/get_updates_processor.h",
    "engine/model_type_entity.cc",
    "engine/model_type_entity.h",
    "engine/model_type_sync_proxy.cc",
    "engine/model_type_sync_proxy.h",
    "engine/model_type_sync_proxy_impl.cc",
    "engine/model_type_sync_proxy_impl.h",
    "engine/model_type_sync_worker.cc",
    "engine/model_type_sync_worker.h",
    "engine/model_type_sync_worker_impl.cc",
    "engine/model_type_sync_worker_impl.h",
    "engine/net/server_connection_manager.cc",
    "engine/net/server_connection_manager.h",
    "engine/net/url_translator.cc",
    "engine/net/url_translator.h",
    "engine/non_blocking_type_commit_contribution.cc",
    "engine/non_blocking_type_commit_contribution.h",
    "engine/nudge_handler.cc",
    "engine/nudge_handler.h",
    "engine/nudge_source.cc",
    "engine/nudge_source.h",
    "engine/process_updates_util.cc",
    "engine/process_updates_util.h",
    "engine/sync_cycle_event.cc",
    "engine/sync_cycle_event.h",
    "engine/sync_engine_event_listener.cc",
    "engine/sync_engine_event_listener.h",
    "engine/syncer.cc",
    "engine/syncer.h",
    "engine/syncer_proto_util.cc",
    "engine/syncer_proto_util.h",
    "engine/syncer_types.h",
    "engine/syncer_util.cc",
    "engine/syncer_util.h",
    "engine/sync_scheduler.cc",
    "engine/sync_scheduler.h",
    "engine/sync_scheduler_impl.cc",
    "engine/sync_scheduler_impl.h",
    "engine/traffic_logger.cc",
    "engine/traffic_logger.h",
    "engine/update_applicator.cc",
    "engine/update_applicator.h",
    "engine/update_handler.cc",
    "engine/update_handler.h",
    "internal_api/attachments/attachment_downloader.cc",
    "internal_api/attachments/attachment_downloader_impl.cc",
    "internal_api/attachments/attachment_service.cc",
    "internal_api/attachments/attachment_service_impl.cc",
    "internal_api/attachments/attachment_service_proxy.cc",
    "internal_api/attachments/attachment_service_proxy_for_test.cc",
    "internal_api/attachments/attachment_uploader.cc",
    "internal_api/attachments/attachment_uploader_impl.cc",
    "internal_api/attachments/fake_attachment_downloader.cc",
    "internal_api/attachments/fake_attachment_uploader.cc",
    "internal_api/attachments/public/attachment_downloader.h",
    "internal_api/attachments/public/attachment_service.h",
    "internal_api/attachments/public/attachment_service_impl.h",
    "internal_api/attachments/public/attachment_service_proxy_for_test.h",
    "internal_api/attachments/public/attachment_service_proxy.h",
    "internal_api/attachments/public/attachment_uploader.h",
    "internal_api/base_node.cc",
    "internal_api/base_transaction.cc",
    "internal_api/change_record.cc",
    "internal_api/change_reorder_buffer.cc",
    "internal_api/change_reorder_buffer.h",
    "internal_api/debug_info_event_listener.cc",
    "internal_api/debug_info_event_listener.h",
    "internal_api/delete_journal.cc",
    "internal_api/events/commit_request_event.cc",
    "internal_api/events/commit_response_event.cc",
    "internal_api/events/configure_get_updates_request_event.cc",
    "internal_api/events/get_updates_response_event.cc",
    "internal_api/events/normal_get_updates_request_event.cc",
    "internal_api/events/poll_get_updates_request_event.cc",
    "internal_api/events/protocol_event.cc",
    "internal_api/http_bridge.cc",
    "internal_api/http_bridge_network_resources.cc",
    "internal_api/internal_components_factory_impl.cc",
    "internal_api/js_mutation_event_observer.cc",
    "internal_api/js_mutation_event_observer.h",
    "internal_api/js_sync_encryption_handler_observer.cc",
    "internal_api/js_sync_encryption_handler_observer.h",
    "internal_api/js_sync_manager_observer.cc",
    "internal_api/js_sync_manager_observer.h",
    "internal_api/protocol_event_buffer.cc",
    "internal_api/protocol_event_buffer.h",
    "internal_api/public/attachments/attachment_downloader_impl.h",
    "internal_api/public/attachments/attachment_uploader_impl.h",
    "internal_api/public/attachments/fake_attachment_downloader.h",
    "internal_api/public/attachments/fake_attachment_uploader.h",
    "internal_api/public/base/attachment_id_proto.cc",
    "internal_api/public/base/attachment_id_proto.h",
    "internal_api/public/base/cancelation_observer.cc",
    "internal_api/public/base/cancelation_observer.h",
    "internal_api/public/base/cancelation_signal.cc",
    "internal_api/public/base/cancelation_signal.h",
    "internal_api/public/base/enum_set.h",
    "internal_api/public/base/invalidation_interface.cc",
    "internal_api/public/base/invalidation_interface.h",
    "internal_api/public/base/model_type.h",
    "internal_api/public/base_node.h",
    "internal_api/public/base/node_ordinal.cc",
    "internal_api/public/base/node_ordinal.h",
    "internal_api/public/base/ordinal.h",
    "internal_api/public/base/progress_marker_map.cc",
    "internal_api/public/base/progress_marker_map.h",
    "internal_api/public/base_transaction.h",
    "internal_api/public/base/unique_position.cc",
    "internal_api/public/base/unique_position.h",
    "internal_api/public/change_record.h",
    "internal_api/public/configure_reason.h",
    "internal_api/public/data_type_association_stats.cc",
    "internal_api/public/data_type_association_stats.h",
    "internal_api/public/data_type_debug_info_listener.cc",
    "internal_api/public/data_type_debug_info_listener.h",
    "internal_api/public/delete_journal.h",
    "internal_api/public/engine/model_safe_worker.cc",
    "internal_api/public/engine/model_safe_worker.h",
    "internal_api/public/engine/passive_model_worker.cc",
    "internal_api/public/engine/passive_model_worker.h",
    "internal_api/public/engine/polling_constants.cc",
    "internal_api/public/engine/polling_constants.h",
    "internal_api/public/engine/sync_status.cc",
    "internal_api/public/engine/sync_status.h",
    "internal_api/public/events/commit_request_event.h",
    "internal_api/public/events/commit_response_event.h",
    "internal_api/public/events/configure_get_updates_request_event.h",
    "internal_api/public/events/get_updates_response_event.h",
    "internal_api/public/events/normal_get_updates_request_event.h",
    "internal_api/public/events/poll_get_updates_request_event.h",
    "internal_api/public/events/protocol_event.h",
    "internal_api/public/http_bridge.h",
    "internal_api/public/http_bridge_network_resources.h",
    "internal_api/public/http_post_provider_factory.h",
    "internal_api/public/http_post_provider_interface.h",
    "internal_api/public/internal_components_factory.h",
    "internal_api/public/internal_components_factory_impl.h",
    "internal_api/public/network_resources.h",
    "internal_api/public/non_blocking_sync_common.cc",
    "internal_api/public/non_blocking_sync_common.h",
    "internal_api/public/read_node.h",
    "internal_api/public/read_transaction.h",
    "internal_api/public/sessions/commit_counters.cc",
    "internal_api/public/sessions/commit_counters.h",
    "internal_api/public/sessions/model_neutral_state.cc",
    "internal_api/public/sessions/model_neutral_state.h",
    "internal_api/public/sessions/status_counters.cc",
    "internal_api/public/sessions/status_counters.h",
    "internal_api/public/sessions/sync_session_snapshot.cc",
    "internal_api/public/sessions/sync_session_snapshot.h",
    "internal_api/public/sessions/type_debug_info_observer.cc",
    "internal_api/public/sessions/type_debug_info_observer.h",
    "internal_api/public/sessions/update_counters.cc",
    "internal_api/public/sessions/update_counters.h",
    "internal_api/public/shutdown_reason.h",
    "internal_api/public/sync_auth_provider.h",
    "internal_api/public/sync_context.h",
    "internal_api/public/sync_context_proxy.h",
    "internal_api/public/sync_encryption_handler.cc",
    "internal_api/public/sync_encryption_handler.h",
    "internal_api/public/sync_manager.cc",
    "internal_api/public/sync_manager_factory.h",
    "internal_api/public/sync_manager.h",
    "internal_api/public/user_share.h",
    "internal_api/public/util/experiments.h",
    "internal_api/public/util/immutable.h",
    "internal_api/public/util/report_unrecoverable_error_function.h",
    "internal_api/public/util/sync_db_util.h",
    "internal_api/public/util/syncer_error.cc",
    "internal_api/public/util/syncer_error.h",
    "internal_api/public/util/sync_string_conversions.cc",
    "internal_api/public/util/sync_string_conversions.h",
    "internal_api/public/util/unrecoverable_error_handler.h",
    "internal_api/public/util/unrecoverable_error_info.cc",
    "internal_api/public/util/unrecoverable_error_info.h",
    "internal_api/public/util/weak_handle.cc",
    "internal_api/public/util/weak_handle.h",
    "internal_api/public/write_node.h",
    "internal_api/public/write_transaction.h",
    "internal_api/read_node.cc",
    "internal_api/read_transaction.cc",
    "internal_api/syncapi_internal.cc",
    "internal_api/syncapi_internal.h",
    "internal_api/syncapi_server_connection_manager.cc",
    "internal_api/syncapi_server_connection_manager.h",
    "internal_api/sync_backup_manager.cc",
    "internal_api/sync_backup_manager.h",
    "internal_api/sync_context.cc",
    "internal_api/sync_context_proxy.cc",
    "internal_api/sync_context_proxy_impl.cc",
    "internal_api/sync_context_proxy_impl.h",
    "internal_api/sync_db_util.cc",
    "internal_api/sync_encryption_handler_impl.cc",
    "internal_api/sync_encryption_handler_impl.h",
    "internal_api/sync_manager_factory.cc",
    "internal_api/sync_manager_impl.cc",
    "internal_api/sync_manager_impl.h",
    "internal_api/sync_rollback_manager_base.cc",
    "internal_api/sync_rollback_manager_base.h",
    "internal_api/sync_rollback_manager.cc",
    "internal_api/sync_rollback_manager.h",
    "internal_api/user_share.cc",
    "internal_api/write_node.cc",
    "internal_api/write_transaction.cc",
    "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",
    "protocol/proto_enum_conversions.cc",
    "protocol/proto_enum_conversions.h",
    "protocol/proto_value_conversions.cc",
    "protocol/proto_value_conversions.h",
    "protocol/sync_protocol_error.cc",
    "protocol/sync_protocol_error.h",
    "sessions/data_type_tracker.cc",
    "sessions/data_type_tracker.h",
    "sessions/debug_info_getter.h",
    "sessions/directory_type_debug_info_emitter.cc",
    "sessions/directory_type_debug_info_emitter.h",
    "sessions/model_type_registry.cc",
    "sessions/model_type_registry.h",
    "sessions/nudge_tracker.cc",
    "sessions/nudge_tracker.h",
    "sessions/status_controller.cc",
    "sessions/status_controller.h",
    "sessions/sync_session.cc",
    "sessions/sync_session_context.cc",
    "sessions/sync_session_context.h",
    "sessions/sync_session.h",
    "syncable/blob.h",
    "syncable/deferred_on_disk_directory_backing_store.cc",
    "syncable/deferred_on_disk_directory_backing_store.h",
    "syncable/directory_backing_store.cc",
    "syncable/directory_backing_store.h",
    "syncable/directory.cc",
    "syncable/directory_change_delegate.h",
    "syncable/directory.h",
    "syncable/dir_open_result.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/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-inl.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/write_transaction_info.cc",
    "syncable/write_transaction_info.h",
    "util/cryptographer.cc",
    "util/cryptographer.h",
    "util/data_type_histogram.h",
    "util/encryptor.h",
    "util/extensions_activity.cc",
    "util/extensions_activity.h",
    "util/get_session_name.cc",
    "util/get_session_name.h",
    "util/get_session_name_ios.h",
    "util/get_session_name_ios.mm",
    "util/get_session_name_linux.cc",
    "util/get_session_name_linux.h",
    "util/get_session_name_mac.h",
    "util/get_session_name_mac.mm",
    "util/get_session_name_win.cc",
    "util/get_session_name_win.h",
    "util/logging.cc",
    "util/logging.h",
    "util/nigori.cc",
    "util/nigori.h",
    "util/time.cc",
    "util/time.h",
  ]

  deps = [
    "//base",
    "//base:i18n",
    "//base/third_party/dynamic_annotations",
    "//crypto",
    "//google_apis",
    "//net",
    "//sql",
    "//third_party/zlib",
    "//url",
    "//sync/protocol",
  ]

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

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

# GYP version: sync/sync_tests.gypi:test_support_sync_core
static_library("test_support_sync_core") {
  testonly = true
  sources = [
    "internal_api/public/base/model_type_test_util.cc",
    "internal_api/public/base/model_type_test_util.h",
    "js/js_test_util.cc",
    "js/js_test_util.h",
    "sessions/test_util.cc",
    "sessions/test_util.h",
    "test/callback_counter.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/injectable_sync_context_proxy.cc",
    "test/engine/injectable_sync_context_proxy.h",
    "test/engine/mock_connection_manager.cc",
    "test/engine/mock_connection_manager.h",
    "test/engine/mock_model_type_sync_proxy.cc",
    "test/engine/mock_model_type_sync_proxy.h",
    "test/engine/mock_model_type_sync_worker.cc",
    "test/engine/mock_model_type_sync_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_encryptor.cc",
    "test/fake_encryptor.h",
    "test/fake_sync_encryption_handler.cc",
    "test/fake_sync_encryption_handler.h",
    "test/mock_invalidation.cc",
    "test/mock_invalidation.h",
    "test/mock_invalidation_tracker.cc",
    "test/mock_invalidation_tracker.h",
    "test/trackable_mock_invalidation.cc",
    "test/trackable_mock_invalidation.h",
    "test/null_directory_change_delegate.cc",
    "test/null_directory_change_delegate.h",
    "test/null_transaction_observer.cc",
    "test/null_transaction_observer.h",
    "test/sessions/test_scoped_session_event_listener.h",
    "test/sessions/mock_debug_info_getter.h",
    "test/sessions/mock_debug_info_getter.cc",
    "test/test_directory_backing_store.cc",
    "test/test_directory_backing_store.h",
    "test/test_transaction_observer.cc",
    "test/test_transaction_observer.h",
    "util/test_unrecoverable_error_handler.cc",
    "util/test_unrecoverable_error_handler.h",
  ]

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

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

# GYP version: sync/sync_tests.gypi:test_support_sync_internal_api
static_library("test_support_sync_internal_api") {
  testonly = true
  sources = [
    "internal_api/public/test/fake_sync_manager.h",
    "internal_api/public/test/null_sync_context_proxy.h",
    "internal_api/public/test/sync_manager_factory_for_profile_sync_test.h",
    "internal_api/public/test/test_entry_factory.h",
    "internal_api/public/test/test_internal_components_factory.h",
    "internal_api/public/test/test_user_share.h",
    "internal_api/test/fake_sync_manager.cc",
    "internal_api/test/null_sync_context_proxy.cc",
    "internal_api/test/sync_manager_factory_for_profile_sync_test.cc",
    "internal_api/test/sync_manager_for_profile_sync_test.cc",
    "internal_api/test/sync_manager_for_profile_sync_test.h",
    "internal_api/test/test_entry_factory.cc",
    "internal_api/test/test_internal_components_factory.cc",
    "internal_api/test/test_user_share.cc",
  ]

  public_deps = [
    "//base",
    "//testing/gtest",
    "//sync",
    ":test_support_sync_core",
  ]

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

# GYP version: sync/sync_tests.gypi:test_support_sync_api
static_library("test_support_sync_api") {
  testonly = true
  sources = [
    "api/fake_syncable_service.cc",
    "api/fake_syncable_service.h",
    "api/fake_sync_change_processor.cc",
    "api/fake_sync_change_processor.h",
    "api/sync_change_processor_wrapper_for_test.cc",
    "api/sync_change_processor_wrapper_for_test.h",
    "api/sync_error_factory_mock.cc",
    "api/sync_error_factory_mock.h",
  ]

  defines = [ "SYNC_TEST" ]

  public_deps = [
    "//testing/gmock",
    "//sync",
  ]
}

# GYP version: sync/sync_tests.gypi:sync_unit_tests
test("sync_unit_tests") {
  sources = [
    "api/attachments/attachment_id_unittest.cc",
    "api/attachments/attachment_unittest.cc",
    "api/sync_change_unittest.cc",
    "api/sync_data_unittest.cc",
    "api/sync_error_unittest.cc",
    "api/sync_merge_result_unittest.cc",
    "engine/apply_control_data_updates_unittest.cc",
    "engine/backoff_delay_provider_unittest.cc",
    "engine/directory_commit_contribution_unittest.cc",
    "engine/directory_update_handler_unittest.cc",
    "engine/entity_tracker_unittest.cc",
    "engine/get_updates_processor_unittest.cc",
    "engine/model_type_entity_unittest.cc",
    "engine/model_type_sync_proxy_impl_unittest.cc",
    "engine/model_type_sync_worker_impl_unittest.cc",
    "engine/sync_scheduler_unittest.cc",
    "engine/syncer_proto_util_unittest.cc",
    "engine/syncer_unittest.cc",
    "engine/syncer_util_unittest.cc",
    "internal_api/attachments/attachment_downloader_impl_unittest.cc",
    "internal_api/attachments/attachment_service_impl_unittest.cc",
    "internal_api/attachments/attachment_service_proxy_unittest.cc",
    "internal_api/attachments/attachment_uploader_impl_unittest.cc",
    "internal_api/attachments/fake_attachment_downloader_unittest.cc",
    "internal_api/attachments/fake_attachment_uploader_unittest.cc",
    "internal_api/debug_info_event_listener_unittest.cc",
    "internal_api/http_bridge_unittest.cc",
    "internal_api/js_mutation_event_observer_unittest.cc",
    "internal_api/js_sync_encryption_handler_observer_unittest.cc",
    "internal_api/js_sync_manager_observer_unittest.cc",
    "internal_api/protocol_event_buffer_unittest.cc",
    "internal_api/public/base/attachment_id_proto_unittest.cc",
    "internal_api/public/base/cancelation_signal_unittest.cc",
    "internal_api/public/base/enum_set_unittest.cc",
    "internal_api/public/base/node_ordinal_unittest.cc",
    "internal_api/public/base/ordinal_unittest.cc",
    "internal_api/public/base/unique_position_unittest.cc",
    "internal_api/public/change_record_unittest.cc",
    "internal_api/public/engine/model_safe_worker_unittest.cc",
    "internal_api/public/sessions/sync_session_snapshot_unittest.cc",
    "internal_api/public/util/immutable_unittest.cc",
    "internal_api/public/util/weak_handle_unittest.cc",
    "internal_api/sync_backup_manager_unittest.cc",
    "internal_api/sync_context_proxy_impl_unittest.cc",
    "internal_api/sync_encryption_handler_impl_unittest.cc",
    "internal_api/sync_manager_impl_unittest.cc",
    "internal_api/sync_rollback_manager_base_unittest.cc",
    "internal_api/sync_rollback_manager_unittest.cc",
    "internal_api/syncapi_server_connection_manager_unittest.cc",
    "js/js_event_details_unittest.cc",
    "js/sync_js_controller_unittest.cc",
    "protocol/proto_enum_conversions_unittest.cc",
    "protocol/proto_value_conversions_unittest.cc",
    "sessions/model_type_registry_unittest.cc",
    "sessions/nudge_tracker_unittest.cc",
    "sessions/status_controller_unittest.cc",
    "syncable/deferred_on_disk_directory_backing_store_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_enum_conversions_unittest.cc",
    "syncable/syncable_id_unittest.cc",
    "syncable/syncable_unittest.cc",
    "syncable/syncable_util_unittest.cc",
    "util/cryptographer_unittest.cc",
    "util/data_type_histogram_unittest.cc",
    "util/get_session_name_unittest.cc",
    "util/nigori_unittest.cc",
    "util/protobuf_unittest.cc",
  ]

  deps = [
    "//base",
    "//base/allocator",
    "//base/test:run_all_unittests",
    "//google_apis",
    "//google_apis:test_support",
    "//net",
    "//net:test_support",
    "//sql",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/protobuf:protobuf_lite",
    "//sync",
    ":test_support_sync_core",
    ":test_support_sync_internal_api",
  ]

  # TODO(GYP)
  #   ['OS == "android"', {
  #     'dependencies': [
  #       '../testing/android/native_test.gyp:native_test_native_code',
  #     ],
  #   }],

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

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

  defines = [ "SYNC_TEST" ]
}

# GYP version: sync/sync_tests.gypi:test_support_sync_fake_server
static_library("test_support_sync_fake_server") {
  testonly = true
  sources = [
    "test/fake_server/bookmark_entity.cc",
    "test/fake_server/bookmark_entity.h",
    "test/fake_server/bookmark_entity_builder.cc",
    "test/fake_server/bookmark_entity_builder.h",
    "test/fake_server/entity_builder.cc",
    "test/fake_server/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_entity.cc",
    "test/fake_server/fake_server_entity.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/permanent_entity.cc",
    "test/fake_server/permanent_entity.h",
    "test/fake_server/tombstone_entity.cc",
    "test/fake_server/tombstone_entity.h",
    "test/fake_server/unique_client_entity.cc",
    "test/fake_server/unique_client_entity.h",
  ]

  deps = [
    "//base",
    "//net",
    "//testing/gtest",
    "//third_party/protobuf:protobuf_lite",
    "//sync",
  ]

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

# GYP version: sync/sync_tests.gypi:test_support_sync_testserver
static_library("test_support_sync_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/protobuf.gyp:py_proto',  # TODO(GYP)
  ]
}

# GYP version: sync/sync_tests.gypi:test_support_accounts_client
static_library("test_support_accounts_client") {
  testonly = true
  sources = [
    "test/accounts_client/test_accounts_client.cc",
    "test/accounts_client/test_accounts_client.h",
    "test/accounts_client/url_request_context_getter.cc",
    "test/accounts_client/url_request_context_getter.h",
  ]
  deps = [
    "//base",
    "//net",
  ]
}

# GYP version: sync/sync_tests.gypi:sync_endtoend_tests
test("sync_endtoend_tests") {
  sources = [
    "test/accounts_client/test_accounts_client_unittest.cc",
  ]
  deps = [
    "//base/test:run_all_unittests",
    "//testing/gmock",
    "//testing/gtest",
    "//url",
    ":test_support_accounts_client",
  ]
}

if (!is_ios) {
  # GYP version: sync/sync_tests.gypi:run_sync_testserver
  executable("run_sync_testserver") {
    testonly = true
    sources = [ "tools/testserver/run_sync_testserver.cc" ]

    deps = [
      "//base",
      "//base/test:test_support",
      "//net:test_support",
      "//testing/gtest",
      ":test_support_sync_testserver",
    ]
  }
}

#TODO(GYP): Need to port sync_android.gypi and Android test targets.