chromium/third_party/blink/renderer/modules/payments/secure_payment_confirmation_helper_test.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/modules/payments/secure_payment_confirmation_helper.h"

#include "base/compiler_specific.h"
#include "base/containers/span.h"
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/payments/payment_request.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_arraybuffer_arraybufferview.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_authentication_extensions_client_inputs.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_authentication_extensions_prf_inputs.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_authentication_extensions_prf_values.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_network_or_issuer_information.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_payment_credential_instrument.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_secure_payment_confirmation_request.h"
#include "third_party/blink/renderer/modules/payments/payment_test_helper.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"

namespace blink {

namespace {

static const uint8_t kPrfInputData[] =;

WTF::Vector<uint8_t> CreateVector(const uint8_t* buffer,
                                  const unsigned length) {}

static V8UnionArrayBufferOrArrayBufferView* ArrayBufferOrView(
    const uint8_t* data,
    size_t size) {}

static AuthenticationExtensionsPRFInputs* CreatePrfInputs(
    v8::Isolate* isolate) {}

}  // namespace

// Test that parsing a valid SecurePaymentConfirmationRequest succeeds and
// correctly copies the fields to the mojo output.
TEST(SecurePaymentConfirmationHelperTest, Parse_Success) {}

// Test that optional fields are correctly copied to the mojo output.
TEST(SecurePaymentConfirmationHelperTest, Parse_OptionalFields) {}

// Test that parsing a SecurePaymentConfirmationRequest with an empty
// credentialIds field throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_EmptyIdCredentialIds) {}

// Test that parsing a SecurePaymentConfirmationRequest with an empty ID inside
// the credentialIds field throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_EmptyId) {}

// Test that parsing a SecurePaymentConfirmationRequest with an empty challenge
// throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_EmptyChallenge) {}

// Test that parsing a SecurePaymentConfirmationRequest with an empty instrument
// displayName throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_EmptyInstrumentDisplayName) {}

// Test that parsing a SecurePaymentConfirmationRequest with an empty
// instrument icon throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_EmptyInstrumentIcon) {}

// Test that parsing a SecurePaymentConfirmationRequest with an invalid
// instrument icon URL throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_InvalidInstrumentIcon) {}

// Test that parsing a SecurePaymentConfirmationRequest with an invalid RP
// domain throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_InvalidRpId) {}

// Test that parsing a SecurePaymentConfirmationRequest with neither a payeeName
// or payeeOrigin throws.
TEST(SecurePaymentConfirmationHelperTest,
     Parse_MissingPayeeNameAndPayeeOrigin) {}

// Test that parsing a SecurePaymentConfirmationRequest with an empty payeeName
// throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_EmptyPayeeName) {}

// Test that parsing a SecurePaymentConfirmationRequest with an empty
// payeeOrigin throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_EmptyPayeeOrigin) {}

// Test that parsing a SecurePaymentConfirmationRequest with an invalid
// payeeOrigin URL throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_InvalidPayeeOrigin) {}

// Test that parsing a SecurePaymentConfirmationRequest with a non-https
// payeeOrigin URL throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_NotHttpsPayeeOrigin) {}

// Test that extensions are converted while parsing a
// SecurePaymentConfirmationRequest.
TEST(SecurePaymentConfirmationHelperTest, Parse_Extensions) {}

// Test that parsing a SecurePaymentConfirmationRequest with an empty
// networkName throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_EmptyNetworkName) {}

// Test that parsing a SecurePaymentConfirmationRequest with an empty
// network icon throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_EmptyNetworkIcon) {}

// Test that parsing a SecurePaymentConfirmationRequest with an invalid
// network icon URL throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_InvalidNetworkIcon) {}

// Test that parsing a SecurePaymentConfirmationRequest with an empty
// issuerName throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_EmptyIssuerName) {}

// Test that parsing a SecurePaymentConfirmationRequest with an empty
// issuer icon throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_EmptyIssuerIcon) {}

// Test that parsing a SecurePaymentConfirmationRequest with an invalid
// issuer icon URL throws.
TEST(SecurePaymentConfirmationHelperTest, Parse_InvalidIssuerIcon) {}

}  // namespace blink