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 = "ech_test",
    srcs = [
        "ECHTest.cpp",
    ],
    deps = [
        ":test_util",
        "//fizz/protocol/ech:encrypted_client_hello",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "encryption_test",
    srcs = [
        "EncryptionTest.cpp",
    ],
    deps = [
        ":test_util",
        "//fizz/backend:openssl",
        "//fizz/crypto:crypto",
        "//fizz/crypto/hpke:hpke",
        "//fizz/crypto/hpke:utils",
        "//fizz/crypto/test:TestUtil",
        "//fizz/protocol:default_factory",
        "//fizz/protocol/ech:encryption",
        "//fizz/protocol/test:matchers",
        "//fizz/protocol/test:mocks",
        "//fizz/protocol/test:test_util",
        "//fizz/record:record",
        "//folly/lang:bits",
    ],
)

cpp_library(
    name = "test_util",
    srcs = [
        "TestUtil.cpp",
    ],
    headers = [
        "TestUtil.h",
    ],
    deps = [
        "//fizz/backend:openssl",
        "//fizz/crypto/test:TestUtil",
        "//fizz/protocol/ech:encryption",
        "//fizz/protocol/test:test_util",
    ],
    exported_deps = [
        "//fizz/crypto/exchange:key_exchange",
        "//fizz/protocol/ech:encrypted_client_hello",
    ],
)

cpp_unittest(
    name = "decrypter_test",
    srcs = [
        "DecrypterTest.cpp",
    ],
    deps = [
        ":test_util",
        "//fizz/backend:openssl",
        "//fizz/crypto/test:TestUtil",
        "//fizz/protocol:default_factory",
        "//fizz/protocol/ech:decrypter",
        "//fizz/protocol/test:test_util",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
    ],
)
