Commit f6ca3b78 authored by sczs's avatar sczs Committed by Commit Bot

Disables SaveCard expiration date check on iOS

When attempting to upload saved a card, there's a check where it
assumes that the user providing a date expiration value is because
the date was expired. This ends up calling
LogSaveCardRequestExpirationDateReasonMetric which DCHECKS if the
provided date is not expired.

After enabling the editing support on the Save Card modal on iOS, users
should not be able to send an expired date, but they will provide a date
when attempting the upload (even if it is the original the date).


Bug: 1029067
Change-Id: I874c8af5f24159e00a6cb3c50d46d988d3f391cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2099481
Auto-Submit: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarParastoo Geranmayeh <parastoog@google.com>
Reviewed-by: default avatarJared Saul <jsaul@google.com>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750590}
parent 5a167c72
......@@ -653,6 +653,7 @@ source_set("unit_tests") {
"//base",
"//base/test:test_support",
"//components/autofill/core/common",
"//components/infobars/core:feature_flags",
"//components/leveldb_proto",
"//components/os_crypt",
"//components/os_crypt:test_support",
......
......@@ -215,7 +215,19 @@ void CreditCardSaveManager::AttemptToOfferCardUploadSave(
DetectedValue::USER_PROVIDED_EXPIRATION_DATE) {
upload_decision_metrics_ |=
AutofillMetrics::USER_REQUESTED_TO_PROVIDE_EXPIRATION_DATE;
#if defined(OS_IOS)
// iOS should always provide a valid expiration date when attempting to
// upload a Saved Card. Calling LogSaveCardRequestExpirationDateReasonMetric
// would trigger a DCHECK.
if (!(base::FeatureList::IsEnabled(
features::kAutofillSaveCardInfobarEditSupport) &&
base::FeatureList::IsEnabled(kIOSInfobarUIReboot))) {
// Remove once both flags are deleted.
LogSaveCardRequestExpirationDateReasonMetric();
}
#else
LogSaveCardRequestExpirationDateReasonMetric();
#endif
should_request_expiration_date_from_user_ = true;
}
......
......@@ -50,6 +50,7 @@
#include "components/autofill/core/common/autofill_prefs.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_field_data.h"
#include "components/infobars/core/infobar_feature.h"
#include "components/prefs/pref_service.h"
#include "components/sync/driver/test_sync_service.h"
#include "components/ukm/test_ukm_recorder.h"
......@@ -2867,6 +2868,17 @@ TEST_F(CreditCardSaveManagerTest,
TEST_F(CreditCardSaveManagerTest,
UploadCreditCard_RequestExpirationDateViaExpDateFixFlow) {
#if defined(OS_IOS)
// iOS should always provide a valid expiration date when attempting to
// upload a Saved Card due to the Messages SaveCard modal. The manager
// shouldn't handle expired dates.
if ((base::FeatureList::IsEnabled(
features::kAutofillSaveCardInfobarEditSupport) &&
base::FeatureList::IsEnabled(kIOSInfobarUIReboot))) {
return;
}
#endif
scoped_feature_list_.InitAndEnableFeature(
features::kAutofillUpstreamEditableExpirationDate);
// Create, fill and submit an address form in order to establish a recent
......@@ -2910,6 +2922,17 @@ TEST_F(CreditCardSaveManagerTest,
TEST_F(CreditCardSaveManagerTest,
UploadCreditCard_RequestExpirationDateIfOnlyMonthMissing) {
#if defined(OS_IOS)
// iOS should always provide a valid expiration date when attempting to
// upload a Saved Card due to the Messages SaveCard modal. The manager
// shouldn't handle expired dates.
if ((base::FeatureList::IsEnabled(
features::kAutofillSaveCardInfobarEditSupport) &&
base::FeatureList::IsEnabled(kIOSInfobarUIReboot))) {
return;
}
#endif
scoped_feature_list_.InitAndEnableFeature(
features::kAutofillUpstreamEditableExpirationDate);
// Create, fill and submit an address form in order to establish a recent
......@@ -2953,6 +2976,17 @@ TEST_F(CreditCardSaveManagerTest,
TEST_F(CreditCardSaveManagerTest,
UploadCreditCard_RequestExpirationDateIfOnlyYearMissing) {
#if defined(OS_IOS)
// iOS should always provide a valid expiration date when attempting to
// upload a Saved Card due to the Messages SaveCard modal. The manager
// shouldn't handle expired dates.
if ((base::FeatureList::IsEnabled(
features::kAutofillSaveCardInfobarEditSupport) &&
base::FeatureList::IsEnabled(kIOSInfobarUIReboot))) {
return;
}
#endif
scoped_feature_list_.InitAndEnableFeature(
features::kAutofillUpstreamEditableExpirationDate);
// Create, fill and submit an address form in order to establish a recent
......@@ -2996,6 +3030,17 @@ TEST_F(CreditCardSaveManagerTest,
TEST_F(CreditCardSaveManagerTest,
UploadCreditCard_RequestExpirationDateIfExpirationDateInputIsExpired) {
#if defined(OS_IOS)
// iOS should always provide a valid expiration date when attempting to
// upload a Saved Card due to the Messages SaveCard modal. The manager
// shouldn't handle expired dates.
if ((base::FeatureList::IsEnabled(
features::kAutofillSaveCardInfobarEditSupport) &&
base::FeatureList::IsEnabled(kIOSInfobarUIReboot))) {
return;
}
#endif
scoped_feature_list_.InitAndEnableFeature(
features::kAutofillUpstreamEditableExpirationDate);
// Create, fill and submit an address form in order to establish a recent
......@@ -3040,6 +3085,17 @@ TEST_F(CreditCardSaveManagerTest,
TEST_F(
CreditCardSaveManagerTest,
UploadCreditCard_RequestExpirationDateIfExpirationDateInputIsTwoDigitAndExpired) {
#if defined(OS_IOS)
// iOS should always provide a valid expiration date when attempting to
// upload a Saved Card due to the Messages SaveCard modal. The manager
// shouldn't handle expired dates.
if ((base::FeatureList::IsEnabled(
features::kAutofillSaveCardInfobarEditSupport) &&
base::FeatureList::IsEnabled(kIOSInfobarUIReboot))) {
return;
}
#endif
scoped_feature_list_.InitAndEnableFeature(
features::kAutofillUpstreamEditableExpirationDate);
// Create, fill and submit an address form in order to establish a recent
......
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