| Index: chrome/browser/autofill/form_structure_unittest.cc
|
| diff --git a/chrome/browser/autofill/form_structure_unittest.cc b/chrome/browser/autofill/form_structure_unittest.cc
|
| index 4dbc3ce55414a7b1e0d3dd40802db8bb68f6853e..44ffdc949e5f260ab7496b1c5027a11eaf76a12f 100644
|
| --- a/chrome/browser/autofill/form_structure_unittest.cc
|
| +++ b/chrome/browser/autofill/form_structure_unittest.cc
|
| @@ -4,7 +4,6 @@
|
|
|
| #include "chrome/browser/autofill/form_structure.h"
|
|
|
| -#include "base/command_line.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/string_util.h"
|
| #include "base/utf_string_conversions.h"
|
| @@ -83,7 +82,7 @@ TEST(FormStructureTest, FieldCount) {
|
| field.form_control_type = "submit";
|
| form.fields.push_back(field);
|
|
|
| - FormStructure form_structure(form);
|
| + FormStructure form_structure(form, std::string());
|
|
|
| // All fields are counted.
|
| EXPECT_EQ(3U, form_structure.field_count());
|
| @@ -114,7 +113,7 @@ TEST(FormStructureTest, AutofillCount) {
|
| field.form_control_type = "submit";
|
| form.fields.push_back(field);
|
|
|
| - FormStructure form_structure(form);
|
| + FormStructure form_structure(form, std::string());
|
| form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
|
|
|
| // Only text and select fields that are heuristically matched are counted.
|
| @@ -125,7 +124,7 @@ TEST(FormStructureTest, SourceURL) {
|
| FormData form;
|
| form.origin = GURL("http://www.foo.com/");
|
| form.method = ASCIIToUTF16("post");
|
| - FormStructure form_structure(form);
|
| + FormStructure form_structure(form, std::string());
|
|
|
| EXPECT_EQ(form.origin, form_structure.source_url());
|
| }
|
| @@ -153,7 +152,7 @@ TEST(FormStructureTest, IsAutofillable) {
|
| field.form_control_type = "submit";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_FALSE(form_structure->IsAutofillable(true));
|
|
|
| @@ -168,7 +167,7 @@ TEST(FormStructureTest, IsAutofillable) {
|
| field.form_control_type = "text";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_FALSE(form_structure->IsAutofillable(true));
|
|
|
| @@ -178,14 +177,14 @@ TEST(FormStructureTest, IsAutofillable) {
|
| field.form_control_type = "email";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
|
|
| // The method must be 'post', though we can intentionally ignore this
|
| // criterion for the sake of providing a helpful warning message to the user.
|
| form.method = ASCIIToUTF16("get");
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_FALSE(form_structure->IsAutofillable(true));
|
| EXPECT_TRUE(form_structure->IsAutofillable(false));
|
| @@ -193,13 +192,13 @@ TEST(FormStructureTest, IsAutofillable) {
|
| // The target cannot include http(s)://*/search...
|
| form.method = ASCIIToUTF16("post");
|
| form.action = GURL("http://google.com/search?q=hello");
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_FALSE(form_structure->IsAutofillable(true));
|
|
|
| // But search can be in the URL.
|
| form.action = GURL("http://search.com/?q=hello");
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| }
|
| @@ -227,7 +226,7 @@ TEST(FormStructureTest, ShouldBeParsed) {
|
| checkable_field.form_control_type = "checkbox";
|
| form.fields.push_back(checkable_field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| EXPECT_FALSE(form_structure->ShouldBeParsed(true));
|
|
|
| // We now have three text fields, though only two are auto-fillable.
|
| @@ -241,25 +240,25 @@ TEST(FormStructureTest, ShouldBeParsed) {
|
| field.form_control_type = "text";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| EXPECT_TRUE(form_structure->ShouldBeParsed(true));
|
|
|
| // The method must be 'post', though we can intentionally ignore this
|
| // criterion for the sake of providing a helpful warning message to the user.
|
| form.method = ASCIIToUTF16("get");
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| EXPECT_FALSE(form_structure->IsAutofillable(true));
|
| EXPECT_TRUE(form_structure->ShouldBeParsed(false));
|
|
|
| // The target cannot include http(s)://*/search...
|
| form.method = ASCIIToUTF16("post");
|
| form.action = GURL("http://google.com/search?q=hello");
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| EXPECT_FALSE(form_structure->ShouldBeParsed(true));
|
|
|
| // But search can be in the URL.
|
| form.action = GURL("http://search.com/?q=hello");
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| EXPECT_TRUE(form_structure->ShouldBeParsed(true));
|
|
|
| // The form need only have three fields, but at least one must be a text
|
| @@ -281,11 +280,11 @@ TEST(FormStructureTest, ShouldBeParsed) {
|
| field.form_control_type = "select-one";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| EXPECT_TRUE(form_structure->ShouldBeParsed(true));
|
|
|
| form.fields[0].form_control_type = "select-one";
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| EXPECT_FALSE(form_structure->ShouldBeParsed(true));
|
| }
|
|
|
| @@ -330,7 +329,7 @@ TEST(FormStructureTest, HeuristicsContactInfo) {
|
| field.form_control_type = "submit";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
|
|
| @@ -381,7 +380,7 @@ TEST(FormStructureTest, HeuristicsAutocompleteAttribute) {
|
| field.autocomplete_attribute = "email";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
|
|
| @@ -419,7 +418,7 @@ TEST(FormStructureTest, HeuristicsAutocompleteAttributePhoneTypes) {
|
| field.autocomplete_attribute = "tel-local-suffix";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
|
|
| @@ -460,7 +459,7 @@ TEST(FormStructureTest, AutocompleteAttributeOverridesOtherHeuristics) {
|
| field.name = ASCIIToUTF16("email");
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| EXPECT_TRUE(form_structure->ShouldBeCrowdsourced());
|
| @@ -474,7 +473,7 @@ TEST(FormStructureTest, AutocompleteAttributeOverridesOtherHeuristics) {
|
|
|
| // Now update the first form field to include an 'autocomplete' attribute.
|
| form.fields.front().autocomplete_attribute = "x-other";
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_FALSE(form_structure->IsAutofillable(true));
|
| EXPECT_FALSE(form_structure->ShouldBeCrowdsourced());
|
| @@ -534,7 +533,7 @@ TEST(FormStructureTest, HeuristicsAutocompleteAttributeWithSections) {
|
| field.autocomplete_attribute = "section-foo cc-number";
|
| form.fields.push_back(field);
|
|
|
| - FormStructure form_structure(form);
|
| + FormStructure form_structure(form, std::string());
|
| form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure.IsAutofillable(true));
|
|
|
| @@ -579,7 +578,7 @@ TEST(FormStructureTest, HeuristicsAutocompleteAttributeWithSectionsDegenerate) {
|
| field.autocomplete_attribute = "garbage billing email";
|
| form.fields.push_back(field);
|
|
|
| - FormStructure form_structure(form);
|
| + FormStructure form_structure(form, std::string());
|
| form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
|
|
|
| // Expect the correct number of fields.
|
| @@ -609,7 +608,7 @@ TEST(FormStructureTest, HeuristicsAutocompleteAttributeWithSectionsRepeated) {
|
| field.autocomplete_attribute = "section-foo street-address";
|
| form.fields.push_back(field);
|
|
|
| - FormStructure form_structure(form);
|
| + FormStructure form_structure(form, std::string());
|
| form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
|
|
|
| // Expect the correct number of fields.
|
| @@ -647,7 +646,7 @@ TEST(FormStructureTest, HeuristicsDontOverrideAutocompleteAttributeSections) {
|
| field.autocomplete_attribute = "street-address";
|
| form.fields.push_back(field);
|
|
|
| - FormStructure form_structure(form);
|
| + FormStructure form_structure(form, std::string());
|
| form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
|
|
|
| // Expect the correct number of fields.
|
| @@ -712,7 +711,7 @@ TEST(FormStructureTest, HeuristicsSample8) {
|
| field.form_control_type = "submit";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| ASSERT_EQ(10U, form_structure->field_count());
|
| @@ -780,7 +779,7 @@ TEST(FormStructureTest, HeuristicsSample6) {
|
| field.form_control_type = "submit";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| ASSERT_EQ(7U, form_structure->field_count());
|
| @@ -846,7 +845,7 @@ TEST(FormStructureTest, HeuristicsLabelsOnly) {
|
| field.form_control_type = "submit";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| ASSERT_EQ(8U, form_structure->field_count());
|
| @@ -904,7 +903,7 @@ TEST(FormStructureTest, HeuristicsCreditCardInfo) {
|
| field.form_control_type = "submit";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| ASSERT_EQ(6U, form_structure->field_count());
|
| @@ -965,7 +964,7 @@ TEST(FormStructureTest, HeuristicsCreditCardInfoWithUnknownCardField) {
|
| field.form_control_type = "submit";
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| ASSERT_EQ(7U, form_structure->field_count());
|
| @@ -1013,7 +1012,7 @@ TEST(FormStructureTest, ThreeAddressLines) {
|
| field.name = ASCIIToUTF16("city");
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| ASSERT_EQ(4U, form_structure->field_count());
|
| @@ -1055,7 +1054,7 @@ TEST(FormStructureTest, BillingAndShippingAddresses) {
|
| field.name = ASCIIToUTF16("billing.address.addressLine2");
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| ASSERT_EQ(4U, form_structure->field_count());
|
| @@ -1101,7 +1100,7 @@ TEST(FormStructureTest, ThreeAddressLinesExpedia) {
|
| field.name = ASCIIToUTF16("FOPIH_RgWebCC_0_IHAddress_adct");
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| ASSERT_EQ(4U, form_structure->field_count());
|
| @@ -1140,7 +1139,7 @@ TEST(FormStructureTest, TwoAddressLinesEbay) {
|
| field.name = ASCIIToUTF16("city");
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| ASSERT_EQ(3U, form_structure->field_count());
|
| @@ -1174,7 +1173,7 @@ TEST(FormStructureTest, HeuristicsStateWithProvince) {
|
| field.name = ASCIIToUTF16("State");
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| ASSERT_EQ(3U, form_structure->field_count());
|
| @@ -1241,7 +1240,7 @@ TEST(FormStructureTest, HeuristicsWithBilling) {
|
| field.name = ASCIIToUTF16("email$emailBox");
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| ASSERT_EQ(11U, form_structure->field_count());
|
| @@ -1292,7 +1291,7 @@ TEST(FormStructureTest, ThreePartPhoneNumber) {
|
| field.max_length = 0;
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
| ASSERT_EQ(4U, form_structure->field_count());
|
| @@ -1338,7 +1337,7 @@ TEST(FormStructureTest, HeuristicsInfernoCC) {
|
| field.name = ASCIIToUTF16("expiration_year");
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
|
|
| @@ -1391,7 +1390,7 @@ TEST(FormStructureTest, CVCCodeClash) {
|
| field.name = ASCIIToUTF16("csc");
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
| EXPECT_TRUE(form_structure->IsAutofillable(true));
|
|
|
| @@ -1450,7 +1449,7 @@ TEST(FormStructureTest, EncodeQueryRequest) {
|
| form.fields.push_back(checkable_field);
|
|
|
| ScopedVector<FormStructure> forms;
|
| - forms.push_back(new FormStructure(form));
|
| + forms.push_back(new FormStructure(form, std::string()));
|
| std::vector<std::string> encoded_signatures;
|
| std::string encoded_xml;
|
| const char * const kSignature1 = "11337937696949187602";
|
| @@ -1470,7 +1469,7 @@ TEST(FormStructureTest, EncodeQueryRequest) {
|
|
|
| // Add the same form, only one will be encoded, so EncodeQueryRequest() should
|
| // return the same data.
|
| - forms.push_back(new FormStructure(form));
|
| + forms.push_back(new FormStructure(form, std::string()));
|
| ASSERT_TRUE(FormStructure::EncodeQueryRequest(forms.get(),
|
| &encoded_signatures,
|
| &encoded_xml));
|
| @@ -1484,7 +1483,7 @@ TEST(FormStructureTest, EncodeQueryRequest) {
|
| form.fields.push_back(field);
|
| }
|
|
|
| - forms.push_back(new FormStructure(form));
|
| + forms.push_back(new FormStructure(form, std::string()));
|
| ASSERT_TRUE(FormStructure::EncodeQueryRequest(forms.get(),
|
| &encoded_signatures,
|
| &encoded_xml));
|
| @@ -1515,7 +1514,7 @@ TEST(FormStructureTest, EncodeQueryRequest) {
|
| malformed_form.fields.push_back(field);
|
| }
|
|
|
| - forms.push_back(new FormStructure(malformed_form));
|
| + forms.push_back(new FormStructure(malformed_form, std::string()));
|
| ASSERT_TRUE(FormStructure::EncodeQueryRequest(forms.get(),
|
| &encoded_signatures,
|
| &encoded_xml));
|
| @@ -1526,7 +1525,7 @@ TEST(FormStructureTest, EncodeQueryRequest) {
|
|
|
| // Check that we fail if there are only bad form(s).
|
| ScopedVector<FormStructure> bad_forms;
|
| - bad_forms.push_back(new FormStructure(malformed_form));
|
| + bad_forms.push_back(new FormStructure(malformed_form, std::string()));
|
| EXPECT_FALSE(FormStructure::EncodeQueryRequest(bad_forms.get(),
|
| &encoded_signatures,
|
| &encoded_xml));
|
| @@ -1534,11 +1533,10 @@ TEST(FormStructureTest, EncodeQueryRequest) {
|
| EXPECT_EQ("", encoded_xml);
|
|
|
| // Check the behaviour with kEnableExperimentalFormFilling switch on.
|
| - CommandLine::ForCurrentProcess()->AppendSwitch(
|
| - switches::kEnableExperimentalFormFilling);
|
| // Add the previous form but with flag set.
|
| ScopedVector<FormStructure> checkable_forms;
|
| - checkable_forms.push_back(new FormStructure(form));
|
| + checkable_forms.push_back(
|
| + new FormStructure(form, "https://www.abc.com/checkout"));
|
|
|
| ASSERT_TRUE(FormStructure::EncodeQueryRequest(checkable_forms.get(),
|
| &encoded_signatures,
|
| @@ -1564,7 +1562,7 @@ TEST(FormStructureTest, EncodeUploadRequest) {
|
| std::vector<FieldTypeSet> possible_field_types;
|
| FormData form;
|
| form.method = ASCIIToUTF16("post");
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
|
|
|
| FormFieldData field;
|
| @@ -1612,7 +1610,7 @@ TEST(FormStructureTest, EncodeUploadRequest) {
|
| possible_field_types.push_back(FieldTypeSet());
|
| possible_field_types.back().insert(ADDRESS_HOME_COUNTRY);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
|
|
| ASSERT_EQ(form_structure->field_count(), possible_field_types.size());
|
| for (size_t i = 0; i < form_structure->field_count(); ++i)
|
| @@ -1670,7 +1668,7 @@ TEST(FormStructureTest, EncodeUploadRequest) {
|
| possible_field_types.back().insert(ADDRESS_BILLING_LINE2);
|
| }
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| ASSERT_EQ(form_structure->field_count(), possible_field_types.size());
|
| for (size_t i = 0; i < form_structure->field_count(); ++i)
|
| form_structure->field(i)->set_possible_types(possible_field_types[i]);
|
| @@ -1709,7 +1707,7 @@ TEST(FormStructureTest, EncodeUploadRequest) {
|
| possible_field_types.back().insert(ADDRESS_BILLING_LINE1);
|
| possible_field_types.back().insert(ADDRESS_BILLING_LINE2);
|
| }
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| ASSERT_EQ(form_structure->field_count(), possible_field_types.size());
|
| for (size_t i = 0; i < form_structure->field_count(); ++i)
|
| form_structure->field(i)->set_possible_types(possible_field_types[i]);
|
| @@ -1738,7 +1736,7 @@ TEST(FormStructureTest, CheckDataPresence) {
|
| field.name = ASCIIToUTF16("email");
|
| form.fields.push_back(field);
|
|
|
| - FormStructure form_structure(form);
|
| + FormStructure form_structure(form, std::string());
|
|
|
| FieldTypeSet unknown_type;
|
| unknown_type.insert(UNKNOWN_TYPE);
|
| @@ -2004,7 +2002,7 @@ TEST(FormStructureTest, CheckMultipleTypes) {
|
| possible_field_types.push_back(FieldTypeSet());
|
| possible_field_types.back().insert(ADDRESS_HOME_LINE1);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
|
|
| for (size_t i = 0; i < form_structure->field_count(); ++i)
|
| form_structure->field(i)->set_possible_types(possible_field_types[i]);
|
| @@ -2094,26 +2092,26 @@ TEST(FormStructureTest, CheckFormSignature) {
|
| field.name = ASCIIToUTF16("first");
|
| form.fields.push_back(field);
|
|
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
|
|
| EXPECT_EQ(FormStructureTest::Hash64Bit(
|
| std::string("://&&email&first")),
|
| form_structure->FormSignature());
|
|
|
| form.origin = GURL(std::string("http://www.facebook.com"));
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| EXPECT_EQ(FormStructureTest::Hash64Bit(
|
| std::string("http://www.facebook.com&&email&first")),
|
| form_structure->FormSignature());
|
|
|
| form.action = GURL(std::string("https://login.facebook.com/path"));
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| EXPECT_EQ(FormStructureTest::Hash64Bit(
|
| std::string("https://login.facebook.com&&email&first")),
|
| form_structure->FormSignature());
|
|
|
| form.name = ASCIIToUTF16("login_form");
|
| - form_structure.reset(new FormStructure(form));
|
| + form_structure.reset(new FormStructure(form, std::string()));
|
| EXPECT_EQ(FormStructureTest::Hash64Bit(
|
| std::string("https://login.facebook.com&login_form&email&first")),
|
| form_structure->FormSignature());
|
| @@ -2142,10 +2140,10 @@ TEST(FormStructureTest, ToFormData) {
|
| field.form_control_type = "submit";
|
| form.fields.push_back(field);
|
|
|
| - EXPECT_EQ(form, FormStructure(form).ToFormData());
|
| + EXPECT_EQ(form, FormStructure(form, std::string()).ToFormData());
|
|
|
| // Currently |FormStructure(form_data)ToFormData().user_submitted| is always
|
| // false. This forces a future author that changes this to update this test.
|
| form.user_submitted = true;
|
| - EXPECT_NE(form, FormStructure(form).ToFormData());
|
| + EXPECT_NE(form, FormStructure(form, std::string()).ToFormData());
|
| }
|
|
|