chromium/components/autofill/core/common/mojom/BUILD.gn

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

import("//mojo/public/tools/bindings/mojom.gni")

mojom("mojo_types") {
  generate_java = true
  sources = [ "autofill_types.mojom" ]

  public_deps = [
    "//mojo/public/mojom/base",
    "//ui/gfx/geometry/mojom",
    "//url/mojom:url_mojom_gurl",
    "//url/mojom:url_mojom_origin",
  ]

  cpp_typemaps = [
    {
      types = [
        {
          mojom = "autofill.mojom.Section"
          cpp = "::autofill::Section"
        },
        {
          mojom = "autofill.mojom.FormData"
          cpp = "::autofill::FormData"
        },
        {
          mojom = "autofill.mojom.FormDataPredictions"
          cpp = "::autofill::FormDataPredictions"
        },
        {
          mojom = "autofill.mojom.FormFieldData"
          cpp = "::autofill::FormFieldData"
        },
        {
          mojom = "autofill.mojom.FormFieldData_FillData"
          cpp = "::autofill::FormFieldData::FillData"
        },
        {
          mojom = "autofill.mojom.FormFieldDataPredictions"
          cpp = "::autofill::FormFieldDataPredictions"
        },
        {
          mojom = "autofill.mojom.FormsPredictionsMap"
          cpp = "::autofill::FormsPredictionsMap"
        },
        {
          mojom = "autofill.mojom.FormRendererId"
          cpp = "::autofill::FormRendererId"
          copyable_pass_by_value = true
        },
        {
          mojom = "autofill.mojom.FieldRendererId"
          cpp = "::autofill::FieldRendererId"
          copyable_pass_by_value = true
        },
        {
          mojom = "autofill.mojom.ParsingResult"
          cpp = "::autofill::ParsingResult"
        },
        {
          mojom = "autofill.mojom.PasswordAndMetadata"
          cpp = "::autofill::PasswordAndMetadata"
        },
        {
          mojom = "autofill.mojom.PasswordFormFieldPredictionMap"
          cpp = "::autofill::PasswordFormFieldPredictionMap"
        },
        {
          mojom = "autofill.mojom.PasswordFormFillData"
          cpp = "::autofill::PasswordFormFillData"
        },
        {
          mojom = "autofill.mojom.PasswordFormGenerationData"
          cpp = "::autofill::PasswordFormGenerationData"
        },
        {
          mojom = "autofill.mojom.PasswordGenerationUIData"
          cpp = "::autofill::password_generation::PasswordGenerationUIData"
        },
        {
          mojom = "autofill.mojom.PasswordSuggestionRequest"
          cpp = "::autofill::PasswordSuggestionRequest"
        },
      ]
      traits_headers = [ "autofill_types_mojom_traits.h" ]
      traits_sources = [ "autofill_types_mojom_traits.cc" ]
      traits_public_deps = [
        "//base",
        "//base:i18n",
        "//components/autofill/core/common",
        "//third_party/abseil-cpp:absl",
        "//ui/gfx/geometry/mojom:mojom_traits",
      ]
    },
  ]
}

mojom("mojo_test_types") {
  sources = [ "test_autofill_types.mojom" ]

  public_deps = [ ":mojo_types" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [ "autofill_types_mojom_traits_unittest.cc" ]

  public_deps = [ ":mojo_test_types" ]

  deps = [
    "//base",
    "//base/test:test_support",
    "//components/autofill/core/browser:test_support",
    "//components/password_manager/core/common",
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/test_support:test_utils",
    "//testing/gtest",
  ]
}