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 4572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4583 // Neither a local save nor an upload should happen in this case. | 4583 // Neither a local save nor an upload should happen in this case. |
4584 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); | 4584 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); |
4585 FormSubmitted(credit_card_form); | 4585 FormSubmitted(credit_card_form); |
4586 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); | 4586 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); |
4587 | 4587 |
4588 // Verify that the correct histogram entry (and only that) was logged. | 4588 // Verify that the correct histogram entry (and only that) was logged. |
4589 histogram_tester.ExpectUniqueSample( | 4589 histogram_tester.ExpectUniqueSample( |
4590 "Autofill.CardUploadDecisionExpanded", | 4590 "Autofill.CardUploadDecisionExpanded", |
4591 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC, 1); | 4591 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC, 1); |
4592 | 4592 |
4593 rappor::TestRapporService* rappor_service = | 4593 rappor::TestRapporServiceImpl* rappor_service = |
4594 autofill_client_.test_rappor_service(); | 4594 autofill_client_.test_rappor_service(); |
4595 EXPECT_EQ(1, rappor_service->GetReportsCount()); | 4595 EXPECT_EQ(1, rappor_service->GetReportsCount()); |
4596 std::string sample; | 4596 std::string sample; |
4597 rappor::RapporType type; | 4597 rappor::RapporType type; |
4598 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( | 4598 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( |
4599 "Autofill.CardUploadNotOfferedNoCvc", &sample, &type)); | 4599 "Autofill.CardUploadNotOfferedNoCvc", &sample, &type)); |
4600 EXPECT_EQ("myform.com", sample); | 4600 EXPECT_EQ("myform.com", sample); |
4601 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); | 4601 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); |
4602 } | 4602 } |
4603 | 4603 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4695 // Neither a local save nor an upload should happen in this case. | 4695 // Neither a local save nor an upload should happen in this case. |
4696 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); | 4696 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); |
4697 FormSubmitted(credit_card_form); | 4697 FormSubmitted(credit_card_form); |
4698 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); | 4698 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); |
4699 | 4699 |
4700 // Verify that the correct histogram entry (and only that) was logged. | 4700 // Verify that the correct histogram entry (and only that) was logged. |
4701 histogram_tester.ExpectUniqueSample( | 4701 histogram_tester.ExpectUniqueSample( |
4702 "Autofill.CardUploadDecisionExpanded", | 4702 "Autofill.CardUploadDecisionExpanded", |
4703 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ADDRESS, 1); | 4703 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ADDRESS, 1); |
4704 | 4704 |
4705 rappor::TestRapporService* rappor_service = | 4705 rappor::TestRapporServiceImpl* rappor_service = |
4706 autofill_client_.test_rappor_service(); | 4706 autofill_client_.test_rappor_service(); |
4707 EXPECT_EQ(1, rappor_service->GetReportsCount()); | 4707 EXPECT_EQ(1, rappor_service->GetReportsCount()); |
4708 std::string sample; | 4708 std::string sample; |
4709 rappor::RapporType type; | 4709 rappor::RapporType type; |
4710 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( | 4710 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( |
4711 "Autofill.CardUploadNotOfferedNoAddress", &sample, &type)); | 4711 "Autofill.CardUploadNotOfferedNoAddress", &sample, &type)); |
4712 EXPECT_EQ("myform.com", sample); | 4712 EXPECT_EQ("myform.com", sample); |
4713 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); | 4713 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); |
4714 } | 4714 } |
4715 | 4715 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4748 // Neither a local save nor an upload should happen in this case. | 4748 // Neither a local save nor an upload should happen in this case. |
4749 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); | 4749 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); |
4750 FormSubmitted(credit_card_form); | 4750 FormSubmitted(credit_card_form); |
4751 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); | 4751 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); |
4752 | 4752 |
4753 // Verify that the correct histogram entry (and only that) was logged. | 4753 // Verify that the correct histogram entry (and only that) was logged. |
4754 histogram_tester.ExpectUniqueSample( | 4754 histogram_tester.ExpectUniqueSample( |
4755 "Autofill.CardUploadDecisionExpanded", | 4755 "Autofill.CardUploadDecisionExpanded", |
4756 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_NAME, 1); | 4756 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_NAME, 1); |
4757 | 4757 |
4758 rappor::TestRapporService* rappor_service = | 4758 rappor::TestRapporServiceImpl* rappor_service = |
4759 autofill_client_.test_rappor_service(); | 4759 autofill_client_.test_rappor_service(); |
4760 EXPECT_EQ(1, rappor_service->GetReportsCount()); | 4760 EXPECT_EQ(1, rappor_service->GetReportsCount()); |
4761 std::string sample; | 4761 std::string sample; |
4762 rappor::RapporType type; | 4762 rappor::RapporType type; |
4763 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( | 4763 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( |
4764 "Autofill.CardUploadNotOfferedNoName", &sample, &type)); | 4764 "Autofill.CardUploadNotOfferedNoName", &sample, &type)); |
4765 EXPECT_EQ("myform.com", sample); | 4765 EXPECT_EQ("myform.com", sample); |
4766 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); | 4766 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); |
4767 } | 4767 } |
4768 | 4768 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5015 // Names are required to match, upload should not happen. | 5015 // Names are required to match, upload should not happen. |
5016 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); | 5016 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); |
5017 FormSubmitted(credit_card_form); | 5017 FormSubmitted(credit_card_form); |
5018 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); | 5018 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded()); |
5019 | 5019 |
5020 // Verify that the correct histogram entry (and only that) was logged. | 5020 // Verify that the correct histogram entry (and only that) was logged. |
5021 histogram_tester.ExpectUniqueSample( | 5021 histogram_tester.ExpectUniqueSample( |
5022 "Autofill.CardUploadDecisionExpanded", | 5022 "Autofill.CardUploadDecisionExpanded", |
5023 AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_NAMES, 1); | 5023 AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_NAMES, 1); |
5024 | 5024 |
5025 rappor::TestRapporService* rappor_service = | 5025 rappor::TestRapporServiceImpl* rappor_service = |
5026 autofill_client_.test_rappor_service(); | 5026 autofill_client_.test_rappor_service(); |
5027 EXPECT_EQ(1, rappor_service->GetReportsCount()); | 5027 EXPECT_EQ(1, rappor_service->GetReportsCount()); |
5028 std::string sample; | 5028 std::string sample; |
5029 rappor::RapporType type; | 5029 rappor::RapporType type; |
5030 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( | 5030 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( |
5031 "Autofill.CardUploadNotOfferedConflictingNames", &sample, &type)); | 5031 "Autofill.CardUploadNotOfferedConflictingNames", &sample, &type)); |
5032 EXPECT_EQ("myform.com", sample); | 5032 EXPECT_EQ("myform.com", sample); |
5033 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); | 5033 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); |
5034 } | 5034 } |
5035 | 5035 |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5532 | 5532 |
5533 // The driver should always be notified. | 5533 // The driver should always be notified. |
5534 for (const FormFieldData& field : form.fields) { | 5534 for (const FormFieldData& field : form.fields) { |
5535 GetAutofillSuggestions(form, field); | 5535 GetAutofillSuggestions(form, field); |
5536 EXPECT_TRUE(autofill_driver_->did_interact_with_credit_card_form()); | 5536 EXPECT_TRUE(autofill_driver_->did_interact_with_credit_card_form()); |
5537 autofill_driver_->ClearDidInteractWithCreditCardForm(); | 5537 autofill_driver_->ClearDidInteractWithCreditCardForm(); |
5538 } | 5538 } |
5539 } | 5539 } |
5540 | 5540 |
5541 } // namespace autofill | 5541 } // namespace autofill |
OLD | NEW |