#include "components/trusted_vault/download_keys_response_handler.h"
#include <vector>
#include "base/strings/string_number_conversions.h"
#include "components/trusted_vault/proto/vault.pb.h"
#include "components/trusted_vault/proto_string_bytes_conversion.h"
#include "components/trusted_vault/securebox.h"
#include "components/trusted_vault/trusted_vault_connection.h"
#include "components/trusted_vault/trusted_vault_crypto.h"
#include "components/trusted_vault/trusted_vault_server_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace trusted_vault {
namespace {
ElementsAre;
Eq;
IsEmpty;
const char kEncodedPrivateKey[] = …;
std::unique_ptr<SecureBoxKeyPair> MakeTestKeyPair() { … }
void AddSecurityDomainMembership(
const std::string security_domain_path,
const SecureBoxPublicKey& member_public_key,
const std::vector<std::vector<uint8_t>>& trusted_vault_keys,
const std::vector<int>& trusted_vault_keys_versions,
const std::vector<std::vector<uint8_t>>& signing_keys,
trusted_vault_pb::SecurityDomainMember* member) { … }
std::string CreateGetSecurityDomainMemberResponseWithSyncMembership(
const std::vector<std::vector<uint8_t>>& trusted_vault_keys,
const std::vector<int>& trusted_vault_keys_versions,
const std::vector<std::vector<uint8_t>>& signing_keys) { … }
class DownloadKeysResponseHandlerTest : public testing::Test { … };
TEST_F(DownloadKeysResponseHandlerTest, ShouldHandleHttpErrors) { … }
TEST_F(DownloadKeysResponseHandlerTest, ShouldHandleSingleKeyRotation) { … }
TEST_F(DownloadKeysResponseHandlerTest, ShouldHandleMultipleKeyRotations) { … }
TEST_F(DownloadKeysResponseHandlerTest,
ShouldHandleAbsenseOfKnownKeyWhenKeyChainIsRecoverable) { … }
TEST_F(DownloadKeysResponseHandlerTest,
ShouldHandleAbsenseOfKnownKeyWhenKeyChainIsNotRecoverable) { … }
TEST_F(DownloadKeysResponseHandlerTest, ShouldHandleUndecryptableKey) { … }
TEST_F(DownloadKeysResponseHandlerTest,
ShouldHandleInvalidKeyProofOnSingleKeyRotation) { … }
TEST_F(DownloadKeysResponseHandlerTest,
ShouldHandleInvalidKeyProofOnMultipleKeyRotations) { … }
TEST_F(DownloadKeysResponseHandlerTest, ShouldHandleAbsenseOfNewKeys) { … }
TEST_F(DownloadKeysResponseHandlerTest, ShouldHandleCorruptedResponseProto) { … }
TEST_F(DownloadKeysResponseHandlerTest, ShouldHandleAbsenseOfMemberships) { … }
TEST_F(DownloadKeysResponseHandlerTest, ShouldHandleAbsenseOfSyncMembership) { … }
TEST_F(DownloadKeysResponseHandlerTest, ShouldHandleEmptyMembership) { … }
TEST_F(DownloadKeysResponseHandlerTest, ShouldHandleAllSecurityDomains) { … }
TEST_F(DownloadKeysResponseHandlerTest, ShouldHandleMultipleSecurityDomains) { … }
}
}