| 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 4578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4589 // Neither a local save nor an upload should happen in this case. | 4589 // Neither a local save nor an upload should happen in this case. |
| 4590 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); | 4590 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); |
| 4591 FormSubmitted(credit_card_form); | 4591 FormSubmitted(credit_card_form); |
| 4592 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); | 4592 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); |
| 4593 | 4593 |
| 4594 // Verify that the correct histogram entry (and only that) was logged. | 4594 // Verify that the correct histogram entry (and only that) was logged. |
| 4595 histogram_tester.ExpectUniqueSample( | 4595 histogram_tester.ExpectUniqueSample( |
| 4596 "Autofill.CardUploadDecisionExpanded", | 4596 "Autofill.CardUploadDecisionExpanded", |
| 4597 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC, 1); | 4597 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC, 1); |
| 4598 | 4598 |
| 4599 rappor::TestRapporService* rappor_service = | 4599 rappor::TestRapporServiceImpl* rappor_service = |
| 4600 autofill_client_.test_rappor_service(); | 4600 autofill_client_.test_rappor_service(); |
| 4601 EXPECT_EQ(1, rappor_service->GetReportsCount()); | 4601 EXPECT_EQ(1, rappor_service->GetReportsCount()); |
| 4602 std::string sample; | 4602 std::string sample; |
| 4603 rappor::RapporType type; | 4603 rappor::RapporType type; |
| 4604 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( | 4604 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( |
| 4605 "Autofill.CardUploadNotOfferedNoCvc", &sample, &type)); | 4605 "Autofill.CardUploadNotOfferedNoCvc", &sample, &type)); |
| 4606 EXPECT_EQ("myform.com", sample); | 4606 EXPECT_EQ("myform.com", sample); |
| 4607 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); | 4607 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); |
| 4608 } | 4608 } |
| 4609 | 4609 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4701 // Neither a local save nor an upload should happen in this case. | 4701 // Neither a local save nor an upload should happen in this case. |
| 4702 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); | 4702 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); |
| 4703 FormSubmitted(credit_card_form); | 4703 FormSubmitted(credit_card_form); |
| 4704 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); | 4704 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); |
| 4705 | 4705 |
| 4706 // Verify that the correct histogram entry (and only that) was logged. | 4706 // Verify that the correct histogram entry (and only that) was logged. |
| 4707 histogram_tester.ExpectUniqueSample( | 4707 histogram_tester.ExpectUniqueSample( |
| 4708 "Autofill.CardUploadDecisionExpanded", | 4708 "Autofill.CardUploadDecisionExpanded", |
| 4709 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ADDRESS, 1); | 4709 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ADDRESS, 1); |
| 4710 | 4710 |
| 4711 rappor::TestRapporService* rappor_service = | 4711 rappor::TestRapporServiceImpl* rappor_service = |
| 4712 autofill_client_.test_rappor_service(); | 4712 autofill_client_.test_rappor_service(); |
| 4713 EXPECT_EQ(1, rappor_service->GetReportsCount()); | 4713 EXPECT_EQ(1, rappor_service->GetReportsCount()); |
| 4714 std::string sample; | 4714 std::string sample; |
| 4715 rappor::RapporType type; | 4715 rappor::RapporType type; |
| 4716 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( | 4716 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( |
| 4717 "Autofill.CardUploadNotOfferedNoAddress", &sample, &type)); | 4717 "Autofill.CardUploadNotOfferedNoAddress", &sample, &type)); |
| 4718 EXPECT_EQ("myform.com", sample); | 4718 EXPECT_EQ("myform.com", sample); |
| 4719 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); | 4719 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); |
| 4720 } | 4720 } |
| 4721 | 4721 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4754 // Neither a local save nor an upload should happen in this case. | 4754 // Neither a local save nor an upload should happen in this case. |
| 4755 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); | 4755 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); |
| 4756 FormSubmitted(credit_card_form); | 4756 FormSubmitted(credit_card_form); |
| 4757 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); | 4757 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); |
| 4758 | 4758 |
| 4759 // Verify that the correct histogram entry (and only that) was logged. | 4759 // Verify that the correct histogram entry (and only that) was logged. |
| 4760 histogram_tester.ExpectUniqueSample( | 4760 histogram_tester.ExpectUniqueSample( |
| 4761 "Autofill.CardUploadDecisionExpanded", | 4761 "Autofill.CardUploadDecisionExpanded", |
| 4762 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_NAME, 1); | 4762 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_NAME, 1); |
| 4763 | 4763 |
| 4764 rappor::TestRapporService* rappor_service = | 4764 rappor::TestRapporServiceImpl* rappor_service = |
| 4765 autofill_client_.test_rappor_service(); | 4765 autofill_client_.test_rappor_service(); |
| 4766 EXPECT_EQ(1, rappor_service->GetReportsCount()); | 4766 EXPECT_EQ(1, rappor_service->GetReportsCount()); |
| 4767 std::string sample; | 4767 std::string sample; |
| 4768 rappor::RapporType type; | 4768 rappor::RapporType type; |
| 4769 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( | 4769 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( |
| 4770 "Autofill.CardUploadNotOfferedNoName", &sample, &type)); | 4770 "Autofill.CardUploadNotOfferedNoName", &sample, &type)); |
| 4771 EXPECT_EQ("myform.com", sample); | 4771 EXPECT_EQ("myform.com", sample); |
| 4772 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); | 4772 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); |
| 4773 } | 4773 } |
| 4774 | 4774 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5021 // Names are required to match, upload should not happen. | 5021 // Names are required to match, upload should not happen. |
| 5022 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); | 5022 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); |
| 5023 FormSubmitted(credit_card_form); | 5023 FormSubmitted(credit_card_form); |
| 5024 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); | 5024 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); |
| 5025 | 5025 |
| 5026 // Verify that the correct histogram entry (and only that) was logged. | 5026 // Verify that the correct histogram entry (and only that) was logged. |
| 5027 histogram_tester.ExpectUniqueSample( | 5027 histogram_tester.ExpectUniqueSample( |
| 5028 "Autofill.CardUploadDecisionExpanded", | 5028 "Autofill.CardUploadDecisionExpanded", |
| 5029 AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_NAMES, 1); | 5029 AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_NAMES, 1); |
| 5030 | 5030 |
| 5031 rappor::TestRapporService* rappor_service = | 5031 rappor::TestRapporServiceImpl* rappor_service = |
| 5032 autofill_client_.test_rappor_service(); | 5032 autofill_client_.test_rappor_service(); |
| 5033 EXPECT_EQ(1, rappor_service->GetReportsCount()); | 5033 EXPECT_EQ(1, rappor_service->GetReportsCount()); |
| 5034 std::string sample; | 5034 std::string sample; |
| 5035 rappor::RapporType type; | 5035 rappor::RapporType type; |
| 5036 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( | 5036 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( |
| 5037 "Autofill.CardUploadNotOfferedConflictingNames", &sample, &type)); | 5037 "Autofill.CardUploadNotOfferedConflictingNames", &sample, &type)); |
| 5038 EXPECT_EQ("myform.com", sample); | 5038 EXPECT_EQ("myform.com", sample); |
| 5039 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); | 5039 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); |
| 5040 } | 5040 } |
| 5041 | 5041 |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5539 | 5539 |
| 5540 // The driver should always be notified. | 5540 // The driver should always be notified. |
| 5541 for (const FormFieldData& field : form.fields) { | 5541 for (const FormFieldData& field : form.fields) { |
| 5542 GetAutofillSuggestions(form, field); | 5542 GetAutofillSuggestions(form, field); |
| 5543 EXPECT_TRUE(autofill_driver_->did_interact_with_credit_card_form()); | 5543 EXPECT_TRUE(autofill_driver_->did_interact_with_credit_card_form()); |
| 5544 autofill_driver_->ClearDidInteractWithCreditCardForm(); | 5544 autofill_driver_->ClearDidInteractWithCreditCardForm(); |
| 5545 } | 5545 } |
| 5546 } | 5546 } |
| 5547 | 5547 |
| 5548 } // namespace autofill | 5548 } // namespace autofill |
| OLD | NEW |