load("@fbsource//xplat/fizz:defs.bzl", "fizz_cpp_library", "fizz_cpp_unittest")

oncall("secure_pipes")

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

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

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

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

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

fizz_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",
    ],
)

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

fizz_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",
    ],
)

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

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

fizz_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",
    ],
)

fizz_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",
    ],
)

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