chromium/components/payments/core/has_enrolled_instrument_query_unittest.cc

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

#include "components/payments/core/has_enrolled_instrument_query.h"

#include "base/test/task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace payments {
namespace {

class HasEnrolledInstrumentQueryTest : public ::testing::Test {};

// An HTTPS website is not allowed to query all of the networks of the cards in
// user's autofill database.
TEST_F(HasEnrolledInstrumentQueryTest,
       SameHttpsOriginCannotQueryTwoDifferentCardNetworks) {}

// A localhost website is not allowed to query all of the networks of the cards
// in user's autofill database.
TEST_F(HasEnrolledInstrumentQueryTest,
       SameLocalhostOriginCannotQueryTwoDifferentCardNetworks) {}

// A file website is not allowed to query all of the networks of the cards in
// user's autofill database.
TEST_F(HasEnrolledInstrumentQueryTest,
       SameFileOriginCannotQueryTwoDifferentCardNetworks) {}

// Different HTTPS websites are allowed to query different card networks in
// user's autofill database.
TEST_F(HasEnrolledInstrumentQueryTest,
       DifferentHttpsOriginsCanQueryTwoDifferentCardNetworks) {}

// Different localhost websites are allowed to query different card networks in
// user's autofill database.
TEST_F(HasEnrolledInstrumentQueryTest,
       DifferentLocalhostOriginsCanQueryTwoDifferentCardNetworks) {}

// Different file websites are allowed to query different card networks in
// user's autofill database.
TEST_F(HasEnrolledInstrumentQueryTest,
       DifferentFileOriginsCanQueryTwoDifferentCardNetworks) {}

// The same website is not allowed to query the same payment method with
// different parameters.
TEST_F(HasEnrolledInstrumentQueryTest,
       SameOriginCannotQueryBasicCardWithTwoDifferentCardNetworks) {}

// Two different websites are allowed to query the same payment method with
// different parameters.
TEST_F(HasEnrolledInstrumentQueryTest,
       DifferentOriginsCanQueryBasicCardWithTwoDifferentCardNetworks) {}

// A website can query several different payment methods, as long as each
// payment method is queried with the same payment-method-specific data.
TEST_F(HasEnrolledInstrumentQueryTest,
       SameOriginCanQuerySeveralDifferentPaymentMethodIdentifiers) {}

// A website cannot query several different payment methods without the
// per-method quota, even if method-specific data remains unchanged.
TEST_F(HasEnrolledInstrumentQueryTest,
       SameOriginCannotQueryDifferentMethodsWithoutPerMethodQuota) {}

// An instance of a website with per-method quota enabled (e.g., through an
// origin trial) can query different payment methods, as long as each payment
// method is queried with the same method-specific data. Another instance of the
// same website (e.g., in a different tab) without the per-method quota feature
// cannot query different payment methods.
TEST_F(HasEnrolledInstrumentQueryTest, SameWebsiteDifferentQuotaPolicy) {}

}  // namespace
}  // namespace payments