load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")

oncall("secure_pipes")

cpp_unittest(
    name = "key_derivation",
    srcs = [
        "KeySchedulerTest.cpp",
    ],
    deps = [
        "//fizz/crypto/test:mocks",
        "//fizz/protocol:key_scheduler",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "cert_verifier",
    srcs = [
        "DefaultCertificateVerifierTest.cpp",
    ],
    deps = [
        ":cert_util",
        "//fizz/protocol:default_certificate_verifier",
        "//folly/portability:gtest",
        "//folly/ssl:openssl_cert_utils",
    ],
)

cpp_unittest(
    name = "handshake_context_test",
    srcs = [
        "HandshakeContextTest.cpp",
    ],
    deps = [
        "//fizz/protocol:default_factory",
        "//fizz/protocol:handshake_context",
        "//folly/portability:gtest",
    ],
)

cpp_library(
    name = "cert_test_types",
    headers = [
        "CertTestTypes.h",
    ],
    exported_deps = [
        "//fizz/backend:openssl",
        "//fizz/crypto/test:TestUtil",
        "//folly/ssl:openssl_ptr_types",
    ],
)

cpp_unittest(
    name = "cert_test",
    srcs = [
        "CertTest.cpp",
    ],
    deps = [
        ":cert_test_types",
        "//fizz/backend:openssl",
        "//fizz/crypto/test:TestUtil",
        "//folly:string",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "fizz_base_test",
    srcs = [
        "FizzBaseTest.cpp",
    ],
    deps = [
        "//fizz/protocol:fizz_base",
        "//fizz/util:variant",
        "//folly/futures:core",
        "//folly/io/async:async_socket_exception",
        "//folly/io/async/test:mocks",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "exporter_test",
    srcs = [
        "ExporterTest.cpp",
    ],
    deps = [
        "//fizz/protocol:default_factory",
        "//fizz/protocol:exporter",
        "//folly/portability:gtest",
    ],
)

cpp_library(
    name = "mocks",
    headers = [
        "Mocks.h",
    ],
    exported_deps = [
        "//fizz/crypto/aead/test:mocks",
        "//fizz/crypto/exchange/test:mocks",
        "//fizz/crypto/test:mocks",
        "//fizz/protocol:async_fizz_base",
        "//fizz/protocol:certificate",
        "//fizz/protocol:certificate_verifier",
        "//fizz/protocol:default_factory",
        "//fizz/protocol:handshake_context",
        "//fizz/protocol:key_scheduler",
        "//fizz/protocol:types",
        "//fizz/protocol/ech:decrypter",
        "//fizz/record/test:mocks",
        "//folly/io/async/test:mocks",
    ],
)

cpp_library(
    name = "cert_util",
    headers = [
        "CertUtil.h",
    ],
    exported_deps = [
        "//fizz/backend:openssl",
    ],
)

cpp_library(
    name = "matchers",
    headers = [
        "Matchers.h",
    ],
    exported_deps = [
        "//folly/io:iobuf",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "multi_backend_factory_test",
    srcs = [
        "MultiBackendFactoryTest.cpp",
    ],
    supports_static_listing = False,
    deps = [
        "//fizz/protocol:multi_backend_factory",
        "//fizz/test:handshake_test_lib",
    ],
)

cpp_library(
    name = "protocol_test",
    headers = [
        "ProtocolTest.h",
    ],
    exported_deps = [
        ":matchers",
        ":mocks",
        "//fizz/protocol:actions",
        "//fizz/record/test:mocks",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
    ],
)

cpp_library(
    name = "test_util",
    headers = [
        "TestUtil.h",
    ],
    exported_deps = [
        "//fizz/protocol:params",
        "//fizz/record:record",
    ],
)
