Commit 44459698 authored by Liquan (Max) Gu's avatar Liquan (Max) Gu Committed by Commit Bot

[PlayBilling] Merge PaymentRequestOptionalTotal flag to DigitalGoods

Before:
We had PaymentRequestOptionalTotal flag in runtime-enabled flag,
base-feature in components/, base-feature in content/.

After:
We don't have PaymentRequestOptionalTotal anymore. The original
PaymentRequestOptionalTotal flag callers call the DigitalGood flag
instead.

Change:
* Remove unnecessary OptionalTotal flag. Since the CL[1] introduced the
PaymentRequestOptionalTotal flag in unnecessary places, this CL removes
those unnecessary occurrences.
* Merge the PaymentRequestOptionalTotal flag to DigitalGoods flag

[1] https://chromium-review.googlesource.com/c/chromium/src/+/2150974

Bug: 1066531

Change-Id: I67ac986442f805bbac156e45cb3353edf658c245
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2222909Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Reviewed-by: default avatarLiquan (Max) Gu <maxlg@chromium.org>
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774948}
parent 8400e57d
......@@ -53,9 +53,6 @@ const base::Feature kStrictHasEnrolledAutofillInstrument{
const base::Feature kPaymentRequestSkipToGPay{
"PaymentRequestSkipToGPay", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kPaymentRequestOptionalTotal{
"PaymentRequestOptionalTotal", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kPaymentRequestSkipToGPayIfNoCard{
"PaymentRequestSkipToGPayIfNoCard", base::FEATURE_DISABLED_BY_DEFAULT};
......
......@@ -64,9 +64,6 @@ extern const base::Feature kPaymentRequestSkipToGPay;
// eligible credit card.
extern const base::Feature kPaymentRequestSkipToGPayIfNoCard;
// Enables the total field of PaymentRequest API to be optional.
extern const base::Feature kPaymentRequestOptionalTotal;
// If enabled, just-in-time installable payment handlers are ranked lower than
// complete autofill instruments in payment sheet's method selection section.
extern const base::Feature kDownRankJustInTimePaymentApp;
......
......@@ -228,8 +228,6 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
{wf::EnablePaymentRequest, features::kWebPayments, kUseFeatureState},
{wf::EnablePaymentHandlerMinimalUI, features::kWebPaymentsMinimalUI,
kEnableOnly},
{wf::EnablePaymentRequestOptionalTotal,
features::kPaymentRequestOptionalTotal, kEnableOnly},
{wf::EnablePaymentApp, features::kServiceWorkerPaymentApps, kEnableOnly},
{wf::EnableGenericSensorExtraClasses, features::kGenericSensorExtraClasses,
kEnableOnly},
......
......@@ -814,10 +814,6 @@ const base::Feature kWebPayments{"WebPayments",
const base::Feature kWebPaymentsMinimalUI{"WebPaymentsMinimalUI",
base::FEATURE_DISABLED_BY_DEFAULT};
// Allows the total field of PaymentRequest API to be optional.
const base::Feature kPaymentRequestOptionalTotal{
"PaymentRequestOptionalTotal", base::FEATURE_DISABLED_BY_DEFAULT};
// Makes WebRTC use ECDSA certs by default (i.e., when no cert type was
// specified in JS).
const base::Feature kWebRtcEcdsaDefault{"WebRTC-EnableWebRtcEcdsa",
......
......@@ -93,7 +93,6 @@ CONTENT_EXPORT extern const base::Feature kOriginIsolationHeader;
CONTENT_EXPORT extern const base::Feature kOriginPolicy;
CONTENT_EXPORT extern const base::Feature kOverscrollHistoryNavigation;
CONTENT_EXPORT extern const base::Feature kParkableStringsToDisk;
CONTENT_EXPORT extern const base::Feature kPaymentRequestOptionalTotal;
CONTENT_EXPORT extern const base::Feature kPeriodicBackgroundSync;
CONTENT_EXPORT extern const base::Feature kPepper3DImageChromium;
CONTENT_EXPORT extern const base::Feature kPepperCrossOriginRedirectRestriction;
......
......@@ -136,7 +136,6 @@ class WebRuntimeFeatures {
BLINK_PLATFORM_EXPORT static void EnablePagePopup(bool);
BLINK_PLATFORM_EXPORT static void EnablePaymentApp(bool);
BLINK_PLATFORM_EXPORT static void EnablePaymentHandlerMinimalUI(bool);
BLINK_PLATFORM_EXPORT static void EnablePaymentRequestOptionalTotal(bool);
BLINK_PLATFORM_EXPORT static void EnablePaymentRequest(bool);
BLINK_PLATFORM_EXPORT static void EnablePercentBasedScrolling(bool);
BLINK_PLATFORM_EXPORT static void EnablePerformanceManagerInstrumentation(
......
......@@ -583,8 +583,7 @@ void ValidateAndConvertPaymentDetailsUpdate(const PaymentDetailsUpdate* input,
if (exception_state.HadException())
return;
if (input->hasTotal()) {
DCHECK(!RuntimeEnabledFeatures::PaymentRequestOptionalTotalEnabled() ||
!ignore_total);
DCHECK(!RuntimeEnabledFeatures::DigitalGoodsEnabled() || !ignore_total);
if (ignore_total) {
output->total =
CreateTotalPlaceHolderForAppStoreBilling(execution_context);
......@@ -1180,9 +1179,8 @@ PaymentRequest::PaymentRequest(
if (exception_state.HadException())
return;
ignore_total_ =
RuntimeEnabledFeatures::PaymentRequestOptionalTotalEnabled() &&
RequestingOnlyAppStoreBillingMethods(validated_method_data);
ignore_total_ = RuntimeEnabledFeatures::DigitalGoodsEnabled() &&
RequestingOnlyAppStoreBillingMethods(validated_method_data);
ValidateAndConvertPaymentDetailsInit(details, options_, validated_details,
shipping_option_, ignore_total_,
*GetExecutionContext(), exception_state);
......
......@@ -87,7 +87,7 @@ class PaymentRequestOptionalTotalTest : public testing::Test {
// methods. Total is required in this scenario.
TEST_F(PaymentRequestOptionalTotalTest,
AppStoreBillingFlagEnabledTotalIsRequiredWhenMixMethods) {
RuntimeEnabledFeatures::SetPaymentRequestOptionalTotalEnabled(true);
RuntimeEnabledFeatures::SetDigitalGoodsEnabled(true);
PaymentRequestV8TestingScope scope;
// Intentionally leaves the total of details unset.
......@@ -112,7 +112,7 @@ TEST_F(PaymentRequestOptionalTotalTest,
// billing methods, total is required.
TEST_F(PaymentRequestOptionalTotalTest,
AppStoreBillingFlagDisabledTotalIsRequiredWhenMixMethods) {
RuntimeEnabledFeatures::SetPaymentRequestOptionalTotalEnabled(false);
RuntimeEnabledFeatures::SetDigitalGoodsEnabled(false);
PaymentRequestV8TestingScope scope;
// Intentionally leaves the total of details unset.
......@@ -135,7 +135,7 @@ TEST_F(PaymentRequestOptionalTotalTest,
// only requesting app-store billing methods.
TEST_F(PaymentRequestOptionalTotalTest,
AppStoreBillingFlagEnabledTotalGetPlaceHolder) {
RuntimeEnabledFeatures::SetPaymentRequestOptionalTotalEnabled(true);
RuntimeEnabledFeatures::SetDigitalGoodsEnabled(true);
PaymentRequestV8TestingScope scope;
// Intentionally leaves the total of details unset.
......@@ -158,7 +158,7 @@ TEST_F(PaymentRequestOptionalTotalTest,
// When the OptionalTotal is disabled: undefined total is rejected.
TEST_F(PaymentRequestOptionalTotalTest,
AppStoreBillingFlagDisabledTotalGetRejected) {
RuntimeEnabledFeatures::SetPaymentRequestOptionalTotalEnabled(false);
RuntimeEnabledFeatures::SetDigitalGoodsEnabled(false);
PaymentRequestV8TestingScope scope;
// Intentionally leaves the total of details unset.
......@@ -184,7 +184,7 @@ TEST_F(PaymentRequestOptionalTotalTest,
// app-store billing methods.
TEST_F(PaymentRequestOptionalTotalTest,
AppStoreBillingFlagEnabledTotalGetOverridden) {
RuntimeEnabledFeatures::SetPaymentRequestOptionalTotalEnabled(true);
RuntimeEnabledFeatures::SetDigitalGoodsEnabled(true);
PaymentRequestV8TestingScope scope;
PaymentDetailsInit* details = PaymentDetailsInit::Create();
......@@ -210,7 +210,7 @@ TEST_F(PaymentRequestOptionalTotalTest,
// requesting app-store billing methods.
TEST_F(PaymentRequestOptionalTotalTest,
AppStoreBillingFlagDisabledTotalNotGetOverridden) {
RuntimeEnabledFeatures::SetPaymentRequestOptionalTotalEnabled(false);
RuntimeEnabledFeatures::SetDigitalGoodsEnabled(false);
PaymentRequestV8TestingScope scope;
PaymentDetailsInit* details = PaymentDetailsInit::Create();
......
......@@ -321,17 +321,12 @@ void WebRuntimeFeatures::EnablePaymentHandlerMinimalUI(bool enable) {
RuntimeEnabledFeatures::SetPaymentHandlerMinimalUIEnabled(enable);
}
void WebRuntimeFeatures::EnablePaymentRequestOptionalTotal(bool enable) {
RuntimeEnabledFeatures::SetPaymentRequestOptionalTotalEnabled(enable);
}
void WebRuntimeFeatures::EnablePaymentRequest(bool enable) {
RuntimeEnabledFeatures::SetPaymentRequestEnabled(enable);
if (!enable) {
// Disable features that depend on Payment Request API.
RuntimeEnabledFeatures::SetPaymentAppEnabled(false);
RuntimeEnabledFeatures::SetPaymentHandlerMinimalUIEnabled(false);
RuntimeEnabledFeatures::SetPaymentRequestOptionalTotalEnabled(false);
RuntimeEnabledFeatures::SetPaymentMethodChangeEventEnabled(false);
}
}
......
......@@ -1381,10 +1381,6 @@
name: "PaymentRequestMerchantValidationEvent",
status: "experimental",
},
{
name: "PaymentRequestOptionalTotal",
status: "experimental",
},
{
name: "PaymentRetry",
status: "stable",
......
......@@ -4071,7 +4071,7 @@ crbug.com/852645 gamepad/full-screen-gamepad.html [ Timeout ]
crbug.com/718155 payments/payment-request-in-iframe.html [ Failure ]
crbug.com/718155 payments/payment-request-in-iframe-nested-not-allowed.html [ Failure ]
# Expect to fail. The test is applicable only when PaymentRequestOptionalTotal flag is disabled.
# Expect to fail. The test is applicable only when DigitalGoods flag is disabled.
crbug.com/1080870 http/tests/payments/payment-request-app-store-billing-mandatory-total.html [ Failure ]
# Layout Tests on Swarming (Windows) - https://crbug.com/717347
......
......@@ -5,8 +5,8 @@
<script src="../serviceworker/resources/test-helpers.js"></script>
<script>
test(() => {
assert_false(internals.runtimeFlags.paymentRequestOptionalTotalEnabled);
}, "This test suite assumes that the runtime-enabled-flag PaymentRequestOptionalTotal is disabled.");
assert_false(internals.runtimeFlags.digitalGoodsEnabled);
}, "This test suite assumes that the runtime-enabled-flag DigitalGoods is disabled.");
const onlySupportAppStoreBillingMethod = [{supportedMethods: "https://play.google.com/billing"}];
const supportBothAppStoreBillingMethodAndNormalMethod = [{supportedMethods: "https://play.google.com/billing"},
......@@ -31,7 +31,7 @@ const supportBothAppStoreBillingMethodAndNormalMethod = [{supportedMethods: "htt
return;
}
assert_unreached(`Expect an exception.`);
}, `The total field is mandatory (not allowed to be ${JSON.stringify(total)}) when PaymentRequestOptionalTotal is disabled.`)
}, `The total field is mandatory (not allowed to be ${JSON.stringify(total)}) when DigitalGoods is disabled.`)
});
[null, {}, "omitted", undefined].forEach(details => {
......@@ -49,6 +49,6 @@ const supportBothAppStoreBillingMethodAndNormalMethod = [{supportedMethods: "htt
return;
}
assert_unreached(`Expect an exception.`);
}, `The details field is mandatory (not allowed to be ${JSON.stringify(details)}) when PaymentRequestOptionalTotal is disabled.`)
}, `The details field is mandatory (not allowed to be ${JSON.stringify(details)}) when DigitalGoods is disabled.`)
});
</script>
......@@ -5,8 +5,8 @@
<script src="../serviceworker/resources/test-helpers.js"></script>
<script>
test(() => {
assert_true(internals.runtimeFlags.paymentRequestOptionalTotalEnabled);
}, "This test suite assumes that the runtime-enabled-flag PaymentRequestOptionalTotal is enabled.");
assert_true(internals.runtimeFlags.digitalGoodsEnabled);
}, "This test suite assumes that the runtime-enabled-flag DigitalGoods is enabled.");
const onlySupportAppStoreBillingMethod = [{supportedMethods: "https://play.google.com/billing"}];
const supportBothAppStoreBillingMethodAndNormalMethod = [{supportedMethods: "https://play.google.com/billing"},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment