# 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.

source_set("elevated_rotation") {
  configs += [ "//components/enterprise:extra_warnings" ]

  public = [
    "key_rotation_manager.h",
    "key_rotation_types.h",
    "metrics_util.h",
  ]

  sources = [
    "key_rotation_manager.cc",
    "key_rotation_manager_impl.cc",
    "key_rotation_manager_impl.h",
    "metrics_util.cc",
  ]

  deps = [
    "//chrome/browser/enterprise/connectors/device_trust:features",
    "//chrome/browser/enterprise/connectors/device_trust/key_management/core",
    "//chrome/browser/enterprise/connectors/device_trust/key_management/core/network:common",
    "//chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence",
    "//components/enterprise/client_certificates/core",
    "//components/policy/proto",
    "//crypto",
    "//url",
  ]

  public_deps = [ "//base" ]

  # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and
  # enable the diagnostic by removing this line.
  configs += [ "//build/config/compiler:no_exit_time_destructors" ]
}

source_set("unit_tests") {
  testonly = true
  configs += [ "//components/enterprise:extra_warnings" ]

  sources = [ "key_rotation_manager_unittest.cc" ]

  deps = [
    ":elevated_rotation",
    "//base/test:test_support",
    "//chrome/browser/enterprise/connectors/device_trust:features",
    "//chrome/browser/enterprise/connectors/device_trust/key_management/core",
    "//chrome/browser/enterprise/connectors/device_trust/key_management/core/network:test_support",
    "//chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence:test_support",
    "//components/enterprise/client_certificates/core",
    "//components/enterprise/client_certificates/core:test_support",
    "//crypto",
    "//testing/gmock",
    "//testing/gtest",
    "//url",
  ]
}
