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