chromium/components/os_crypt/async/browser/BUILD.gn

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

component("browser") {
  sources = [
    "os_crypt_async.cc",
    "os_crypt_async.h",
  ]

  deps = [ ":key_provider_interface" ]

  public_deps = [
    "//base",
    "//components/os_crypt/async/common",
  ]

  defines = [ "IS_OS_CRYPT_ASYNC_IMPL" ]
}

source_set("test_support") {
  testonly = true
  sources = [
    "test_utils.cc",
    "test_utils.h",
  ]
  deps = [ "//crypto" ]
  public_deps = [ ":browser" ]
}

source_set("key_provider_interface") {
  sources = [ "key_provider.h" ]

  public_deps = [
    "//base",
    "//components/os_crypt/async/common",
  ]
}

if (is_win) {
  source_set("dpapi_key_provider") {
    sources = [
      "dpapi_key_provider.cc",
      "dpapi_key_provider.h",
    ]

    deps = [
      ":key_provider_interface",
      "//base",
      "//components/os_crypt/async/common",
      "//components/os_crypt/sync",
      "//components/prefs",
    ]

    libs = [ "crypt32.lib" ]
  }
}

source_set("unit_tests") {
  testonly = true
  sources = [ "os_crypt_async_unittest.cc" ]
  deps = [
    ":browser",
    ":key_provider_interface",
    ":test_support",
    "//base",
    "//base/test:test_support",
    "//components/os_crypt/async/common",
    "//components/os_crypt/sync",
    "//components/os_crypt/sync:test_support",
    "//crypto",
    "//testing/gtest",
  ]

  if (is_win) {
    sources += [ "dpapi_key_provider_unittest.cc" ]
    deps += [
      ":dpapi_key_provider",
      "//components/prefs:test_support",
    ]
  }
}