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_metrics.h" | 5 #include "components/autofill/core/browser/autofill_metrics.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 response.add_field()->set_autofill_type(NAME_FIRST); | 748 response.add_field()->set_autofill_type(NAME_FIRST); |
749 // Server response will have no data. | 749 // Server response will have no data. |
750 response.add_field()->set_autofill_type(NO_SERVER_DATA); | 750 response.add_field()->set_autofill_type(NO_SERVER_DATA); |
751 // Not logged. | 751 // Not logged. |
752 response.add_field()->set_autofill_type(NAME_MIDDLE); | 752 response.add_field()->set_autofill_type(NAME_MIDDLE); |
753 | 753 |
754 std::string response_string; | 754 std::string response_string; |
755 ASSERT_TRUE(response.SerializeToString(&response_string)); | 755 ASSERT_TRUE(response.SerializeToString(&response_string)); |
756 | 756 |
757 std::vector<std::string> signatures; | 757 std::vector<std::string> signatures; |
758 signatures.push_back(form_structure->FormSignature()); | 758 signatures.push_back(form_structure->FormSignatureAsStr()); |
759 | 759 |
760 base::HistogramTester histogram_tester; | 760 base::HistogramTester histogram_tester; |
761 autofill_manager_->OnLoadedServerPredictions(response_string, signatures); | 761 autofill_manager_->OnLoadedServerPredictions(response_string, signatures); |
762 | 762 |
763 // Verify that FormStructure::ParseQueryResponse was called (here and below). | 763 // Verify that FormStructure::ParseQueryResponse was called (here and below). |
764 histogram_tester.ExpectBucketCount("Autofill.ServerQueryResponse", | 764 histogram_tester.ExpectBucketCount("Autofill.ServerQueryResponse", |
765 AutofillMetrics::QUERY_RESPONSE_RECEIVED, | 765 AutofillMetrics::QUERY_RESPONSE_RECEIVED, |
766 1); | 766 1); |
767 histogram_tester.ExpectBucketCount("Autofill.ServerQueryResponse", | 767 histogram_tester.ExpectBucketCount("Autofill.ServerQueryResponse", |
768 AutofillMetrics::QUERY_RESPONSE_PARSED, 1); | 768 AutofillMetrics::QUERY_RESPONSE_PARSED, 1); |
(...skipping 3300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4069 EXPECT_THAT( | 4069 EXPECT_THAT( |
4070 histogram_tester.GetAllSamples("Autofill.ServerResponseHasDataForForm"), | 4070 histogram_tester.GetAllSamples("Autofill.ServerResponseHasDataForForm"), |
4071 ElementsAre(Bucket(true, 2))); | 4071 ElementsAre(Bucket(true, 2))); |
4072 | 4072 |
4073 // No RAPPOR metrics are logged in the case there is at least some server data | 4073 // No RAPPOR metrics are logged in the case there is at least some server data |
4074 // available for all forms. | 4074 // available for all forms. |
4075 EXPECT_EQ(0, rappor_service_.GetReportsCount()); | 4075 EXPECT_EQ(0, rappor_service_.GetReportsCount()); |
4076 } | 4076 } |
4077 | 4077 |
4078 } // namespace autofill | 4078 } // namespace autofill |
OLD | NEW |