#include "content/browser/webid/digital_credentials/digital_identity_request_impl.h"
#include <optional>
#include "base/json/json_reader.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "content/browser/webid/test/stub_digital_identity_provider.h"
#include "content/public/common/content_features.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace content {
namespace {
InterstitialType;
class TestDigitalIdentityProviderWithCustomRisk
: public StubDigitalIdentityProvider { … };
base::Value ParseJsonAndCheck(const std::string& json) { … }
base::Value GenerateOnlyAgeOpenid4VpRequest() { … }
base::Value GenerateOnlyAgePreviewRequest() { … }
base::Value* FindValueWithKey(base::Value& root, const std::string& find_key) { … }
bool HasNoListElements(const base::Value* value) { … }
bool IsNonEmptyList(const base::Value* value) { … }
void RemoveDictKey(base::Value::Dict& dict, const std::string& find_key) { … }
bool SetPathItem(base::Value& to_modify, const std::string& path_item) { … }
bool SetFieldNameValue(base::Value& to_modify,
const std::string& field_name_value) { … }
std::optional<InterstitialType> ComputeInterstitialType(Protocol protocol,
base::Value request) { … }
}
class DigitalIdentityRequestImplTest : public testing::Test { … };
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_OnlyAgeOver) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_OnlyAgeInYears) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeIntersitialType_OnlyAgeBirthYear) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeIntersitialType_OnlyBirthDate) { … }
base::Value GenerateNonAgeOpenid4VpRequest() { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeIntersitialType_OnlyNonAgeDataElement) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_LowRiskOriginTakesPrecedenceOverRequestType) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_EmptyPathList) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_RequestMultiplePaths) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_NoPath) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_EmptyFieldsList) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_RequestMultipleAgeAssertions) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_RequestMultipleFields) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_NoConstraints) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_EmptyInputDescriptorList) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_RequestMultipleDocuments) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_NonMdlInputDescriptorId) { … }
TEST_F(DigitalIdentityRequestImplTest,
Openid4VpProtocol_ComputeInterstitialType_NoPresentationDefinition) { … }
TEST_F(DigitalIdentityRequestImplTest,
PreviewProtocol_ComputeInterstitialType_OnlyAgeOver) { … }
TEST_F(DigitalIdentityRequestImplTest,
PreviewProtocol_ComputeInterstitialType_OnlyAgeInYears) { … }
TEST_F(DigitalIdentityRequestImplTest,
PreviewProtocol_ComputeIntersitialType_OnlyAgeBirthYear) { … }
TEST_F(DigitalIdentityRequestImplTest,
PreviewProtocol_ComputeIntersitialType_OnlyBirthDate) { … }
TEST_F(DigitalIdentityRequestImplTest,
PreviewProtocol_ComputeIntersitialType_GivenName) { … }
}