#include "components/os_crypt/async/browser/os_crypt_async.h"
#include <optional>
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/gtest_util.h"
#include "base/test/task_environment.h"
#include "components/os_crypt/async/browser/key_provider.h"
#include "components/os_crypt/async/browser/test_utils.h"
#include "components/os_crypt/async/common/algorithm.mojom.h"
#include "components/os_crypt/async/common/encryptor.h"
#include "components/os_crypt/sync/os_crypt.h"
#include "components/os_crypt/sync/os_crypt_mocker.h"
#include "crypto/hkdf.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_LINUX)
#include "components/os_crypt/sync/key_storage_linux.h"
#endif
namespace os_crypt_async {
namespace {
[[nodiscard]] bool MaybeVerifyFailedDecryptOperation(
const std::optional<std::string>& decrypted,
base::span<const uint8_t> ciphertext) { … }
}
class OSCryptAsyncTest : public ::testing::Test { … };
class TestKeyProvider : public KeyProvider { … };
TEST_F(OSCryptAsyncTest, EncryptHeader) { … }
TEST_F(OSCryptAsyncTest, TwoProvidersBothEnabled) { … }
TEST_F(OSCryptAsyncTest, TwoProvidersOneEnabled) { … }
TEST_F(OSCryptAsyncTest, EncryptorOption) { … }
class SlowTestKeyProvider : public TestKeyProvider { … };
TEST_F(OSCryptAsyncTest, MultipleCalls) { … }
TEST_F(OSCryptAsyncTest, SubscriptionCancelled) { … }
TEST_F(OSCryptAsyncTest, TestOSCryptAsyncInterface) { … }
TEST_F(OSCryptAsyncTest, TestEncryptorInterface) { … }
class FailingKeyProvider : public TestKeyProvider { … };
class OSCryptAsyncTestWithOSCrypt : public OSCryptAsyncTest { … };
TEST_F(OSCryptAsyncTestWithOSCrypt, Empty) { … }
TEST_F(OSCryptAsyncTestWithOSCrypt, FailingKeyProvider) { … }
TEST_F(OSCryptAsyncTestWithOSCrypt, EncryptorOption) { … }
OSCryptAsyncDeathTest;
TEST_F(OSCryptAsyncDeathTest, SamePrecedence) { … }
TEST_F(OSCryptAsyncDeathTest, SameName) { … }
TEST_F(OSCryptAsyncDeathTest, OverlappingNames) { … }
TEST_F(OSCryptAsyncDeathTest, OverlappingNamesBackwards) { … }
TEST_F(OSCryptAsyncTest, NoCrashWithLongNames) { … }
}