| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/autofill/form_structure.h" | 8 #include "chrome/browser/autofill/form_structure.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 form.fields.push_back(field); | 280 form.fields.push_back(field); |
| 281 | 281 |
| 282 field.label = ASCIIToUTF16("Email"); | 282 field.label = ASCIIToUTF16("Email"); |
| 283 field.name = ASCIIToUTF16("email"); | 283 field.name = ASCIIToUTF16("email"); |
| 284 form.fields.push_back(field); | 284 form.fields.push_back(field); |
| 285 | 285 |
| 286 field.label = ASCIIToUTF16("Phone"); | 286 field.label = ASCIIToUTF16("Phone"); |
| 287 field.name = ASCIIToUTF16("phone"); | 287 field.name = ASCIIToUTF16("phone"); |
| 288 form.fields.push_back(field); | 288 form.fields.push_back(field); |
| 289 | 289 |
| 290 field.label = ASCIIToUTF16("Fax"); | |
| 291 field.name = ASCIIToUTF16("fax"); | |
| 292 form.fields.push_back(field); | |
| 293 | |
| 294 field.label = ASCIIToUTF16("Address"); | 290 field.label = ASCIIToUTF16("Address"); |
| 295 field.name = ASCIIToUTF16("address"); | 291 field.name = ASCIIToUTF16("address"); |
| 296 form.fields.push_back(field); | 292 form.fields.push_back(field); |
| 297 | 293 |
| 298 field.label = ASCIIToUTF16("City"); | 294 field.label = ASCIIToUTF16("City"); |
| 299 field.name = ASCIIToUTF16("city"); | 295 field.name = ASCIIToUTF16("city"); |
| 300 form.fields.push_back(field); | 296 form.fields.push_back(field); |
| 301 | 297 |
| 302 field.label = ASCIIToUTF16("Zip code"); | 298 field.label = ASCIIToUTF16("Zip code"); |
| 303 field.name = ASCIIToUTF16("zipcode"); | 299 field.name = ASCIIToUTF16("zipcode"); |
| 304 form.fields.push_back(field); | 300 form.fields.push_back(field); |
| 305 | 301 |
| 306 field.label = string16(); | 302 field.label = string16(); |
| 307 field.name = ASCIIToUTF16("Submit"); | 303 field.name = ASCIIToUTF16("Submit"); |
| 308 field.form_control_type = ASCIIToUTF16("submit"); | 304 field.form_control_type = ASCIIToUTF16("submit"); |
| 309 form.fields.push_back(field); | 305 form.fields.push_back(field); |
| 310 | 306 |
| 311 form_structure.reset(new FormStructure(form)); | 307 form_structure.reset(new FormStructure(form)); |
| 312 form_structure->DetermineHeuristicTypes(); | 308 form_structure->DetermineHeuristicTypes(); |
| 313 EXPECT_TRUE(form_structure->IsAutofillable(true)); | 309 EXPECT_TRUE(form_structure->IsAutofillable(true)); |
| 314 | 310 |
| 315 // Expect the correct number of fields. | 311 // Expect the correct number of fields. |
| 316 ASSERT_EQ(9U, form_structure->field_count()); | 312 ASSERT_EQ(8U, form_structure->field_count()); |
| 317 ASSERT_EQ(8U, form_structure->autofill_count()); | 313 ASSERT_EQ(7U, form_structure->autofill_count()); |
| 318 | 314 |
| 319 // First name. | 315 // First name. |
| 320 EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type()); | 316 EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type()); |
| 321 // Last name. | 317 // Last name. |
| 322 EXPECT_EQ(NAME_LAST, form_structure->field(1)->heuristic_type()); | 318 EXPECT_EQ(NAME_LAST, form_structure->field(1)->heuristic_type()); |
| 323 // Email. | 319 // Email. |
| 324 EXPECT_EQ(EMAIL_ADDRESS, form_structure->field(2)->heuristic_type()); | 320 EXPECT_EQ(EMAIL_ADDRESS, form_structure->field(2)->heuristic_type()); |
| 325 // Phone. | 321 // Phone. |
| 326 EXPECT_EQ(PHONE_HOME_WHOLE_NUMBER, | 322 EXPECT_EQ(PHONE_HOME_WHOLE_NUMBER, |
| 327 form_structure->field(3)->heuristic_type()); | 323 form_structure->field(3)->heuristic_type()); |
| 328 // Fax. | |
| 329 EXPECT_EQ(PHONE_FAX_WHOLE_NUMBER, form_structure->field(4)->heuristic_type()); | |
| 330 // Address. | 324 // Address. |
| 331 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(5)->heuristic_type()); | 325 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(4)->heuristic_type()); |
| 332 // City. | 326 // City. |
| 333 EXPECT_EQ(ADDRESS_HOME_CITY, form_structure->field(6)->heuristic_type()); | 327 EXPECT_EQ(ADDRESS_HOME_CITY, form_structure->field(5)->heuristic_type()); |
| 334 // Zip. | 328 // Zip. |
| 335 EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(7)->heuristic_type()); | 329 EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(6)->heuristic_type()); |
| 336 // Submit. | 330 // Submit. |
| 337 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(8)->heuristic_type()); | 331 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(7)->heuristic_type()); |
| 338 } | 332 } |
| 339 | 333 |
| 340 // Verify that we can correctly process the |autocompletetype| attribute. | 334 // Verify that we can correctly process the |autocompletetype| attribute. |
| 341 TEST(FormStructureTest, HeuristicsAutocompletetype) { | 335 TEST(FormStructureTest, HeuristicsAutocompletetype) { |
| 342 scoped_ptr<FormStructure> form_structure; | 336 scoped_ptr<FormStructure> form_structure; |
| 343 FormData form; | 337 FormData form; |
| 344 form.method = ASCIIToUTF16("post"); | 338 form.method = ASCIIToUTF16("post"); |
| 345 | 339 |
| 346 FormField field; | 340 FormField field; |
| 347 field.form_control_type = ASCIIToUTF16("text"); | 341 field.form_control_type = ASCIIToUTF16("text"); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 field.autocomplete_type = ASCIIToUTF16("phone-local"); | 383 field.autocomplete_type = ASCIIToUTF16("phone-local"); |
| 390 form.fields.push_back(field); | 384 form.fields.push_back(field); |
| 391 | 385 |
| 392 field.label = string16(); | 386 field.label = string16(); |
| 393 field.name = ASCIIToUTF16("field2"); | 387 field.name = ASCIIToUTF16("field2"); |
| 394 field.autocomplete_type = ASCIIToUTF16("phone-local-prefix"); | 388 field.autocomplete_type = ASCIIToUTF16("phone-local-prefix"); |
| 395 form.fields.push_back(field); | 389 form.fields.push_back(field); |
| 396 | 390 |
| 397 field.label = string16(); | 391 field.label = string16(); |
| 398 field.name = ASCIIToUTF16("field3"); | 392 field.name = ASCIIToUTF16("field3"); |
| 399 field.autocomplete_type = ASCIIToUTF16("fax-local-suffix"); | 393 field.autocomplete_type = ASCIIToUTF16("phone-local-suffix"); |
| 400 form.fields.push_back(field); | 394 form.fields.push_back(field); |
| 401 | 395 |
| 402 form_structure.reset(new FormStructure(form)); | 396 form_structure.reset(new FormStructure(form)); |
| 403 form_structure->DetermineHeuristicTypes(); | 397 form_structure->DetermineHeuristicTypes(); |
| 404 EXPECT_TRUE(form_structure->IsAutofillable(true)); | 398 EXPECT_TRUE(form_structure->IsAutofillable(true)); |
| 405 | 399 |
| 406 // Expect the correct number of fields. | 400 // Expect the correct number of fields. |
| 407 ASSERT_EQ(3U, form_structure->field_count()); | 401 ASSERT_EQ(3U, form_structure->field_count()); |
| 408 EXPECT_EQ(3U, form_structure->autofill_count()); | 402 EXPECT_EQ(3U, form_structure->autofill_count()); |
| 409 | 403 |
| 410 EXPECT_EQ(PHONE_HOME_NUMBER, form_structure->field(0)->heuristic_type()); | 404 EXPECT_EQ(PHONE_HOME_NUMBER, form_structure->field(0)->heuristic_type()); |
| 411 EXPECT_EQ(AutofillField::IGNORED, form_structure->field(0)->phone_part()); | 405 EXPECT_EQ(AutofillField::IGNORED, form_structure->field(0)->phone_part()); |
| 412 EXPECT_EQ(PHONE_HOME_NUMBER, form_structure->field(1)->heuristic_type()); | 406 EXPECT_EQ(PHONE_HOME_NUMBER, form_structure->field(1)->heuristic_type()); |
| 413 EXPECT_EQ(AutofillField::PHONE_PREFIX, | 407 EXPECT_EQ(AutofillField::PHONE_PREFIX, |
| 414 form_structure->field(1)->phone_part()); | 408 form_structure->field(1)->phone_part()); |
| 415 EXPECT_EQ(PHONE_FAX_NUMBER, form_structure->field(2)->heuristic_type()); | 409 EXPECT_EQ(PHONE_HOME_NUMBER, form_structure->field(2)->heuristic_type()); |
| 416 EXPECT_EQ(AutofillField::PHONE_SUFFIX, | 410 EXPECT_EQ(AutofillField::PHONE_SUFFIX, |
| 417 form_structure->field(2)->phone_part()); | 411 form_structure->field(2)->phone_part()); |
| 418 } | 412 } |
| 419 | 413 |
| 420 // If at least one field includes the |autocompletetype| attribute, we should | 414 // If at least one field includes the |autocompletetype| attribute, we should |
| 421 // not try to apply any other heuristics. | 415 // not try to apply any other heuristics. |
| 422 TEST(FormStructureTest, AutocompletetypeOverridesOtherHeuristics) { | 416 TEST(FormStructureTest, AutocompletetypeOverridesOtherHeuristics) { |
| 423 scoped_ptr<FormStructure> form_structure; | 417 scoped_ptr<FormStructure> form_structure; |
| 424 FormData form; | 418 FormData form; |
| 425 form.method = ASCIIToUTF16("post"); | 419 form.method = ASCIIToUTF16("post"); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 form.fields.push_back(field); | 742 form.fields.push_back(field); |
| 749 | 743 |
| 750 field.label = ASCIIToUTF16("Email"); | 744 field.label = ASCIIToUTF16("Email"); |
| 751 field.name = string16(); | 745 field.name = string16(); |
| 752 form.fields.push_back(field); | 746 form.fields.push_back(field); |
| 753 | 747 |
| 754 field.label = ASCIIToUTF16("Phone"); | 748 field.label = ASCIIToUTF16("Phone"); |
| 755 field.name = string16(); | 749 field.name = string16(); |
| 756 form.fields.push_back(field); | 750 form.fields.push_back(field); |
| 757 | 751 |
| 758 field.label = ASCIIToUTF16("Fax"); | |
| 759 field.name = string16(); | |
| 760 form.fields.push_back(field); | |
| 761 | |
| 762 field.label = ASCIIToUTF16("Address"); | 752 field.label = ASCIIToUTF16("Address"); |
| 763 field.name = string16(); | 753 field.name = string16(); |
| 764 form.fields.push_back(field); | 754 form.fields.push_back(field); |
| 765 | 755 |
| 766 field.label = ASCIIToUTF16("Address"); | 756 field.label = ASCIIToUTF16("Address"); |
| 767 field.name = string16(); | 757 field.name = string16(); |
| 768 form.fields.push_back(field); | 758 form.fields.push_back(field); |
| 769 | 759 |
| 770 field.label = ASCIIToUTF16("Zip code"); | 760 field.label = ASCIIToUTF16("Zip code"); |
| 771 field.name = string16(); | 761 field.name = string16(); |
| 772 form.fields.push_back(field); | 762 form.fields.push_back(field); |
| 773 | 763 |
| 774 field.label = string16(); | 764 field.label = string16(); |
| 775 field.name = ASCIIToUTF16("Submit"); | 765 field.name = ASCIIToUTF16("Submit"); |
| 776 field.form_control_type = ASCIIToUTF16("submit"); | 766 field.form_control_type = ASCIIToUTF16("submit"); |
| 777 form.fields.push_back(field); | 767 form.fields.push_back(field); |
| 778 | 768 |
| 779 form_structure.reset(new FormStructure(form)); | 769 form_structure.reset(new FormStructure(form)); |
| 780 form_structure->DetermineHeuristicTypes(); | 770 form_structure->DetermineHeuristicTypes(); |
| 781 EXPECT_TRUE(form_structure->IsAutofillable(true)); | 771 EXPECT_TRUE(form_structure->IsAutofillable(true)); |
| 782 ASSERT_EQ(9U, form_structure->field_count()); | 772 ASSERT_EQ(8U, form_structure->field_count()); |
| 783 ASSERT_EQ(8U, form_structure->autofill_count()); | 773 ASSERT_EQ(7U, form_structure->autofill_count()); |
| 784 | 774 |
| 785 // First name. | 775 // First name. |
| 786 EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type()); | 776 EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type()); |
| 787 // Last name. | 777 // Last name. |
| 788 EXPECT_EQ(NAME_LAST, form_structure->field(1)->heuristic_type()); | 778 EXPECT_EQ(NAME_LAST, form_structure->field(1)->heuristic_type()); |
| 789 // Email. | 779 // Email. |
| 790 EXPECT_EQ(EMAIL_ADDRESS, form_structure->field(2)->heuristic_type()); | 780 EXPECT_EQ(EMAIL_ADDRESS, form_structure->field(2)->heuristic_type()); |
| 791 // Phone. | 781 // Phone. |
| 792 EXPECT_EQ(PHONE_HOME_WHOLE_NUMBER, | 782 EXPECT_EQ(PHONE_HOME_WHOLE_NUMBER, |
| 793 form_structure->field(3)->heuristic_type()); | 783 form_structure->field(3)->heuristic_type()); |
| 794 // Fax. | |
| 795 EXPECT_EQ(PHONE_FAX_WHOLE_NUMBER, form_structure->field(4)->heuristic_type()); | |
| 796 // Address. | 784 // Address. |
| 797 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(5)->heuristic_type()); | 785 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(4)->heuristic_type()); |
| 798 // Address Line 2. | 786 // Address Line 2. |
| 799 EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(6)->heuristic_type()); | 787 EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(5)->heuristic_type()); |
| 800 // Zip. | 788 // Zip. |
| 801 EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(7)->heuristic_type()); | 789 EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(6)->heuristic_type()); |
| 802 // Submit. | 790 // Submit. |
| 803 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(8)->heuristic_type()); | 791 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(7)->heuristic_type()); |
| 804 } | 792 } |
| 805 | 793 |
| 806 TEST(FormStructureTest, HeuristicsCreditCardInfo) { | 794 TEST(FormStructureTest, HeuristicsCreditCardInfo) { |
| 807 scoped_ptr<FormStructure> form_structure; | 795 scoped_ptr<FormStructure> form_structure; |
| 808 FormData form; | 796 FormData form; |
| 809 form.method = ASCIIToUTF16("post"); | 797 form.method = ASCIIToUTF16("post"); |
| 810 | 798 |
| 811 FormField field; | 799 FormField field; |
| 812 field.form_control_type = ASCIIToUTF16("text"); | 800 field.form_control_type = ASCIIToUTF16("text"); |
| 813 | 801 |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 form.fields.push_back(field); | 1474 form.fields.push_back(field); |
| 1487 possible_field_types.push_back(FieldTypeSet()); | 1475 possible_field_types.push_back(FieldTypeSet()); |
| 1488 possible_field_types.back().insert(PHONE_HOME_WHOLE_NUMBER); | 1476 possible_field_types.back().insert(PHONE_HOME_WHOLE_NUMBER); |
| 1489 | 1477 |
| 1490 field.label = ASCIIToUTF16("Country"); | 1478 field.label = ASCIIToUTF16("Country"); |
| 1491 field.name = ASCIIToUTF16("country"); | 1479 field.name = ASCIIToUTF16("country"); |
| 1492 field.form_control_type = ASCIIToUTF16("select-one"); | 1480 field.form_control_type = ASCIIToUTF16("select-one"); |
| 1493 form.fields.push_back(field); | 1481 form.fields.push_back(field); |
| 1494 possible_field_types.push_back(FieldTypeSet()); | 1482 possible_field_types.push_back(FieldTypeSet()); |
| 1495 possible_field_types.back().insert(ADDRESS_HOME_COUNTRY); | 1483 possible_field_types.back().insert(ADDRESS_HOME_COUNTRY); |
| 1496 | |
| 1497 field.label = ASCIIToUTF16("Fax"); | |
| 1498 field.name = ASCIIToUTF16("fax"); | |
| 1499 field.form_control_type = ASCIIToUTF16("tel"); | |
| 1500 form.fields.push_back(field); | |
| 1501 possible_field_types.push_back(FieldTypeSet()); | |
| 1502 possible_field_types.back().insert(PHONE_FAX_WHOLE_NUMBER); | |
| 1503 form_structure.reset(new FormStructure(form)); | 1484 form_structure.reset(new FormStructure(form)); |
| 1504 | 1485 |
| 1505 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); | 1486 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); |
| 1506 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1487 for (size_t i = 0; i < form_structure->field_count(); ++i) |
| 1507 form_structure->field(i)->set_possible_types(possible_field_types[i]); | 1488 form_structure->field(i)->set_possible_types(possible_field_types[i]); |
| 1508 | 1489 |
| 1509 FieldTypeSet available_field_types; | 1490 FieldTypeSet available_field_types; |
| 1510 available_field_types.insert(NAME_FIRST); | 1491 available_field_types.insert(NAME_FIRST); |
| 1511 available_field_types.insert(NAME_LAST); | 1492 available_field_types.insert(NAME_LAST); |
| 1512 available_field_types.insert(ADDRESS_HOME_LINE1); | 1493 available_field_types.insert(ADDRESS_HOME_LINE1); |
| 1513 available_field_types.insert(ADDRESS_HOME_LINE2); | 1494 available_field_types.insert(ADDRESS_HOME_LINE2); |
| 1514 available_field_types.insert(ADDRESS_HOME_COUNTRY); | 1495 available_field_types.insert(ADDRESS_HOME_COUNTRY); |
| 1515 available_field_types.insert(ADDRESS_BILLING_LINE1); | 1496 available_field_types.insert(ADDRESS_BILLING_LINE1); |
| 1516 available_field_types.insert(ADDRESS_BILLING_LINE2); | 1497 available_field_types.insert(ADDRESS_BILLING_LINE2); |
| 1517 available_field_types.insert(EMAIL_ADDRESS); | 1498 available_field_types.insert(EMAIL_ADDRESS); |
| 1518 available_field_types.insert(PHONE_HOME_WHOLE_NUMBER); | 1499 available_field_types.insert(PHONE_HOME_WHOLE_NUMBER); |
| 1519 available_field_types.insert(PHONE_FAX_WHOLE_NUMBER); | |
| 1520 | 1500 |
| 1521 std::string encoded_xml; | 1501 std::string encoded_xml; |
| 1522 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, false, | 1502 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, false, |
| 1523 &encoded_xml)); | 1503 &encoded_xml)); |
| 1524 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" | 1504 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1525 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " | 1505 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " |
| 1526 "formsignature=\"7641728017676399335\" autofillused=\"false\" " | 1506 "formsignature=\"8736493185895608956\" autofillused=\"false\" " |
| 1527 "datapresent=\"144200830e\">" | 1507 "datapresent=\"144200030e\">" |
| 1528 "<field signature=\"3763331450\" autofilltype=\"3\"/>" | 1508 "<field signature=\"3763331450\" autofilltype=\"3\"/>" |
| 1529 "<field signature=\"3494530716\" autofilltype=\"5\"/>" | 1509 "<field signature=\"3494530716\" autofilltype=\"5\"/>" |
| 1530 "<field signature=\"1029417091\" autofilltype=\"9\"/>" | 1510 "<field signature=\"1029417091\" autofilltype=\"9\"/>" |
| 1531 "<field signature=\"466116101\" autofilltype=\"14\"/>" | 1511 "<field signature=\"466116101\" autofilltype=\"14\"/>" |
| 1532 "<field signature=\"2799270304\" autofilltype=\"36\"/>" | 1512 "<field signature=\"2799270304\" autofilltype=\"36\"/>" |
| 1533 "<field signature=\"1876771436\" autofilltype=\"24\"/>" | |
| 1534 "</autofillupload>", | 1513 "</autofillupload>", |
| 1535 encoded_xml); | 1514 encoded_xml); |
| 1536 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, true, | 1515 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, true, |
| 1537 &encoded_xml)); | 1516 &encoded_xml)); |
| 1538 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" | 1517 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1539 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " | 1518 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " |
| 1540 "formsignature=\"7641728017676399335\" autofillused=\"true\" " | 1519 "formsignature=\"8736493185895608956\" autofillused=\"true\" " |
| 1541 "datapresent=\"144200830e\">" | 1520 "datapresent=\"144200030e\">" |
| 1542 "<field signature=\"3763331450\" autofilltype=\"3\"/>" | 1521 "<field signature=\"3763331450\" autofilltype=\"3\"/>" |
| 1543 "<field signature=\"3494530716\" autofilltype=\"5\"/>" | 1522 "<field signature=\"3494530716\" autofilltype=\"5\"/>" |
| 1544 "<field signature=\"1029417091\" autofilltype=\"9\"/>" | 1523 "<field signature=\"1029417091\" autofilltype=\"9\"/>" |
| 1545 "<field signature=\"466116101\" autofilltype=\"14\"/>" | 1524 "<field signature=\"466116101\" autofilltype=\"14\"/>" |
| 1546 "<field signature=\"2799270304\" autofilltype=\"36\"/>" | 1525 "<field signature=\"2799270304\" autofilltype=\"36\"/>" |
| 1547 "<field signature=\"1876771436\" autofilltype=\"24\"/>" | |
| 1548 "</autofillupload>", | 1526 "</autofillupload>", |
| 1549 encoded_xml); | 1527 encoded_xml); |
| 1550 | 1528 |
| 1551 // Add 2 address fields - this should be still a valid form. | 1529 // Add 2 address fields - this should be still a valid form. |
| 1552 for (size_t i = 0; i < 2; ++i) { | 1530 for (size_t i = 0; i < 2; ++i) { |
| 1553 field.label = ASCIIToUTF16("Address"); | 1531 field.label = ASCIIToUTF16("Address"); |
| 1554 field.name = ASCIIToUTF16("address"); | 1532 field.name = ASCIIToUTF16("address"); |
| 1555 field.form_control_type = ASCIIToUTF16("text"); | 1533 field.form_control_type = ASCIIToUTF16("text"); |
| 1556 form.fields.push_back(field); | 1534 form.fields.push_back(field); |
| 1557 possible_field_types.push_back(FieldTypeSet()); | 1535 possible_field_types.push_back(FieldTypeSet()); |
| 1558 possible_field_types.back().insert(ADDRESS_HOME_LINE1); | 1536 possible_field_types.back().insert(ADDRESS_HOME_LINE1); |
| 1559 possible_field_types.back().insert(ADDRESS_HOME_LINE2); | 1537 possible_field_types.back().insert(ADDRESS_HOME_LINE2); |
| 1560 possible_field_types.back().insert(ADDRESS_BILLING_LINE1); | 1538 possible_field_types.back().insert(ADDRESS_BILLING_LINE1); |
| 1561 possible_field_types.back().insert(ADDRESS_BILLING_LINE2); | 1539 possible_field_types.back().insert(ADDRESS_BILLING_LINE2); |
| 1562 } | 1540 } |
| 1563 | 1541 |
| 1564 form_structure.reset(new FormStructure(form)); | 1542 form_structure.reset(new FormStructure(form)); |
| 1565 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); | 1543 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); |
| 1566 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1544 for (size_t i = 0; i < form_structure->field_count(); ++i) |
| 1567 form_structure->field(i)->set_possible_types(possible_field_types[i]); | 1545 form_structure->field(i)->set_possible_types(possible_field_types[i]); |
| 1568 | 1546 |
| 1569 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, false, | 1547 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, false, |
| 1570 &encoded_xml)); | 1548 &encoded_xml)); |
| 1571 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" | 1549 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1572 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " | 1550 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " |
| 1573 "formsignature=\"12226592129574322128\" autofillused=\"false\" " | 1551 "formsignature=\"7816485729218079147\" autofillused=\"false\" " |
| 1574 "datapresent=\"144200830e\">" | 1552 "datapresent=\"144200030e\">" |
| 1575 "<field signature=\"3763331450\" autofilltype=\"3\"/>" | 1553 "<field signature=\"3763331450\" autofilltype=\"3\"/>" |
| 1576 "<field signature=\"3494530716\" autofilltype=\"5\"/>" | 1554 "<field signature=\"3494530716\" autofilltype=\"5\"/>" |
| 1577 "<field signature=\"1029417091\" autofilltype=\"9\"/>" | 1555 "<field signature=\"1029417091\" autofilltype=\"9\"/>" |
| 1578 "<field signature=\"466116101\" autofilltype=\"14\"/>" | 1556 "<field signature=\"466116101\" autofilltype=\"14\"/>" |
| 1579 "<field signature=\"2799270304\" autofilltype=\"36\"/>" | 1557 "<field signature=\"2799270304\" autofilltype=\"36\"/>" |
| 1580 "<field signature=\"1876771436\" autofilltype=\"24\"/>" | |
| 1581 "<field signature=\"509334676\" autofilltype=\"30\"/>" | 1558 "<field signature=\"509334676\" autofilltype=\"30\"/>" |
| 1582 "<field signature=\"509334676\" autofilltype=\"31\"/>" | 1559 "<field signature=\"509334676\" autofilltype=\"31\"/>" |
| 1583 "<field signature=\"509334676\" autofilltype=\"37\"/>" | 1560 "<field signature=\"509334676\" autofilltype=\"37\"/>" |
| 1584 "<field signature=\"509334676\" autofilltype=\"38\"/>" | 1561 "<field signature=\"509334676\" autofilltype=\"38\"/>" |
| 1585 "<field signature=\"509334676\" autofilltype=\"30\"/>" | 1562 "<field signature=\"509334676\" autofilltype=\"30\"/>" |
| 1586 "<field signature=\"509334676\" autofilltype=\"31\"/>" | 1563 "<field signature=\"509334676\" autofilltype=\"31\"/>" |
| 1587 "<field signature=\"509334676\" autofilltype=\"37\"/>" | 1564 "<field signature=\"509334676\" autofilltype=\"37\"/>" |
| 1588 "<field signature=\"509334676\" autofilltype=\"38\"/>" | 1565 "<field signature=\"509334676\" autofilltype=\"38\"/>" |
| 1589 "</autofillupload>", | 1566 "</autofillupload>", |
| 1590 encoded_xml); | 1567 encoded_xml); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1679 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" | 1656 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1680 " formsignature=\"6402244543831589061\" autofillused=\"false\"" | 1657 " formsignature=\"6402244543831589061\" autofillused=\"false\"" |
| 1681 " datapresent=\"1540000240\">" | 1658 " datapresent=\"1540000240\">" |
| 1682 "<field signature=\"1089846351\" autofilltype=\"1\"/>" | 1659 "<field signature=\"1089846351\" autofilltype=\"1\"/>" |
| 1683 "<field signature=\"2404144663\" autofilltype=\"1\"/>" | 1660 "<field signature=\"2404144663\" autofilltype=\"1\"/>" |
| 1684 "<field signature=\"420638584\" autofilltype=\"1\"/>" | 1661 "<field signature=\"420638584\" autofilltype=\"1\"/>" |
| 1685 "</autofillupload>", | 1662 "</autofillupload>", |
| 1686 encoded_xml); | 1663 encoded_xml); |
| 1687 | 1664 |
| 1688 // All supported non-credit card types available. | 1665 // All supported non-credit card types available. |
| 1689 // datapresent should be "1f7e0f8378000008" == trimmmed(0x1f7e0f8378000008) == | 1666 // datapresent should be "1f7e000378000008" == trimmmed(0x1f7e000378000008) == |
| 1690 // 0b0001111101111110000011111000001101111000000000000000000000001000 | 1667 // 0b0001111101111110000000000000001101111000000000000000000000001000 |
| 1691 // The set bits are: | 1668 // The set bits are: |
| 1692 // 3 == NAME_FIRST | 1669 // 3 == NAME_FIRST |
| 1693 // 4 == NAME_MIDDLE | 1670 // 4 == NAME_MIDDLE |
| 1694 // 5 == NAME_LAST | 1671 // 5 == NAME_LAST |
| 1695 // 6 == NAME_MIDDLE_INITIAL | 1672 // 6 == NAME_MIDDLE_INITIAL |
| 1696 // 7 == NAME_FULL | 1673 // 7 == NAME_FULL |
| 1697 // 9 == EMAIL_ADDRESS | 1674 // 9 == EMAIL_ADDRESS |
| 1698 // 10 == PHONE_HOME_NUMBER, | 1675 // 10 == PHONE_HOME_NUMBER, |
| 1699 // 11 == PHONE_HOME_CITY_CODE, | 1676 // 11 == PHONE_HOME_CITY_CODE, |
| 1700 // 12 == PHONE_HOME_COUNTRY_CODE, | 1677 // 12 == PHONE_HOME_COUNTRY_CODE, |
| 1701 // 13 == PHONE_HOME_CITY_AND_NUMBER, | 1678 // 13 == PHONE_HOME_CITY_AND_NUMBER, |
| 1702 // 14 == PHONE_HOME_WHOLE_NUMBER, | 1679 // 14 == PHONE_HOME_WHOLE_NUMBER, |
| 1703 // 20 == PHONE_FAX_NUMBER, | |
| 1704 // 21 == PHONE_FAX_CITY_CODE, | |
| 1705 // 22 == PHONE_FAX_COUNTRY_CODE, | |
| 1706 // 23 == PHONE_FAX_CITY_AND_NUMBER, | |
| 1707 // 24 == PHONE_FAX_WHOLE_NUMBER, | |
| 1708 // 30 == ADDRESS_HOME_LINE1 | 1680 // 30 == ADDRESS_HOME_LINE1 |
| 1709 // 31 == ADDRESS_HOME_LINE2 | 1681 // 31 == ADDRESS_HOME_LINE2 |
| 1710 // 33 == ADDRESS_HOME_CITY | 1682 // 33 == ADDRESS_HOME_CITY |
| 1711 // 34 == ADDRESS_HOME_STATE | 1683 // 34 == ADDRESS_HOME_STATE |
| 1712 // 35 == ADDRESS_HOME_ZIP | 1684 // 35 == ADDRESS_HOME_ZIP |
| 1713 // 36 == ADDRESS_HOME_COUNTRY | 1685 // 36 == ADDRESS_HOME_COUNTRY |
| 1714 // 60 == COMPANY_NAME | 1686 // 60 == COMPANY_NAME |
| 1715 available_field_types.clear(); | 1687 available_field_types.clear(); |
| 1716 available_field_types.insert(NAME_FIRST); | 1688 available_field_types.insert(NAME_FIRST); |
| 1717 available_field_types.insert(NAME_MIDDLE); | 1689 available_field_types.insert(NAME_MIDDLE); |
| 1718 available_field_types.insert(NAME_LAST); | 1690 available_field_types.insert(NAME_LAST); |
| 1719 available_field_types.insert(NAME_MIDDLE_INITIAL); | 1691 available_field_types.insert(NAME_MIDDLE_INITIAL); |
| 1720 available_field_types.insert(NAME_FULL); | 1692 available_field_types.insert(NAME_FULL); |
| 1721 available_field_types.insert(EMAIL_ADDRESS); | 1693 available_field_types.insert(EMAIL_ADDRESS); |
| 1722 available_field_types.insert(PHONE_HOME_NUMBER); | 1694 available_field_types.insert(PHONE_HOME_NUMBER); |
| 1723 available_field_types.insert(PHONE_HOME_CITY_CODE); | 1695 available_field_types.insert(PHONE_HOME_CITY_CODE); |
| 1724 available_field_types.insert(PHONE_HOME_COUNTRY_CODE); | 1696 available_field_types.insert(PHONE_HOME_COUNTRY_CODE); |
| 1725 available_field_types.insert(PHONE_HOME_CITY_AND_NUMBER); | 1697 available_field_types.insert(PHONE_HOME_CITY_AND_NUMBER); |
| 1726 available_field_types.insert(PHONE_HOME_WHOLE_NUMBER); | 1698 available_field_types.insert(PHONE_HOME_WHOLE_NUMBER); |
| 1727 available_field_types.insert(PHONE_FAX_NUMBER); | |
| 1728 available_field_types.insert(PHONE_FAX_CITY_CODE); | |
| 1729 available_field_types.insert(PHONE_FAX_COUNTRY_CODE); | |
| 1730 available_field_types.insert(PHONE_FAX_CITY_AND_NUMBER); | |
| 1731 available_field_types.insert(PHONE_FAX_WHOLE_NUMBER); | |
| 1732 available_field_types.insert(ADDRESS_HOME_LINE1); | 1699 available_field_types.insert(ADDRESS_HOME_LINE1); |
| 1733 available_field_types.insert(ADDRESS_HOME_LINE2); | 1700 available_field_types.insert(ADDRESS_HOME_LINE2); |
| 1734 available_field_types.insert(ADDRESS_HOME_CITY); | 1701 available_field_types.insert(ADDRESS_HOME_CITY); |
| 1735 available_field_types.insert(ADDRESS_HOME_STATE); | 1702 available_field_types.insert(ADDRESS_HOME_STATE); |
| 1736 available_field_types.insert(ADDRESS_HOME_ZIP); | 1703 available_field_types.insert(ADDRESS_HOME_ZIP); |
| 1737 available_field_types.insert(ADDRESS_HOME_COUNTRY); | 1704 available_field_types.insert(ADDRESS_HOME_COUNTRY); |
| 1738 available_field_types.insert(COMPANY_NAME); | 1705 available_field_types.insert(COMPANY_NAME); |
| 1739 | 1706 |
| 1740 EXPECT_TRUE(form_structure.EncodeUploadRequest(available_field_types, false, | 1707 EXPECT_TRUE(form_structure.EncodeUploadRequest(available_field_types, false, |
| 1741 &encoded_xml)); | 1708 &encoded_xml)); |
| 1742 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" | 1709 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1743 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" | 1710 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1744 " formsignature=\"6402244543831589061\" autofillused=\"false\"" | 1711 " formsignature=\"6402244543831589061\" autofillused=\"false\"" |
| 1745 " datapresent=\"1f7e0f8378000008\">" | 1712 " datapresent=\"1f7e000378000008\">" |
| 1746 "<field signature=\"1089846351\" autofilltype=\"1\"/>" | 1713 "<field signature=\"1089846351\" autofilltype=\"1\"/>" |
| 1747 "<field signature=\"2404144663\" autofilltype=\"1\"/>" | 1714 "<field signature=\"2404144663\" autofilltype=\"1\"/>" |
| 1748 "<field signature=\"420638584\" autofilltype=\"1\"/>" | 1715 "<field signature=\"420638584\" autofilltype=\"1\"/>" |
| 1749 "</autofillupload>", | 1716 "</autofillupload>", |
| 1750 encoded_xml); | 1717 encoded_xml); |
| 1751 | 1718 |
| 1752 // All supported credit card types available. | 1719 // All supported credit card types available. |
| 1753 // datapresent should be "0000000000001fc0" == trimmmed(0x0000000000001fc0) == | 1720 // datapresent should be "0000000000001fc0" == trimmmed(0x0000000000001fc0) == |
| 1754 // 0b0000000000000000000000000000000000000000000000000001111111000000 | 1721 // 0b0000000000000000000000000000000000000000000000000001111111000000 |
| 1755 // The set bits are: | 1722 // The set bits are: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1775 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" | 1742 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1776 " formsignature=\"6402244543831589061\" autofillused=\"false\"" | 1743 " formsignature=\"6402244543831589061\" autofillused=\"false\"" |
| 1777 " datapresent=\"0000000000001fc0\">" | 1744 " datapresent=\"0000000000001fc0\">" |
| 1778 "<field signature=\"1089846351\" autofilltype=\"1\"/>" | 1745 "<field signature=\"1089846351\" autofilltype=\"1\"/>" |
| 1779 "<field signature=\"2404144663\" autofilltype=\"1\"/>" | 1746 "<field signature=\"2404144663\" autofilltype=\"1\"/>" |
| 1780 "<field signature=\"420638584\" autofilltype=\"1\"/>" | 1747 "<field signature=\"420638584\" autofilltype=\"1\"/>" |
| 1781 "</autofillupload>", | 1748 "</autofillupload>", |
| 1782 encoded_xml); | 1749 encoded_xml); |
| 1783 | 1750 |
| 1784 // All supported types available. | 1751 // All supported types available. |
| 1785 // datapresent should be "1f7e0f8378001fc8" == trimmmed(0x1f7e0f8378001fc8) == | 1752 // datapresent should be "1f7e000378001fc8" == trimmmed(0x1f7e000378001fc8) == |
| 1786 // 0b0001111101111110000011111000001101111000000000000001111111001000 | 1753 // 0b0001111101111110000000000000001101111000000000000001111111001000 |
| 1787 // The set bits are: | 1754 // The set bits are: |
| 1788 // 3 == NAME_FIRST | 1755 // 3 == NAME_FIRST |
| 1789 // 4 == NAME_MIDDLE | 1756 // 4 == NAME_MIDDLE |
| 1790 // 5 == NAME_LAST | 1757 // 5 == NAME_LAST |
| 1791 // 6 == NAME_MIDDLE_INITIAL | 1758 // 6 == NAME_MIDDLE_INITIAL |
| 1792 // 7 == NAME_FULL | 1759 // 7 == NAME_FULL |
| 1793 // 9 == EMAIL_ADDRESS | 1760 // 9 == EMAIL_ADDRESS |
| 1794 // 10 == PHONE_HOME_NUMBER, | 1761 // 10 == PHONE_HOME_NUMBER, |
| 1795 // 11 == PHONE_HOME_CITY_CODE, | 1762 // 11 == PHONE_HOME_CITY_CODE, |
| 1796 // 12 == PHONE_HOME_COUNTRY_CODE, | 1763 // 12 == PHONE_HOME_COUNTRY_CODE, |
| 1797 // 13 == PHONE_HOME_CITY_AND_NUMBER, | 1764 // 13 == PHONE_HOME_CITY_AND_NUMBER, |
| 1798 // 14 == PHONE_HOME_WHOLE_NUMBER, | 1765 // 14 == PHONE_HOME_WHOLE_NUMBER, |
| 1799 // 20 == PHONE_FAX_NUMBER, | |
| 1800 // 21 == PHONE_FAX_CITY_CODE, | |
| 1801 // 22 == PHONE_FAX_COUNTRY_CODE, | |
| 1802 // 23 == PHONE_FAX_CITY_AND_NUMBER, | |
| 1803 // 24 == PHONE_FAX_WHOLE_NUMBER, | |
| 1804 // 30 == ADDRESS_HOME_LINE1 | 1766 // 30 == ADDRESS_HOME_LINE1 |
| 1805 // 31 == ADDRESS_HOME_LINE2 | 1767 // 31 == ADDRESS_HOME_LINE2 |
| 1806 // 33 == ADDRESS_HOME_CITY | 1768 // 33 == ADDRESS_HOME_CITY |
| 1807 // 34 == ADDRESS_HOME_STATE | 1769 // 34 == ADDRESS_HOME_STATE |
| 1808 // 35 == ADDRESS_HOME_ZIP | 1770 // 35 == ADDRESS_HOME_ZIP |
| 1809 // 36 == ADDRESS_HOME_COUNTRY | 1771 // 36 == ADDRESS_HOME_COUNTRY |
| 1810 // 51 == CREDIT_CARD_NAME | 1772 // 51 == CREDIT_CARD_NAME |
| 1811 // 52 == CREDIT_CARD_NUMBER | 1773 // 52 == CREDIT_CARD_NUMBER |
| 1812 // 53 == CREDIT_CARD_EXP_MONTH | 1774 // 53 == CREDIT_CARD_EXP_MONTH |
| 1813 // 54 == CREDIT_CARD_EXP_2_DIGIT_YEAR | 1775 // 54 == CREDIT_CARD_EXP_2_DIGIT_YEAR |
| 1814 // 55 == CREDIT_CARD_EXP_4_DIGIT_YEAR | 1776 // 55 == CREDIT_CARD_EXP_4_DIGIT_YEAR |
| 1815 // 56 == CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR | 1777 // 56 == CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR |
| 1816 // 57 == CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR | 1778 // 57 == CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR |
| 1817 // 60 == COMPANY_NAME | 1779 // 60 == COMPANY_NAME |
| 1818 available_field_types.clear(); | 1780 available_field_types.clear(); |
| 1819 available_field_types.insert(NAME_FIRST); | 1781 available_field_types.insert(NAME_FIRST); |
| 1820 available_field_types.insert(NAME_MIDDLE); | 1782 available_field_types.insert(NAME_MIDDLE); |
| 1821 available_field_types.insert(NAME_LAST); | 1783 available_field_types.insert(NAME_LAST); |
| 1822 available_field_types.insert(NAME_MIDDLE_INITIAL); | 1784 available_field_types.insert(NAME_MIDDLE_INITIAL); |
| 1823 available_field_types.insert(NAME_FULL); | 1785 available_field_types.insert(NAME_FULL); |
| 1824 available_field_types.insert(EMAIL_ADDRESS); | 1786 available_field_types.insert(EMAIL_ADDRESS); |
| 1825 available_field_types.insert(PHONE_HOME_NUMBER); | 1787 available_field_types.insert(PHONE_HOME_NUMBER); |
| 1826 available_field_types.insert(PHONE_HOME_CITY_CODE); | 1788 available_field_types.insert(PHONE_HOME_CITY_CODE); |
| 1827 available_field_types.insert(PHONE_HOME_COUNTRY_CODE); | 1789 available_field_types.insert(PHONE_HOME_COUNTRY_CODE); |
| 1828 available_field_types.insert(PHONE_HOME_CITY_AND_NUMBER); | 1790 available_field_types.insert(PHONE_HOME_CITY_AND_NUMBER); |
| 1829 available_field_types.insert(PHONE_HOME_WHOLE_NUMBER); | 1791 available_field_types.insert(PHONE_HOME_WHOLE_NUMBER); |
| 1830 available_field_types.insert(PHONE_FAX_NUMBER); | |
| 1831 available_field_types.insert(PHONE_FAX_CITY_CODE); | |
| 1832 available_field_types.insert(PHONE_FAX_COUNTRY_CODE); | |
| 1833 available_field_types.insert(PHONE_FAX_CITY_AND_NUMBER); | |
| 1834 available_field_types.insert(PHONE_FAX_WHOLE_NUMBER); | |
| 1835 available_field_types.insert(ADDRESS_HOME_LINE1); | 1792 available_field_types.insert(ADDRESS_HOME_LINE1); |
| 1836 available_field_types.insert(ADDRESS_HOME_LINE2); | 1793 available_field_types.insert(ADDRESS_HOME_LINE2); |
| 1837 available_field_types.insert(ADDRESS_HOME_CITY); | 1794 available_field_types.insert(ADDRESS_HOME_CITY); |
| 1838 available_field_types.insert(ADDRESS_HOME_STATE); | 1795 available_field_types.insert(ADDRESS_HOME_STATE); |
| 1839 available_field_types.insert(ADDRESS_HOME_ZIP); | 1796 available_field_types.insert(ADDRESS_HOME_ZIP); |
| 1840 available_field_types.insert(ADDRESS_HOME_COUNTRY); | 1797 available_field_types.insert(ADDRESS_HOME_COUNTRY); |
| 1841 available_field_types.insert(CREDIT_CARD_NAME); | 1798 available_field_types.insert(CREDIT_CARD_NAME); |
| 1842 available_field_types.insert(CREDIT_CARD_NUMBER); | 1799 available_field_types.insert(CREDIT_CARD_NUMBER); |
| 1843 available_field_types.insert(CREDIT_CARD_EXP_MONTH); | 1800 available_field_types.insert(CREDIT_CARD_EXP_MONTH); |
| 1844 available_field_types.insert(CREDIT_CARD_EXP_2_DIGIT_YEAR); | 1801 available_field_types.insert(CREDIT_CARD_EXP_2_DIGIT_YEAR); |
| 1845 available_field_types.insert(CREDIT_CARD_EXP_4_DIGIT_YEAR); | 1802 available_field_types.insert(CREDIT_CARD_EXP_4_DIGIT_YEAR); |
| 1846 available_field_types.insert(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR); | 1803 available_field_types.insert(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR); |
| 1847 available_field_types.insert(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR); | 1804 available_field_types.insert(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR); |
| 1848 available_field_types.insert(COMPANY_NAME); | 1805 available_field_types.insert(COMPANY_NAME); |
| 1849 | 1806 |
| 1850 EXPECT_TRUE(form_structure.EncodeUploadRequest(available_field_types, false, | 1807 EXPECT_TRUE(form_structure.EncodeUploadRequest(available_field_types, false, |
| 1851 &encoded_xml)); | 1808 &encoded_xml)); |
| 1852 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" | 1809 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1853 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" | 1810 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1854 " formsignature=\"6402244543831589061\" autofillused=\"false\"" | 1811 " formsignature=\"6402244543831589061\" autofillused=\"false\"" |
| 1855 " datapresent=\"1f7e0f8378001fc8\">" | 1812 " datapresent=\"1f7e000378001fc8\">" |
| 1856 "<field signature=\"1089846351\" autofilltype=\"1\"/>" | 1813 "<field signature=\"1089846351\" autofilltype=\"1\"/>" |
| 1857 "<field signature=\"2404144663\" autofilltype=\"1\"/>" | 1814 "<field signature=\"2404144663\" autofilltype=\"1\"/>" |
| 1858 "<field signature=\"420638584\" autofilltype=\"1\"/>" | 1815 "<field signature=\"420638584\" autofilltype=\"1\"/>" |
| 1859 "</autofillupload>", | 1816 "</autofillupload>", |
| 1860 encoded_xml); | 1817 encoded_xml); |
| 1861 } | 1818 } |
| 1862 | 1819 |
| 1863 TEST(FormStructureTest, CheckMultipleTypes) { | 1820 TEST(FormStructureTest, CheckMultipleTypes) { |
| 1864 // Throughout this test, datapresent should be | 1821 // Throughout this test, datapresent should be |
| 1865 // 0x1440000360000008 == | 1822 // 0x1440000360000008 == |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 EXPECT_EQ(FormStructureTest::Hash64Bit( | 1980 EXPECT_EQ(FormStructureTest::Hash64Bit( |
| 2024 std::string("https://login.facebook.com&&email&first")), | 1981 std::string("https://login.facebook.com&&email&first")), |
| 2025 form_structure->FormSignature()); | 1982 form_structure->FormSignature()); |
| 2026 | 1983 |
| 2027 form.name = ASCIIToUTF16("login_form"); | 1984 form.name = ASCIIToUTF16("login_form"); |
| 2028 form_structure.reset(new FormStructure(form)); | 1985 form_structure.reset(new FormStructure(form)); |
| 2029 EXPECT_EQ(FormStructureTest::Hash64Bit( | 1986 EXPECT_EQ(FormStructureTest::Hash64Bit( |
| 2030 std::string("https://login.facebook.com&login_form&email&first")), | 1987 std::string("https://login.facebook.com&login_form&email&first")), |
| 2031 form_structure->FormSignature()); | 1988 form_structure->FormSignature()); |
| 2032 } | 1989 } |
| OLD | NEW |