#include "services/network/trust_tokens/trust_token_key_commitment_parser.h"
#include "base/base64.h"
#include "base/json/json_reader.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "services/network/public/mojom/trust_tokens.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
ElementsAre;
Truly;
UnorderedElementsAre;
namespace network {
namespace {
template <typename T>
decltype(auto) EqualsMojo(const mojo::StructPtr<T>& value) { … }
}
TEST(TrustTokenKeyCommitmentParser, RejectsEmpty) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsNonemptyMalformed) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsNonDictionaryInput) { … }
TEST(TrustTokenKeyCommitmentParser, AcceptsMinimal) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsKeyWithTypeUnsafeValue) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsKeyWithTypeUnsafeKeyLabel) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsKeyWithKeyLabelTooSmall) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsKeyWithKeyLabelTooLarge) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsOtherwiseValidButNonBase64Key) { … }
TEST(TrustTokenKeyCommitmentParser, AcceptsKeyWithExpiryAndBody) { … }
TEST(TrustTokenKeyCommitmentParser, AcceptsMultipleKeys) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsKeyWithNoExpiry) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsKeyWithMalformedExpiry) { … }
TEST(TrustTokenKeyCommitmentParser, IgnoreKeyWithExpiryInThePast) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsKeyWithNoBody) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsEmptyKey) { … }
TEST(TrustTokenKeyCommitmentParser, ParsesBatchSize) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsMissingBatchSize) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsNonpositiveBatchSize) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsTypeUnsafeBatchSize) { … }
TEST(TrustTokenKeyCommitmentParser, IgnoresRequestIssuanceLocallyOn) { … }
TEST(TrustTokenKeyCommitmentParser, ParsesProtocolVersion) { … }
TEST(TrustTokenKeyCommitmentParser, ParsesMultipleProtocolVersion) { … }
TEST(TrustTokenKeyCommitmentParser,
ParsesMultipleIgnoreUnknownProtocolVersion) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsBadVersionCommitmentType) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsMissingProtocolVersion) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsMismatchedProtocolVersion) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsUnknownProtocolVersion) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsTypeUnsafeProtocolVersion) { … }
TEST(TrustTokenKeyCommitmentParser, ParsesID) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsMissingID) { … }
TEST(TrustTokenKeyCommitmentParser, RejectsTypeUnsafeID) { … }
TEST(TrustTokenKeyCommitmentParserMultipleIssuers, InvalidJson) { … }
TEST(TrustTokenKeyCommitmentParserMultipleIssuers, NotADictionary) { … }
TEST(TrustTokenKeyCommitmentParserMultipleIssuers, Empty) { … }
TEST(TrustTokenKeyCommitmentParserMultipleIssuers, UnsuitableKey) { … }
TEST(TrustTokenKeyCommitmentParserMultipleIssuers, SuitableKeyInvalidValue) { … }
TEST(TrustTokenKeyCommitmentParserMultipleIssuers, SingleIssuer) { … }
TEST(TrustTokenKeyCommitmentParserMultipleIssuers, DuplicateIssuer) { … }
TEST(TrustTokenKeyCommitmentParserMultipleIssuers, DuplicateIssuerFirstWins) { … }
TEST(TrustTokenKeyCommitmentParserMultipleIssuers,
MixOfSuitableAndUnsuitableIssuers) { … }
}