chromium/chrome/browser/payments/secure_payment_confirmation_authenticator_browsertest.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 "base/json/json_reader.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/payments/secure_payment_confirmation_browsertest.h"
#include "components/autofill/core/browser/test_event_waiter.h"
#include "components/payments/content/secure_payment_confirmation_app.h"
#include "components/payments/core/journey_logger.h"
#include "components/payments/core/secure_payment_confirmation_metrics.h"
#include "content/public/browser/scoped_authenticator_environment_for_testing.h"
#include "content/public/test/browser_test.h"
#include "device/fido/virtual_fido_device_factory.h"
#include "testing/gtest/include/gtest/gtest.h"

// Authenticator tests do not work on Android because there is not currently a
// way to install a virtual authenticator.
#if BUILDFLAG(IS_ANDROID)
#error "These tests are unsupported on Android"
#endif

// TODO(crbug.com/40870879): Temporarily disable the tests on macOS since they
// do not yet work with current WebAuthn UI.
#if !BUILDFLAG(IS_MAC)

namespace payments {
namespace {

Event2;

struct PaymentCredentialInfo {};

// Base class for Secure Payment Confirmation tests that use a virtual FIDO
// authenticator in order to test the end-to-end flow.
class SecurePaymentConfirmationAuthenticatorTestBase
    : public SecurePaymentConfirmationTest,
      public content::WebContentsObserver {};

SecurePaymentConfirmationAuthenticatorCreateTest;

IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationAuthenticatorCreateTest,
                       CreatePaymentCredential) {}

// b.com cannot create a credential with RP = "a.com".
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationAuthenticatorCreateTest,
                       RelyingPartyIsEnforced) {}

IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationAuthenticatorCreateTest,
                       WebContentsClosedDuringEnrollmentOSPrompt) {}

class SecurePaymentConfirmationAuthenticatorCreateDisableDebugTest
    : public SecurePaymentConfirmationAuthenticatorCreateTest {};

IN_PROC_BROWSER_TEST_F(
    SecurePaymentConfirmationAuthenticatorCreateDisableDebugTest,
    RequireUserVerifyingPlatformAuthenticator) {}

SecurePaymentConfirmationAuthenticatorGetTest;

IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationAuthenticatorGetTest,
                       ConfirmPaymentInCrossOriginIframe) {}

IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationAuthenticatorGetTest,
                       ConfirmPaymentInCrossOriginIframeWithPayeeName) {}

IN_PROC_BROWSER_TEST_F(
    SecurePaymentConfirmationAuthenticatorGetTest,
    ConfirmPaymentInCrossOriginIframeWithPayeeNameAndOrigin) {}

// Test allowing a failed icon download with iconMustBeShown option
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationAuthenticatorGetTest,
                       IconMustBeShownFalse) {}

IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationAuthenticatorGetTest,
                       MultipleRegisteredCredentials) {}

IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationAuthenticatorGetTest,
                       UserVerificationFails) {}

IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationAuthenticatorGetTest,
                       HandlesShowPromisesAndModifiers) {}

}  // namespace
}  // namespace payments

#endif  // !BUILDFLAG(IS_MAC)