# Copyright 2025 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("mojom") {
  generate_java = true
  sources = [ "sqlite_vfs.mojom" ]
  public_deps = [ "//mojo/public/mojom/base" ]
  shared_cpp_typemaps = [
    {
      types = [
        {
          mojom = "sqlite_vfs.mojom.PendingReadOnlyFileSet"
          cpp = "::sqlite_vfs::PendingFileSet"
          forward_declaration =
              "namespace sqlite_vfs { struct PendingFileSet; }"
          move_only = true
        },
        {
          mojom = "sqlite_vfs.mojom.PendingReadWriteFileSet"
          cpp = "::sqlite_vfs::PendingFileSet"
          forward_declaration =
              "namespace sqlite_vfs { struct PendingFileSet; }"
          move_only = true
        },
      ]
      traits_headers = [ "sqlite_vfs_mojom_traits.h" ]
      traits_public_deps = [ ":mojom_traits" ]
    },
  ]
  cpp_typemaps = shared_cpp_typemaps
  blink_cpp_typemaps = shared_cpp_typemaps
}

component("mojom_traits") {
  public = [ "sqlite_vfs_mojom_traits.h" ]
  sources = [ "sqlite_vfs_mojom_traits.cc" ]
  public_deps = [
    "//base",
    "//components/sqlite_vfs:pending_file_set",
    "//components/sqlite_vfs/mojom:mojom_shared",
  ]
  deps = [ "//mojo/public/cpp/base:shared_typemap_traits" ]
  defines = [ "IS_SQLITE_VFS_MOJOM_TRAITS_IMPL" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [ "sqlite_vfs_mojom_traits_unittest.cc" ]
  deps = [
    ":mojom",
    "//base",
    "//components/sqlite_vfs:pending_file_set",
    "//mojo/public/cpp/test_support:test_utils",
    "//testing/gtest",
  ]
}
