Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Unified Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 1515903003: If upload is enabled don't fallback to local save. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/autofill_manager_unittest.cc
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc
index 8f8af8e17da451beca403940dfa356103ce820be..805d521e537d7231fc8dab82aae0e03818bfaa47 100644
--- a/components/autofill/core/browser/autofill_manager_unittest.cc
+++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -470,7 +470,7 @@ class TestAutofillManager : public AutofillManager {
: AutofillManager(driver, client, personal_data),
personal_data_(personal_data),
autofill_enabled_(true),
- credit_card_upload_enabled_(true),
+ credit_card_upload_enabled_(false),
credit_card_was_uploaded_(false),
expect_all_unknown_possible_types_(false),
expected_observed_submission_(true) {
@@ -3763,6 +3763,8 @@ TEST_F(AutofillManagerTest, FillInUpdatedExpirationDate) {
}
TEST_F(AutofillManagerTest, UploadCreditCard) {
+ autofill_manager_->set_credit_card_upload_enabled(true);
+
// Create, fill and submit an address form in order to establish a recent
// profile which can be selected for the upload request.
FormData address_form;
@@ -3817,6 +3819,8 @@ TEST_F(AutofillManagerTest, DontUploadCreditCardIfFeatureNotEnabled) {
}
TEST_F(AutofillManagerTest, DontUploadCreditCardIfCvcUnavailable) {
+ autofill_manager_->set_credit_card_upload_enabled(true);
+
// Create, fill and submit an address form in order to establish a recent
// profile which can be selected for the upload request.
FormData address_form;
@@ -3837,13 +3841,15 @@ TEST_F(AutofillManagerTest, DontUploadCreditCardIfCvcUnavailable) {
credit_card_form.fields[3].value = ASCIIToUTF16("2017");
credit_card_form.fields[4].value = ASCIIToUTF16(""); // CVC MISSING
- // The save prompt should be shown instead of doing an upload.
- EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_)).Times(1);
+ // Neither a local save nor an upload should happen in this case.
+ EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_)).Times(0);
FormSubmitted(credit_card_form);
EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded());
}
TEST_F(AutofillManagerTest, DontUploadCreditCardIfNoMatchingProfileAvailable) {
+ autofill_manager_->set_credit_card_upload_enabled(true);
+
// Create, fill and submit an address form in order to establish a recent
// profile which can be selected for the upload request.
FormData address_form;
@@ -3865,13 +3871,15 @@ TEST_F(AutofillManagerTest, DontUploadCreditCardIfNoMatchingProfileAvailable) {
credit_card_form.fields[3].value = ASCIIToUTF16("2017");
credit_card_form.fields[4].value = ASCIIToUTF16("123");
- // The save prompt should be shown instead of doing an upload.
- EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_)).Times(1);
+ // Neither a local save nor an upload should happen in this case.
+ EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_)).Times(0);
FormSubmitted(credit_card_form);
EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded());
}
TEST_F(AutofillManagerTest, DontUploadCreditCardIfUploadDetailsFails) {
+ autofill_manager_->set_credit_card_upload_enabled(true);
+
// Anything other than "en-US" will cause GetUploadDetails to return a failure
// response.
autofill_manager_->set_app_locale("pt-BR");
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698