chromium/components/desks_storage/BUILD.gn

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

import("//third_party/libprotobuf-mutator/fuzzable_proto_library.gni")

static_library("desks_storage") {
  output_name = "desks_storage_lib"

  sources = [
    "core/admin_template_model.h",
    "core/admin_template_service.cc",
    "core/admin_template_service.h",
    "core/desk_model.cc",
    "core/desk_model.h",
    "core/desk_model_observer.h",
    "core/desk_model_wrapper.cc",
    "core/desk_model_wrapper.h",
    "core/desk_storage_metrics_util.cc",
    "core/desk_storage_metrics_util.h",
    "core/desk_sync_bridge.cc",
    "core/desk_sync_bridge.h",
    "core/desk_sync_service.cc",
    "core/desk_sync_service.h",
    "core/desk_template_conversion.cc",
    "core/desk_template_conversion.h",
    "core/desk_template_util.cc",
    "core/desk_template_util.h",
    "core/local_desk_data_manager.cc",
    "core/local_desk_data_manager.h",
  ]
  deps = [
    "//ash/public/cpp",
    "//base",
    "//chromeos/crosapi/cpp",
    "//components/account_id",
    "//components/app_constants",
    "//components/app_restore",
    "//components/policy/core/common",
    "//components/prefs",
    "//components/sync",
    "//components/sync/model",
    "//components/sync/protocol",
    "//components/sync_device_info",
    "//components/tab_groups",
    "//components/version_info:channel",
    "//third_party/re2",
    "//ui/gfx/geometry",
  ]

  defines = [ "IS_DESKS_STORAGE_IMPL" ]

  public_deps = []
}

static_library("test_support") {
  testonly = true
  sources = [
    "core/desk_test_util.cc",
    "core/desk_test_util.h",
    "core/fake_desk_sync_bridge.cc",
    "core/fake_desk_sync_bridge.h",
    "core/fake_desk_sync_service.cc",
    "core/fake_desk_sync_service.h",
    "core/saved_desk_builder.cc",
    "core/saved_desk_builder.h",
  ]

  public_deps = [ ":desks_storage" ]

  deps = [
    "//ash/public/cpp",
    "//base",
    "//components/app_constants",
    "//components/sync:test_support",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "core/admin_template_service_unittests.cc",
    "core/desk_model_wrapper_unittests.cc",
    "core/desk_sync_bridge_unittest.cc",
    "core/desk_template_conversion_unittests.cc",
    "core/desk_template_semantics_unittests.cc",
    "core/desk_template_util_unittests.cc",
    "core/desk_test_util_unittests.cc",
    "core/local_desk_data_manager_unittests.cc",
    "core/saved_desk_test_util.cc",
    "core/saved_desk_test_util.h",
  ]
  deps = [
    ":desks_storage",
    ":test_support",
    "//ash/public/cpp",
    "//base",
    "//base/test:test_support",
    "//components/app_constants",
    "//components/prefs:test_support",
    "//components/sync:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//ui/gfx/geometry",
    "//ui/gfx/range",
  ]
}

if (use_libfuzzer) {
  fuzzer_test("desk_template_fuzzer") {
    sources = [ "core/desk_template_fuzzer.cc" ]
    seed_corpus = "fuzzer_corpus"
    deps = [
      ":desks_storage",
      ":test_support",
      "//components/account_id",
      "//components/services/app_service",
      "//components/sync:test_support",
      "//third_party/libprotobuf-mutator",
    ]
  }
}