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

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

#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/v8_binding_for_testing.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/event_type_names.h"
#include "third_party/blink/renderer/modules/payments/payment_request.h"
#include "third_party/blink/renderer/modules/payments/payment_test_helper.h"
#include "third_party/blink/renderer/platform/bindings/exception_code.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/testing_platform_support.h"

namespace blink {
namespace {

class MockPaymentProvider : public payments::mojom::blink::PaymentRequest {};

// This test suite is about the optional total parameter of the PaymentRequest
// constructor.
class PaymentRequestOptionalTotalTest : public testing::Test {};

// This test requests a mix of app-store billing methods and normal payment
// methods. Total is required in this scenario.
TEST_F(PaymentRequestOptionalTotalTest,
       AppStoreBillingFlagEnabledTotalIsRequiredWhenMixMethods) {}

// When the DigitalGoods flag is disabled: although this test requests a
// app-store billing methods, total is required.
TEST_F(PaymentRequestOptionalTotalTest,
       AppStoreBillingFlagDisabledTotalIsRequiredWhenMixMethods) {}

// When the DigitalGoods flag is enabled: undefined total gets a place holder
// when only requesting app-store billing methods.
TEST_F(PaymentRequestOptionalTotalTest,
       AppStoreBillingFlagEnabledTotalGetPlaceHolder) {}

// When the DigitalGoods flag is disabled: undefined total is rejected.
TEST_F(PaymentRequestOptionalTotalTest,
       AppStoreBillingFlagDisabledTotalGetRejected) {}

// When the DigitalGoods flag is enabled: total get overridden when only
// requesting app-store billing methods.
TEST_F(PaymentRequestOptionalTotalTest,
       AppStoreBillingFlagEnabledTotalGetOverridden) {}

// When the DigitalGoods flag is disabled: total does not get overridden when
// only requesting app-store billing methods.
TEST_F(PaymentRequestOptionalTotalTest,
       AppStoreBillingFlagDisabledTotalNotGetOverridden) {}
}  // namespace
}  // namespace blink