OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/autofill/core/browser/autofill_manager.h" | 5 #include "components/autofill/core/browser/autofill_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 4659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4670 EXPECT_TRUE(autofill_manager_->credit_card_was_uploaded()); | 4670 EXPECT_TRUE(autofill_manager_->credit_card_was_uploaded()); |
4671 | 4671 |
4672 // Server did not send a server_id, expect copy of card is not stored. | 4672 // Server did not send a server_id, expect copy of card is not stored. |
4673 EXPECT_TRUE(autofill_manager_->GetCreditCards().empty()); | 4673 EXPECT_TRUE(autofill_manager_->GetCreditCards().empty()); |
4674 | 4674 |
4675 // Verify that the correct histogram entry (and only that) was logged. | 4675 // Verify that the correct histogram entry (and only that) was logged. |
4676 ExpectUniqueCardUploadDecision(histogram_tester, | 4676 ExpectUniqueCardUploadDecision(histogram_tester, |
4677 AutofillMetrics::UPLOAD_OFFERED); | 4677 AutofillMetrics::UPLOAD_OFFERED); |
4678 // Verify that the correct UKM was logged. | 4678 // Verify that the correct UKM was logged. |
4679 ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED); | 4679 ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED); |
| 4680 // Verify the histogram entry for recent profile modification. |
| 4681 histogram_tester.ExpectUniqueSample( |
| 4682 "Autofill.HasModifiedProfile.CreditCardFormSubmission", true, 1); |
4680 } | 4683 } |
4681 | 4684 |
4682 TEST_F(AutofillManagerTest, UploadCreditCardAndSaveCopy) { | 4685 TEST_F(AutofillManagerTest, UploadCreditCardAndSaveCopy) { |
4683 personal_data_.ClearCreditCards(); | 4686 personal_data_.ClearCreditCards(); |
4684 personal_data_.ClearAutofillProfiles(); | 4687 personal_data_.ClearAutofillProfiles(); |
4685 autofill_manager_->set_credit_card_upload_enabled(true); | 4688 autofill_manager_->set_credit_card_upload_enabled(true); |
4686 | 4689 |
4687 const char* const server_id = "InstrumentData:1234"; | 4690 const char* const server_id = "InstrumentData:1234"; |
4688 autofill_manager_->ResetPaymentsClientForCardUpload(server_id); | 4691 autofill_manager_->ResetPaymentsClientForCardUpload(server_id); |
4689 | 4692 |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5194 FormSubmitted(credit_card_form); | 5197 FormSubmitted(credit_card_form); |
5195 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); | 5198 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); |
5196 | 5199 |
5197 // Verify that the correct histogram entry (and only that) was logged. | 5200 // Verify that the correct histogram entry (and only that) was logged. |
5198 ExpectUniqueCardUploadDecision( | 5201 ExpectUniqueCardUploadDecision( |
5199 histogram_tester, | 5202 histogram_tester, |
5200 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_RECENTLY_USED_ADDRESS); | 5203 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_RECENTLY_USED_ADDRESS); |
5201 // Verify that the correct UKM was logged. | 5204 // Verify that the correct UKM was logged. |
5202 ExpectCardUploadDecisionUkm( | 5205 ExpectCardUploadDecisionUkm( |
5203 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_RECENTLY_USED_ADDRESS); | 5206 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_RECENTLY_USED_ADDRESS); |
| 5207 // Verify the histogram entry for recent profile modification. |
| 5208 histogram_tester.ExpectUniqueSample( |
| 5209 "Autofill.HasModifiedProfile.CreditCardFormSubmission", false, 1); |
5204 } | 5210 } |
5205 | 5211 |
5206 TEST_F(AutofillManagerTest, | 5212 TEST_F(AutofillManagerTest, |
5207 UploadCreditCard_CvcUnavailableAndNoProfileAvailable) { | 5213 UploadCreditCard_CvcUnavailableAndNoProfileAvailable) { |
5208 EnableUkmLogging(); | 5214 EnableUkmLogging(); |
5209 personal_data_.ClearAutofillProfiles(); | 5215 personal_data_.ClearAutofillProfiles(); |
5210 autofill_manager_->set_credit_card_upload_enabled(true); | 5216 autofill_manager_->set_credit_card_upload_enabled(true); |
5211 | 5217 |
5212 // Don't fill or submit an address form. | 5218 // Don't fill or submit an address form. |
5213 | 5219 |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6581 | 6587 |
6582 // Wait for upload to complete (will check expected types as well). | 6588 // Wait for upload to complete (will check expected types as well). |
6583 autofill_manager_->WaitForAsyncUploadProcess(); | 6589 autofill_manager_->WaitForAsyncUploadProcess(); |
6584 | 6590 |
6585 EXPECT_EQ(signature, autofill_manager_->GetSubmittedFormSignature()); | 6591 EXPECT_EQ(signature, autofill_manager_->GetSubmittedFormSignature()); |
6586 EXPECT_NE(uploaded_available_types.end(), | 6592 EXPECT_NE(uploaded_available_types.end(), |
6587 uploaded_available_types.find(autofill::PASSWORD)); | 6593 uploaded_available_types.find(autofill::PASSWORD)); |
6588 } | 6594 } |
6589 | 6595 |
6590 } // namespace autofill | 6596 } // namespace autofill |
OLD | NEW |