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

Side by Side Diff: components/autofill/browser/form_structure_unittest.cc

Issue 13973004: Convert string16 -> base::string16 in components/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "components/autofill/browser/form_structure.h" 5 #include "components/autofill/browser/form_structure.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "components/autofill/browser/autofill_metrics.h" 10 #include "components/autofill/browser/autofill_metrics.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 field.label = ASCIIToUTF16("username"); 70 field.label = ASCIIToUTF16("username");
71 field.name = ASCIIToUTF16("username"); 71 field.name = ASCIIToUTF16("username");
72 field.form_control_type = "text"; 72 field.form_control_type = "text";
73 form.fields.push_back(field); 73 form.fields.push_back(field);
74 74
75 field.label = ASCIIToUTF16("password"); 75 field.label = ASCIIToUTF16("password");
76 field.name = ASCIIToUTF16("password"); 76 field.name = ASCIIToUTF16("password");
77 field.form_control_type = "password"; 77 field.form_control_type = "password";
78 form.fields.push_back(field); 78 form.fields.push_back(field);
79 79
80 field.label = string16(); 80 field.label = base::string16();
81 field.name = ASCIIToUTF16("Submit"); 81 field.name = ASCIIToUTF16("Submit");
82 field.form_control_type = "submit"; 82 field.form_control_type = "submit";
83 form.fields.push_back(field); 83 form.fields.push_back(field);
84 84
85 field.label = ASCIIToUTF16("address1"); 85 field.label = ASCIIToUTF16("address1");
86 field.name = ASCIIToUTF16("address1"); 86 field.name = ASCIIToUTF16("address1");
87 field.form_control_type = "text"; 87 field.form_control_type = "text";
88 field.should_autocomplete = false; 88 field.should_autocomplete = false;
89 form.fields.push_back(field); 89 form.fields.push_back(field);
90 90
(...skipping 21 matching lines...) Expand all
112 field.label = ASCIIToUTF16("password"); 112 field.label = ASCIIToUTF16("password");
113 field.name = ASCIIToUTF16("password"); 113 field.name = ASCIIToUTF16("password");
114 field.form_control_type = "password"; 114 field.form_control_type = "password";
115 form.fields.push_back(field); 115 form.fields.push_back(field);
116 116
117 field.label = ASCIIToUTF16("state"); 117 field.label = ASCIIToUTF16("state");
118 field.name = ASCIIToUTF16("state"); 118 field.name = ASCIIToUTF16("state");
119 field.form_control_type = "select-one"; 119 field.form_control_type = "select-one";
120 form.fields.push_back(field); 120 form.fields.push_back(field);
121 121
122 field.label = string16(); 122 field.label = base::string16();
123 field.name = ASCIIToUTF16("Submit"); 123 field.name = ASCIIToUTF16("Submit");
124 field.form_control_type = "submit"; 124 field.form_control_type = "submit";
125 form.fields.push_back(field); 125 form.fields.push_back(field);
126 126
127 // Only text and select fields that are heuristically matched are counted. 127 // Only text and select fields that are heuristically matched are counted.
128 form_structure.reset(new FormStructure(form, std::string())); 128 form_structure.reset(new FormStructure(form, std::string()));
129 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); 129 form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
130 EXPECT_EQ(1U, form_structure->autofill_count()); 130 EXPECT_EQ(1U, form_structure->autofill_count());
131 131
132 // Add a field with should_autocomplete=false. 132 // Add a field with should_autocomplete=false.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 field.label = ASCIIToUTF16("username"); 176 field.label = ASCIIToUTF16("username");
177 field.name = ASCIIToUTF16("username"); 177 field.name = ASCIIToUTF16("username");
178 field.form_control_type = "text"; 178 field.form_control_type = "text";
179 form.fields.push_back(field); 179 form.fields.push_back(field);
180 180
181 field.label = ASCIIToUTF16("password"); 181 field.label = ASCIIToUTF16("password");
182 field.name = ASCIIToUTF16("password"); 182 field.name = ASCIIToUTF16("password");
183 field.form_control_type = "password"; 183 field.form_control_type = "password";
184 form.fields.push_back(field); 184 form.fields.push_back(field);
185 185
186 field.label = string16(); 186 field.label = base::string16();
187 field.name = ASCIIToUTF16("Submit"); 187 field.name = ASCIIToUTF16("Submit");
188 field.form_control_type = "submit"; 188 field.form_control_type = "submit";
189 form.fields.push_back(field); 189 form.fields.push_back(field);
190 190
191 form_structure.reset(new FormStructure(form, std::string())); 191 form_structure.reset(new FormStructure(form, std::string()));
192 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); 192 form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
193 EXPECT_FALSE(form_structure->IsAutofillable(true)); 193 EXPECT_FALSE(form_structure->IsAutofillable(true));
194 194
195 // We do not limit to three text fields when autocheckout is enabled. 195 // We do not limit to three text fields when autocheckout is enabled.
196 form_structure.reset(new FormStructure(form, "http://fake_url")); 196 form_structure.reset(new FormStructure(form, "http://fake_url"));
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 form.fields.push_back(field); 369 form.fields.push_back(field);
370 370
371 field.label = ASCIIToUTF16("City"); 371 field.label = ASCIIToUTF16("City");
372 field.name = ASCIIToUTF16("city"); 372 field.name = ASCIIToUTF16("city");
373 form.fields.push_back(field); 373 form.fields.push_back(field);
374 374
375 field.label = ASCIIToUTF16("Zip code"); 375 field.label = ASCIIToUTF16("Zip code");
376 field.name = ASCIIToUTF16("zipcode"); 376 field.name = ASCIIToUTF16("zipcode");
377 form.fields.push_back(field); 377 form.fields.push_back(field);
378 378
379 field.label = string16(); 379 field.label = base::string16();
380 field.name = ASCIIToUTF16("Submit"); 380 field.name = ASCIIToUTF16("Submit");
381 field.form_control_type = "submit"; 381 field.form_control_type = "submit";
382 form.fields.push_back(field); 382 form.fields.push_back(field);
383 383
384 form_structure.reset(new FormStructure(form, std::string())); 384 form_structure.reset(new FormStructure(form, std::string()));
385 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); 385 form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
386 EXPECT_TRUE(form_structure->IsAutofillable(true)); 386 EXPECT_TRUE(form_structure->IsAutofillable(true));
387 387
388 // Expect the correct number of fields. 388 // Expect the correct number of fields.
389 ASSERT_EQ(8U, form_structure->field_count()); 389 ASSERT_EQ(8U, form_structure->field_count());
(...skipping 20 matching lines...) Expand all
410 410
411 // Verify that we can correctly process the |autocomplete| attribute. 411 // Verify that we can correctly process the |autocomplete| attribute.
412 TEST(FormStructureTest, HeuristicsAutocompleteAttribute) { 412 TEST(FormStructureTest, HeuristicsAutocompleteAttribute) {
413 scoped_ptr<FormStructure> form_structure; 413 scoped_ptr<FormStructure> form_structure;
414 FormData form; 414 FormData form;
415 form.method = ASCIIToUTF16("post"); 415 form.method = ASCIIToUTF16("post");
416 416
417 FormFieldData field; 417 FormFieldData field;
418 field.form_control_type = "text"; 418 field.form_control_type = "text";
419 419
420 field.label = string16(); 420 field.label = base::string16();
421 field.name = ASCIIToUTF16("field1"); 421 field.name = ASCIIToUTF16("field1");
422 field.autocomplete_attribute = "given-name"; 422 field.autocomplete_attribute = "given-name";
423 form.fields.push_back(field); 423 form.fields.push_back(field);
424 424
425 field.label = string16(); 425 field.label = base::string16();
426 field.name = ASCIIToUTF16("field2"); 426 field.name = ASCIIToUTF16("field2");
427 field.autocomplete_attribute = "family-name"; 427 field.autocomplete_attribute = "family-name";
428 form.fields.push_back(field); 428 form.fields.push_back(field);
429 429
430 field.label = string16(); 430 field.label = base::string16();
431 field.name = ASCIIToUTF16("field3"); 431 field.name = ASCIIToUTF16("field3");
432 field.autocomplete_attribute = "email"; 432 field.autocomplete_attribute = "email";
433 form.fields.push_back(field); 433 form.fields.push_back(field);
434 434
435 form_structure.reset(new FormStructure(form, std::string())); 435 form_structure.reset(new FormStructure(form, std::string()));
436 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); 436 form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
437 EXPECT_TRUE(form_structure->IsAutofillable(true)); 437 EXPECT_TRUE(form_structure->IsAutofillable(true));
438 438
439 // Expect the correct number of fields. 439 // Expect the correct number of fields.
440 ASSERT_EQ(3U, form_structure->field_count()); 440 ASSERT_EQ(3U, form_structure->field_count());
441 ASSERT_EQ(3U, form_structure->autofill_count()); 441 ASSERT_EQ(3U, form_structure->autofill_count());
442 442
443 EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type()); 443 EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type());
444 EXPECT_EQ(NAME_LAST, form_structure->field(1)->heuristic_type()); 444 EXPECT_EQ(NAME_LAST, form_structure->field(1)->heuristic_type());
445 EXPECT_EQ(EMAIL_ADDRESS, form_structure->field(2)->heuristic_type()); 445 EXPECT_EQ(EMAIL_ADDRESS, form_structure->field(2)->heuristic_type());
446 } 446 }
447 447
448 // Verify that we can correctly process the 'autocomplete' attribute for phone 448 // Verify that we can correctly process the 'autocomplete' attribute for phone
449 // number types (especially phone prefixes and suffixes). 449 // number types (especially phone prefixes and suffixes).
450 TEST(FormStructureTest, HeuristicsAutocompleteAttributePhoneTypes) { 450 TEST(FormStructureTest, HeuristicsAutocompleteAttributePhoneTypes) {
451 scoped_ptr<FormStructure> form_structure; 451 scoped_ptr<FormStructure> form_structure;
452 FormData form; 452 FormData form;
453 form.method = ASCIIToUTF16("post"); 453 form.method = ASCIIToUTF16("post");
454 454
455 FormFieldData field; 455 FormFieldData field;
456 field.form_control_type = "text"; 456 field.form_control_type = "text";
457 457
458 field.label = string16(); 458 field.label = base::string16();
459 field.name = ASCIIToUTF16("field1"); 459 field.name = ASCIIToUTF16("field1");
460 field.autocomplete_attribute = "tel-local"; 460 field.autocomplete_attribute = "tel-local";
461 form.fields.push_back(field); 461 form.fields.push_back(field);
462 462
463 field.label = string16(); 463 field.label = base::string16();
464 field.name = ASCIIToUTF16("field2"); 464 field.name = ASCIIToUTF16("field2");
465 field.autocomplete_attribute = "tel-local-prefix"; 465 field.autocomplete_attribute = "tel-local-prefix";
466 form.fields.push_back(field); 466 form.fields.push_back(field);
467 467
468 field.label = string16(); 468 field.label = base::string16();
469 field.name = ASCIIToUTF16("field3"); 469 field.name = ASCIIToUTF16("field3");
470 field.autocomplete_attribute = "tel-local-suffix"; 470 field.autocomplete_attribute = "tel-local-suffix";
471 form.fields.push_back(field); 471 form.fields.push_back(field);
472 472
473 form_structure.reset(new FormStructure(form, std::string())); 473 form_structure.reset(new FormStructure(form, std::string()));
474 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); 474 form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
475 EXPECT_TRUE(form_structure->IsAutofillable(true)); 475 EXPECT_TRUE(form_structure->IsAutofillable(true));
476 476
477 // Expect the correct number of fields. 477 // Expect the correct number of fields.
478 ASSERT_EQ(3U, form_structure->field_count()); 478 ASSERT_EQ(3U, form_structure->field_count());
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 TEST(FormStructureTest, HeuristicsDontOverrideAutocompleteAttributeSections) { 695 TEST(FormStructureTest, HeuristicsDontOverrideAutocompleteAttributeSections) {
696 FormData form; 696 FormData form;
697 form.method = ASCIIToUTF16("post"); 697 form.method = ASCIIToUTF16("post");
698 698
699 FormFieldData field; 699 FormFieldData field;
700 field.form_control_type = "text"; 700 field.form_control_type = "text";
701 701
702 field.name = ASCIIToUTF16("one"); 702 field.name = ASCIIToUTF16("one");
703 field.autocomplete_attribute = "street-address"; 703 field.autocomplete_attribute = "street-address";
704 form.fields.push_back(field); 704 form.fields.push_back(field);
705 field.name = string16(); 705 field.name = base::string16();
706 field.autocomplete_attribute = "section-foo email"; 706 field.autocomplete_attribute = "section-foo email";
707 form.fields.push_back(field); 707 form.fields.push_back(field);
708 field.name = string16(); 708 field.name = base::string16();
709 field.autocomplete_attribute = "name"; 709 field.autocomplete_attribute = "name";
710 form.fields.push_back(field); 710 form.fields.push_back(field);
711 field.name = ASCIIToUTF16("two"); 711 field.name = ASCIIToUTF16("two");
712 field.autocomplete_attribute = "street-address"; 712 field.autocomplete_attribute = "street-address";
713 form.fields.push_back(field); 713 form.fields.push_back(field);
714 714
715 FormStructure form_structure(form, std::string()); 715 FormStructure form_structure(form, std::string());
716 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); 716 form_structure.DetermineHeuristicTypes(TestAutofillMetrics());
717 717
718 // Expect the correct number of fields. 718 // Expect the correct number of fields.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 form.fields.push_back(field); 765 form.fields.push_back(field);
766 766
767 field.label = ASCIIToUTF16("Country:"); 767 field.label = ASCIIToUTF16("Country:");
768 field.name = ASCIIToUTF16("bill.country"); 768 field.name = ASCIIToUTF16("bill.country");
769 form.fields.push_back(field); 769 form.fields.push_back(field);
770 770
771 field.label = ASCIIToUTF16("Phone Number:"); 771 field.label = ASCIIToUTF16("Phone Number:");
772 field.name = ASCIIToUTF16("BillTo.Phone"); 772 field.name = ASCIIToUTF16("BillTo.Phone");
773 form.fields.push_back(field); 773 form.fields.push_back(field);
774 774
775 field.label = string16(); 775 field.label = base::string16();
776 field.name = ASCIIToUTF16("Submit"); 776 field.name = ASCIIToUTF16("Submit");
777 field.form_control_type = "submit"; 777 field.form_control_type = "submit";
778 form.fields.push_back(field); 778 form.fields.push_back(field);
779 779
780 form_structure.reset(new FormStructure(form, std::string())); 780 form_structure.reset(new FormStructure(form, std::string()));
781 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); 781 form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
782 EXPECT_TRUE(form_structure->IsAutofillable(true)); 782 EXPECT_TRUE(form_structure->IsAutofillable(true));
783 ASSERT_EQ(10U, form_structure->field_count()); 783 ASSERT_EQ(10U, form_structure->field_count());
784 ASSERT_EQ(9U, form_structure->autofill_count()); 784 ASSERT_EQ(9U, form_structure->autofill_count());
785 785
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 form.fields.push_back(field); 832 form.fields.push_back(field);
833 833
834 field.label = ASCIIToUTF16("City"); 834 field.label = ASCIIToUTF16("City");
835 field.name = ASCIIToUTF16("city"); 835 field.name = ASCIIToUTF16("city");
836 form.fields.push_back(field); 836 form.fields.push_back(field);
837 837
838 field.label = ASCIIToUTF16("Zip Code"); 838 field.label = ASCIIToUTF16("Zip Code");
839 field.name = ASCIIToUTF16("Home.PostalCode"); 839 field.name = ASCIIToUTF16("Home.PostalCode");
840 form.fields.push_back(field); 840 form.fields.push_back(field);
841 841
842 field.label = string16(); 842 field.label = base::string16();
843 field.name = ASCIIToUTF16("Submit"); 843 field.name = ASCIIToUTF16("Submit");
844 field.value = ASCIIToUTF16("continue"); 844 field.value = ASCIIToUTF16("continue");
845 field.form_control_type = "submit"; 845 field.form_control_type = "submit";
846 form.fields.push_back(field); 846 form.fields.push_back(field);
847 847
848 form_structure.reset(new FormStructure(form, std::string())); 848 form_structure.reset(new FormStructure(form, std::string()));
849 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); 849 form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
850 EXPECT_TRUE(form_structure->IsAutofillable(true)); 850 EXPECT_TRUE(form_structure->IsAutofillable(true));
851 ASSERT_EQ(7U, form_structure->field_count()); 851 ASSERT_EQ(7U, form_structure->field_count());
852 ASSERT_EQ(6U, form_structure->autofill_count()); 852 ASSERT_EQ(6U, form_structure->autofill_count());
(...skipping 19 matching lines...) Expand all
872 // case that input element ids (or |name| fields) are missing. 872 // case that input element ids (or |name| fields) are missing.
873 TEST(FormStructureTest, HeuristicsLabelsOnly) { 873 TEST(FormStructureTest, HeuristicsLabelsOnly) {
874 scoped_ptr<FormStructure> form_structure; 874 scoped_ptr<FormStructure> form_structure;
875 FormData form; 875 FormData form;
876 form.method = ASCIIToUTF16("post"); 876 form.method = ASCIIToUTF16("post");
877 877
878 FormFieldData field; 878 FormFieldData field;
879 field.form_control_type = "text"; 879 field.form_control_type = "text";
880 880
881 field.label = ASCIIToUTF16("First Name"); 881 field.label = ASCIIToUTF16("First Name");
882 field.name = string16(); 882 field.name = base::string16();
883 form.fields.push_back(field); 883 form.fields.push_back(field);
884 884
885 field.label = ASCIIToUTF16("Last Name"); 885 field.label = ASCIIToUTF16("Last Name");
886 field.name = string16(); 886 field.name = base::string16();
887 form.fields.push_back(field); 887 form.fields.push_back(field);
888 888
889 field.label = ASCIIToUTF16("Email"); 889 field.label = ASCIIToUTF16("Email");
890 field.name = string16(); 890 field.name = base::string16();
891 form.fields.push_back(field); 891 form.fields.push_back(field);
892 892
893 field.label = ASCIIToUTF16("Phone"); 893 field.label = ASCIIToUTF16("Phone");
894 field.name = string16(); 894 field.name = base::string16();
895 form.fields.push_back(field); 895 form.fields.push_back(field);
896 896
897 field.label = ASCIIToUTF16("Address"); 897 field.label = ASCIIToUTF16("Address");
898 field.name = string16(); 898 field.name = base::string16();
899 form.fields.push_back(field); 899 form.fields.push_back(field);
900 900
901 field.label = ASCIIToUTF16("Address"); 901 field.label = ASCIIToUTF16("Address");
902 field.name = string16(); 902 field.name = base::string16();
903 form.fields.push_back(field); 903 form.fields.push_back(field);
904 904
905 field.label = ASCIIToUTF16("Zip code"); 905 field.label = ASCIIToUTF16("Zip code");
906 field.name = string16(); 906 field.name = base::string16();
907 form.fields.push_back(field); 907 form.fields.push_back(field);
908 908
909 field.label = string16(); 909 field.label = base::string16();
910 field.name = ASCIIToUTF16("Submit"); 910 field.name = ASCIIToUTF16("Submit");
911 field.form_control_type = "submit"; 911 field.form_control_type = "submit";
912 form.fields.push_back(field); 912 form.fields.push_back(field);
913 913
914 form_structure.reset(new FormStructure(form, std::string())); 914 form_structure.reset(new FormStructure(form, std::string()));
915 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); 915 form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
916 EXPECT_TRUE(form_structure->IsAutofillable(true)); 916 EXPECT_TRUE(form_structure->IsAutofillable(true));
917 ASSERT_EQ(8U, form_structure->field_count()); 917 ASSERT_EQ(8U, form_structure->field_count());
918 ASSERT_EQ(7U, form_structure->autofill_count()); 918 ASSERT_EQ(7U, form_structure->autofill_count());
919 919
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 form.fields.push_back(field); 957 form.fields.push_back(field);
958 958
959 field.label = ASCIIToUTF16("Exp Year"); 959 field.label = ASCIIToUTF16("Exp Year");
960 field.name = ASCIIToUTF16("ccyear"); 960 field.name = ASCIIToUTF16("ccyear");
961 form.fields.push_back(field); 961 form.fields.push_back(field);
962 962
963 field.label = ASCIIToUTF16("Verification"); 963 field.label = ASCIIToUTF16("Verification");
964 field.name = ASCIIToUTF16("verification"); 964 field.name = ASCIIToUTF16("verification");
965 form.fields.push_back(field); 965 form.fields.push_back(field);
966 966
967 field.label = string16(); 967 field.label = base::string16();
968 field.name = ASCIIToUTF16("Submit"); 968 field.name = ASCIIToUTF16("Submit");
969 field.form_control_type = "submit"; 969 field.form_control_type = "submit";
970 form.fields.push_back(field); 970 form.fields.push_back(field);
971 971
972 form_structure.reset(new FormStructure(form, std::string())); 972 form_structure.reset(new FormStructure(form, std::string()));
973 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); 973 form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
974 EXPECT_TRUE(form_structure->IsAutofillable(true)); 974 EXPECT_TRUE(form_structure->IsAutofillable(true));
975 ASSERT_EQ(6U, form_structure->field_count()); 975 ASSERT_EQ(6U, form_structure->field_count());
976 ASSERT_EQ(5U, form_structure->autofill_count()); 976 ASSERT_EQ(5U, form_structure->autofill_count());
977 977
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 form.fields.push_back(field); 1018 form.fields.push_back(field);
1019 1019
1020 field.label = ASCIIToUTF16("Exp Year"); 1020 field.label = ASCIIToUTF16("Exp Year");
1021 field.name = ASCIIToUTF16("ccyear"); 1021 field.name = ASCIIToUTF16("ccyear");
1022 form.fields.push_back(field); 1022 form.fields.push_back(field);
1023 1023
1024 field.label = ASCIIToUTF16("Verification"); 1024 field.label = ASCIIToUTF16("Verification");
1025 field.name = ASCIIToUTF16("verification"); 1025 field.name = ASCIIToUTF16("verification");
1026 form.fields.push_back(field); 1026 form.fields.push_back(field);
1027 1027
1028 field.label = string16(); 1028 field.label = base::string16();
1029 field.name = ASCIIToUTF16("Submit"); 1029 field.name = ASCIIToUTF16("Submit");
1030 field.form_control_type = "submit"; 1030 field.form_control_type = "submit";
1031 form.fields.push_back(field); 1031 form.fields.push_back(field);
1032 1032
1033 form_structure.reset(new FormStructure(form, std::string())); 1033 form_structure.reset(new FormStructure(form, std::string()));
1034 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); 1034 form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
1035 EXPECT_TRUE(form_structure->IsAutofillable(true)); 1035 EXPECT_TRUE(form_structure->IsAutofillable(true));
1036 ASSERT_EQ(7U, form_structure->field_count()); 1036 ASSERT_EQ(7U, form_structure->field_count());
1037 ASSERT_EQ(5U, form_structure->autofill_count()); 1037 ASSERT_EQ(5U, form_structure->autofill_count());
1038 1038
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 form.fields.push_back(field); 1441 form.fields.push_back(field);
1442 1442
1443 field.label = ASCIIToUTF16("Last name"); 1443 field.label = ASCIIToUTF16("Last name");
1444 field.name = ASCIIToUTF16("last_name"); 1444 field.name = ASCIIToUTF16("last_name");
1445 form.fields.push_back(field); 1445 form.fields.push_back(field);
1446 1446
1447 field.label = ASCIIToUTF16("Expiration date"); 1447 field.label = ASCIIToUTF16("Expiration date");
1448 field.name = ASCIIToUTF16("ccexpiresmonth"); 1448 field.name = ASCIIToUTF16("ccexpiresmonth");
1449 form.fields.push_back(field); 1449 form.fields.push_back(field);
1450 1450
1451 field.label = string16(); 1451 field.label = base::string16();
1452 field.name = ASCIIToUTF16("ccexpiresyear"); 1452 field.name = ASCIIToUTF16("ccexpiresyear");
1453 form.fields.push_back(field); 1453 form.fields.push_back(field);
1454 1454
1455 field.label = ASCIIToUTF16("cvc number"); 1455 field.label = ASCIIToUTF16("cvc number");
1456 field.name = ASCIIToUTF16("csc"); 1456 field.name = ASCIIToUTF16("csc");
1457 form.fields.push_back(field); 1457 form.fields.push_back(field);
1458 1458
1459 form_structure.reset(new FormStructure(form, std::string())); 1459 form_structure.reset(new FormStructure(form, std::string()));
1460 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); 1460 form_structure->DetermineHeuristicTypes(TestAutofillMetrics());
1461 EXPECT_TRUE(form_structure->IsAutofillable(true)); 1461 EXPECT_TRUE(form_structure->IsAutofillable(true));
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 field.label = ASCIIToUTF16("username"); 2201 field.label = ASCIIToUTF16("username");
2202 field.name = ASCIIToUTF16("username"); 2202 field.name = ASCIIToUTF16("username");
2203 field.form_control_type = "text"; 2203 field.form_control_type = "text";
2204 form.fields.push_back(field); 2204 form.fields.push_back(field);
2205 2205
2206 field.label = ASCIIToUTF16("password"); 2206 field.label = ASCIIToUTF16("password");
2207 field.name = ASCIIToUTF16("password"); 2207 field.name = ASCIIToUTF16("password");
2208 field.form_control_type = "password"; 2208 field.form_control_type = "password";
2209 form.fields.push_back(field); 2209 form.fields.push_back(field);
2210 2210
2211 field.label = string16(); 2211 field.label = base::string16();
2212 field.name = ASCIIToUTF16("Submit"); 2212 field.name = ASCIIToUTF16("Submit");
2213 field.form_control_type = "submit"; 2213 field.form_control_type = "submit";
2214 form.fields.push_back(field); 2214 form.fields.push_back(field);
2215 2215
2216 EXPECT_EQ(form, FormStructure(form, std::string()).ToFormData()); 2216 EXPECT_EQ(form, FormStructure(form, std::string()).ToFormData());
2217 2217
2218 // Currently |FormStructure(form_data)ToFormData().user_submitted| is always 2218 // Currently |FormStructure(form_data)ToFormData().user_submitted| is always
2219 // false. This forces a future author that changes this to update this test. 2219 // false. This forces a future author that changes this to update this test.
2220 form.user_submitted = true; 2220 form.user_submitted = true;
2221 EXPECT_NE(form, FormStructure(form, std::string()).ToFormData()); 2221 EXPECT_NE(form, FormStructure(form, std::string()).ToFormData());
2222 } 2222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698