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

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

Issue 2773433002: Log observations of explicit UPI-VPA autocomplete hints. (Closed)
Patch Set: Initial CL Created 3 years, 9 months 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
Index: components/autofill/core/browser/form_structure_unittest.cc
diff --git a/components/autofill/core/browser/form_structure_unittest.cc b/components/autofill/core/browser/form_structure_unittest.cc
index c1ecb59405c73c390842de1827d875dbbda0724e..1dd7dbe45f67bb2bcc69cbaa0274c3108e625ff6 100644
--- a/components/autofill/core/browser/form_structure_unittest.cc
+++ b/components/autofill/core/browser/form_structure_unittest.cc
@@ -14,6 +14,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/test/histogram_tester.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/common/autofill_switches.h"
#include "components/autofill/core/common/form_data.h"
@@ -435,6 +436,7 @@ TEST_F(FormStructureTest, HeuristicsContactInfo) {
// Verify that we can correctly process the |autocomplete| attribute.
TEST_F(FormStructureTest, HeuristicsAutocompleteAttribute) {
+ base::HistogramTester histograms;
Mathieu 2017/03/23 11:26:22 there is no histogram testing in this file (histog
Roger McFarlane (Chromium) 2017/03/28 19:08:24 Done.
std::unique_ptr<FormStructure> form_structure;
FormData form;
@@ -456,20 +458,30 @@ TEST_F(FormStructureTest, HeuristicsAutocompleteAttribute) {
field.autocomplete_attribute = "email";
form.fields.push_back(field);
+ field.label = base::string16();
+ field.name = ASCIIToUTF16("field4");
+ field.autocomplete_attribute = "upi-vpa";
+ form.fields.push_back(field);
+
form_structure.reset(new FormStructure(form));
form_structure->DetermineHeuristicTypes();
EXPECT_TRUE(form_structure->IsAutofillable());
// Expect the correct number of fields.
- ASSERT_EQ(3U, form_structure->field_count());
+ ASSERT_EQ(4U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
EXPECT_EQ(HTML_TYPE_GIVEN_NAME, form_structure->field(0)->html_type());
EXPECT_EQ(HTML_TYPE_FAMILY_NAME, form_structure->field(1)->html_type());
EXPECT_EQ(HTML_TYPE_EMAIL, form_structure->field(2)->html_type());
+ EXPECT_EQ(HTML_TYPE_UNRECOGNIZED, form_structure->field(3)->html_type());
EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(0)->heuristic_type());
EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(1)->heuristic_type());
EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(2)->heuristic_type());
+ EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(3)->heuristic_type());
+
+ histograms.ExpectBucketCount("Autofill.ExplicitUpiVpaHint",
+ static_cast<int>(true), 1);
}
// Verify that the heuristics are not run for non checkout formless forms.

Powered by Google App Engine
This is Rietveld 408576698