chromium/components/sync/BUILD.gn

# Copyright 2014 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/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//testing/test.gni")

group("sync") {
  public_deps = [
    "//components/sync/engine",
    "//components/sync/model",
    "//components/sync/nigori",
    "//components/sync/service",
  ]
  if (is_chromeos) {
    public_deps += [ "//components/sync/chromeos" ]
  }
}

static_library("test_support") {
  testonly = true

  sources = [
    "test/bookmark_entity_builder.cc",
    "test/bookmark_entity_builder.h",
    "test/data_type_manager_mock.cc",
    "test/data_type_manager_mock.h",
    "test/data_type_store_test_util.cc",
    "test/data_type_store_test_util.h",
    "test/data_type_test_util.cc",
    "test/data_type_test_util.h",
    "test/entity_builder_factory.cc",
    "test/entity_builder_factory.h",
    "test/fake_cryptographer.cc",
    "test/fake_cryptographer.h",
    "test/fake_data_type_connector.cc",
    "test/fake_data_type_connector.h",
    "test/fake_data_type_controller.cc",
    "test/fake_data_type_controller.h",
    "test/fake_data_type_controller_delegate.cc",
    "test/fake_data_type_controller_delegate.h",
    "test/fake_data_type_processor.cc",
    "test/fake_data_type_processor.h",
    "test/fake_data_type_sync_bridge.cc",
    "test/fake_data_type_sync_bridge.h",
    "test/fake_server.cc",
    "test/fake_server.h",
    "test/fake_server_http_post_provider.cc",
    "test/fake_server_http_post_provider.h",
    "test/fake_server_network_resources.cc",
    "test/fake_server_network_resources.h",
    "test/fake_server_nigori_helper.cc",
    "test/fake_server_nigori_helper.h",
    "test/fake_server_verifier.cc",
    "test/fake_server_verifier.h",
    "test/fake_sync_change_processor.cc",
    "test/fake_sync_change_processor.h",
    "test/fake_sync_encryption_handler.cc",
    "test/fake_sync_encryption_handler.h",
    "test/fake_sync_engine.cc",
    "test/fake_sync_engine.h",
    "test/fake_sync_engine_factory.cc",
    "test/fake_sync_engine_factory.h",
    "test/fake_sync_manager.cc",
    "test/fake_sync_manager.h",
    "test/fake_sync_scheduler.cc",
    "test/fake_sync_scheduler.h",
    "test/forwarding_data_type_local_change_processor.cc",
    "test/forwarding_data_type_local_change_processor.h",
    "test/mock_commit_queue.cc",
    "test/mock_commit_queue.h",
    "test/mock_connection_manager.cc",
    "test/mock_connection_manager.h",
    "test/mock_data_type_controller_delegate.cc",
    "test/mock_data_type_controller_delegate.h",
    "test/mock_data_type_local_change_processor.cc",
    "test/mock_data_type_local_change_processor.h",
    "test/mock_data_type_local_data_batch_uploader.cc",
    "test/mock_data_type_local_data_batch_uploader.h",
    "test/mock_data_type_processor.cc",
    "test/mock_data_type_processor.h",
    "test/mock_data_type_store.cc",
    "test/mock_data_type_store.h",
    "test/mock_data_type_worker.cc",
    "test/mock_data_type_worker.h",
    "test/mock_debug_info_getter.cc",
    "test/mock_debug_info_getter.h",
    "test/mock_invalidation.cc",
    "test/mock_invalidation.h",
    "test/mock_invalidation_tracker.cc",
    "test/mock_invalidation_tracker.h",
    "test/mock_nudge_handler.cc",
    "test/mock_nudge_handler.h",
    "test/mock_sync_engine.cc",
    "test/mock_sync_engine.h",
    "test/mock_sync_invalidations_service.cc",
    "test/mock_sync_invalidations_service.h",
    "test/mock_sync_service.cc",
    "test/mock_sync_service.h",
    "test/mock_update_handler.cc",
    "test/mock_update_handler.h",
    "test/nigori_test_utils.cc",
    "test/nigori_test_utils.h",
    "test/sessions_hierarchy.cc",
    "test/sessions_hierarchy.h",
    "test/single_type_mock_server.cc",
    "test/single_type_mock_server.h",
    "test/stub_data_type_sync_bridge.cc",
    "test/stub_data_type_sync_bridge.h",
    "test/sync_change_processor_wrapper_for_test.cc",
    "test/sync_change_processor_wrapper_for_test.h",
    "test/sync_client_mock.cc",
    "test/sync_client_mock.h",
    "test/sync_service_impl_bundle.cc",
    "test/sync_service_impl_bundle.h",
    "test/sync_user_settings_mock.cc",
    "test/sync_user_settings_mock.h",
    "test/test_data_type_store_service.cc",
    "test/test_data_type_store_service.h",
    "test/test_engine_components_factory.cc",
    "test/test_engine_components_factory.h",
    "test/test_matchers.h",
    "test/test_sync_service.cc",
    "test/test_sync_service.h",
    "test/test_sync_user_settings.cc",
    "test/test_sync_user_settings.h",
    "test/trackable_mock_invalidation.cc",
    "test/trackable_mock_invalidation.h",
  ]

  public_deps = [
    ":sync",
    "//base",
    "//components/sync/invalidations",
    "//components/sync_preferences:test_support",
    "//components/trusted_vault:test_support",
    "//services/network:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/protobuf:protobuf_lite",
  ]

  deps = [
    "//base",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//components/bookmarks/browser",
    "//components/pref_registry",
    "//components/prefs:test_support",
    "//components/signin/public/base",
    "//components/signin/public/identity_manager:test_support",
    "//components/version_info",
    "//components/version_info:generate_version_info",
    "//google_apis",
    "//net",
    "//net:test_support",
    "//services/network:test_support",
    "//services/network/public/cpp:cpp",
    "//testing/gtest",
    "//ui/gfx",
    "//url",
  ]

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

  if (is_chromeos_lacros) {
    sources += [
      "test/fake_sync_explicit_passphrase_client_ash.cc",
      "test/fake_sync_explicit_passphrase_client_ash.h",
      "test/fake_sync_mojo_service.cc",
      "test/fake_sync_mojo_service.h",
      "test/fake_sync_user_settings_client_ash.cc",
      "test/fake_sync_user_settings_client_ash.h",
      "test/fake_synced_session_client_ash.cc",
      "test/fake_synced_session_client_ash.h",
    ]

    public_deps += [
      "//chromeos/crosapi/mojom",
      "//mojo/public/cpp/bindings",
      "//testing/gmock",
    ]
  }
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "base/client_tag_hash_unittest.cc",
    "base/data_type_unittest.cc",
    "base/deletion_origin_unittest.cc",
    "base/page_transition_conversion_unittest.cc",
    "base/protobuf_unittest.cc",
    "base/sync_util_unittest.cc",
    "base/unique_position_unittest.cc",
    "base/weak_handle_unittest.cc",
    "engine/backoff_delay_provider_unittest.cc",
    "engine/bookmark_update_preprocessing_unittest.cc",
    "engine/cancelation_signal_unittest.cc",
    "engine/commit_contribution_impl_unittest.cc",
    "engine/commit_processor_unittest.cc",
    "engine/cycle/commit_quota_unittest.cc",
    "engine/cycle/nudge_tracker_unittest.cc",
    "engine/cycle/status_controller_unittest.cc",
    "engine/cycle/sync_cycle_snapshot_unittest.cc",
    "engine/data_type_registry_unittest.cc",
    "engine/data_type_worker_unittest.cc",
    "engine/debug_info_event_listener_unittest.cc",
    "engine/events/protocol_event_buffer_unittest.cc",
    "engine/get_updates_processor_unittest.cc",
    "engine/loopback_server/loopback_server_unittest.cc",
    "engine/loopback_server/persistent_bookmark_entity_unittest.cc",
    "engine/loopback_server/persistent_permanent_entity_unittest.cc",
    "engine/loopback_server/persistent_tombstone_entity_unittest.cc",
    "engine/loopback_server/persistent_unique_client_entity_unittest.cc",
    "engine/net/http_bridge_unittest.cc",
    "engine/net/sync_server_connection_manager_unittest.cc",
    "engine/nigori/cross_user_sharing_public_key_unittest.cc",
    "engine/nigori/cross_user_sharing_public_private_key_pair_unittest.cc",
    "engine/nigori/nigori_unittest.cc",
    "engine/sync_manager_impl_unittest.cc",
    "engine/sync_scheduler_impl_unittest.cc",
    "engine/syncer_proto_util_unittest.cc",
    "engine/syncer_unittest.cc",
    "invalidations/fcm_handler_unittest.cc",
    "invalidations/sync_invalidations_service_impl_unittest.cc",
    "model/client_tag_based_data_type_processor_unittest.cc",
    "model/client_tag_based_remote_update_handler_unittest.cc",
    "model/data_type_store_backend_unittest.cc",
    "model/data_type_store_impl_unittest.cc",
    "model/data_type_store_service_impl_unittest.cc",
    "model/data_type_store_with_in_memory_cache_unittest.cc",
    "model/data_type_sync_bridge_unittest.cc",
    "model/in_memory_metadata_change_list_unittest.cc",
    "model/mutable_data_batch_unittest.cc",
    "model/processor_entity_tracker_unittest.cc",
    "model/processor_entity_unittest.cc",
    "model/string_ordinal_unittest.cc",
    "model/sync_change_unittest.cc",
    "model/sync_data_unittest.cc",
    "model/sync_error_unittest.cc",
    "model/syncable_service_based_bridge_unittest.cc",
    "nigori/cross_user_sharing_keys_unittest.cc",
    "nigori/cryptographer_impl_unittest.cc",
    "nigori/keystore_keys_cryptographer_unittest.cc",
    "nigori/nigori_data_type_processor_unittest.cc",
    "nigori/nigori_key_bag_unittest.cc",
    "nigori/nigori_state_unittest.cc",
    "nigori/nigori_storage_impl_unittest.cc",
    "nigori/nigori_sync_bridge_impl_unittest.cc",
    "protocol/data_type_state_helper_unittest.cc",
    "protocol/entity_data_unittest.cc",
    "protocol/proto_enum_conversions_unittest.cc",
    "protocol/proto_value_conversions_unittest.cc",
    "service/account_pref_utils_unittest.cc",
    "service/backend_migrator_unittest.cc",
    "service/data_type_controller_unittest.cc",
    "service/data_type_manager_impl_unittest.cc",
    "service/glue/sync_engine_impl_unittest.cc",
    "service/glue/sync_transport_data_prefs_unittest.cc",
    "service/local_data_description_unittest.cc",
    "service/model_load_manager_unittest.cc",
    "service/passphrase_type_metrics_provider_unittest.cc",
    "service/sync_auth_manager_unittest.cc",
    "service/sync_feature_status_for_migrations_recorder_unittest.cc",
    "service/sync_internals_util_unittest.cc",
    "service/sync_prefs_unittest.cc",
    "service/sync_service_crypto_unittest.cc",
    "service/sync_service_impl_startup_unittest.cc",
    "service/sync_service_impl_unittest.cc",
    "service/sync_service_utils_unittest.cc",
    "service/sync_session_durations_metrics_recorder_unittest.cc",
    "service/sync_stopped_reporter_unittest.cc",
    "service/sync_user_settings_impl_unittest.cc",
    "service/syncable_service_based_data_type_controller_unittest.cc",
    "service/trusted_vault_synthetic_field_trial_unittest.cc",
  ]

  if (is_chromeos) {
    sources += [ "chromeos/explicit_passphrase_mojo_utils_unittest.cc" ]
  }

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

  data = [
    "//chrome/test/data/sync/",
    "//net/tools/testserver/",
  ]

  deps = [
    ":sync",
    ":test_support",
    "//base",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//components/gcm_driver:test_support",
    "//components/os_crypt/sync",
    "//components/os_crypt/sync:test_support",
    "//components/prefs:test_support",
    "//components/signin/public/base:test_support",
    "//components/signin/public/identity_manager:test_support",
    "//components/sync_preferences:test_support",
    "//components/trusted_vault:test_support",
    "//components/variations:test_support",
    "//components/version_info",
    "//components/version_info:generate_version_info",
    "//components/version_info:version_string",
    "//google_apis:test_support",
    "//google_apis/gcm:gcm",
    "//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",
    "//ui/base",
    "//url",
  ]

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

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