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

Side by Side Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 1814883002: [Autofill] Check for full state name and abbreviation when determining types to upload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 3308 matching lines...) Expand 10 before | Expand all | Expand 10 after
3319 // Set up the test profiles. 3319 // Set up the test profiles.
3320 std::vector<AutofillProfile> profiles; 3320 std::vector<AutofillProfile> profiles;
3321 AutofillProfile profile; 3321 AutofillProfile profile;
3322 test::SetProfileInfo(&profile, "Elvis", "Aaron", "Presley", 3322 test::SetProfileInfo(&profile, "Elvis", "Aaron", "Presley",
3323 "theking@gmail.com", "RCA", "3734 Elvis Presley Blvd.", 3323 "theking@gmail.com", "RCA", "3734 Elvis Presley Blvd.",
3324 "Apt. 10", "Memphis", "Tennessee", "38116", "US", 3324 "Apt. 10", "Memphis", "Tennessee", "38116", "US",
3325 "+1 (234) 567-8901"); 3325 "+1 (234) 567-8901");
3326 profile.set_guid("00000000-0000-0000-0000-000000000001"); 3326 profile.set_guid("00000000-0000-0000-0000-000000000001");
3327 profiles.push_back(profile); 3327 profiles.push_back(profile);
3328 test::SetProfileInfo(&profile, "Charles", "", "Holley", "buddy@gmail.com", 3328 test::SetProfileInfo(&profile, "Charles", "", "Holley", "buddy@gmail.com",
3329 "Decca", "123 Apple St.", "unit 6", "Lubbock", "Texas", 3329 "Decca", "123 Apple St.", "unit 6", "Lubbock", "TX",
3330 "79401", "US", "5142821292"); 3330 "79401", "US", "5142821292");
3331 profile.set_guid("00000000-0000-0000-0000-000000000002"); 3331 profile.set_guid("00000000-0000-0000-0000-000000000002");
3332 profiles.push_back(profile); 3332 profiles.push_back(profile);
3333 test::SetProfileInfo(&profile, "Charles", "", "Baudelaire", 3333 test::SetProfileInfo(&profile, "Charles", "", "Baudelaire",
3334 "lesfleursdumal@gmail.com", "", "108 Rue Saint-Lazare", 3334 "lesfleursdumal@gmail.com", "", "108 Rue Saint-Lazare",
3335 "Apt. 10", "Paris", "Ile de France", "75008", "FR", 3335 "Apt. 10", "Paris", "Ile de France", "75008", "FR",
3336 "+33 2 49 19 70 70"); 3336 "+33 2 49 19 70 70");
3337 profile.set_guid("00000000-0000-0000-0000-000000000001"); 3337 profile.set_guid("00000000-0000-0000-0000-000000000001");
3338 profiles.push_back(profile); 3338 profiles.push_back(profile);
3339 3339
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 {"Elvis ", NAME_FIRST}, 3406 {"Elvis ", NAME_FIRST},
3407 3407
3408 // Make sure fields that differ by case match. 3408 // Make sure fields that differ by case match.
3409 {"elvis ", NAME_FIRST}, 3409 {"elvis ", NAME_FIRST},
3410 {"UnItEd StAtEs", ADDRESS_HOME_COUNTRY}, 3410 {"UnItEd StAtEs", ADDRESS_HOME_COUNTRY},
3411 3411
3412 // Make sure fields that differ by punctuation match. 3412 // Make sure fields that differ by punctuation match.
3413 {"3734 Elvis Presley Blvd", ADDRESS_HOME_LINE1}, 3413 {"3734 Elvis Presley Blvd", ADDRESS_HOME_LINE1},
3414 {"3734, Elvis Presley Blvd.", ADDRESS_HOME_LINE1}, 3414 {"3734, Elvis Presley Blvd.", ADDRESS_HOME_LINE1},
3415 3415
3416 // Make sure that a state's full name and abbreviation match.
3417 {"TN", ADDRESS_HOME_STATE}, // Saved as "Tennessee" in profile.
3418 {"Texas", ADDRESS_HOME_STATE}, // Saved as "TX" in profile.
3419
3416 // Special phone number case. A profile with no country code should only 3420 // Special phone number case. A profile with no country code should only
3417 // match PHONE_HOME_CITY_AND_NUMBER. 3421 // match PHONE_HOME_CITY_AND_NUMBER.
3418 {"5142821292", PHONE_HOME_CITY_AND_NUMBER}, 3422 {"5142821292", PHONE_HOME_CITY_AND_NUMBER},
3419 3423
3420 // Make sure unsupported variants do not match. 3424 // Make sure unsupported variants do not match.
3421 {"Elvis Aaron", UNKNOWN_TYPE}, 3425 {"Elvis Aaron", UNKNOWN_TYPE},
3422 {"Mr. Presley", UNKNOWN_TYPE}, 3426 {"Mr. Presley", UNKNOWN_TYPE},
3423 {"3734 Elvis Presley", UNKNOWN_TYPE}, 3427 {"3734 Elvis Presley", UNKNOWN_TYPE},
3424 {"TN", UNKNOWN_TYPE},
3425 {"38116-1023", UNKNOWN_TYPE}, 3428 {"38116-1023", UNKNOWN_TYPE},
3426 {"5", UNKNOWN_TYPE}, 3429 {"5", UNKNOWN_TYPE},
3427 {"56", UNKNOWN_TYPE}, 3430 {"56", UNKNOWN_TYPE},
3428 {"901", UNKNOWN_TYPE}}; 3431 {"901", UNKNOWN_TYPE}};
3429 3432
3430 for (TestCase test_case : test_cases) { 3433 for (TestCase test_case : test_cases) {
3431 FormData form; 3434 FormData form;
3432 form.name = ASCIIToUTF16("MyForm"); 3435 form.name = ASCIIToUTF16("MyForm");
3433 form.origin = GURL("http://myform.com/form.html"); 3436 form.origin = GURL("http://myform.com/form.html");
3434 form.action = GURL("http://myform.com/submit.html"); 3437 form.action = GURL("http://myform.com/submit.html");
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
4608 FormsSeen(mixed_forms); 4611 FormsSeen(mixed_forms);
4609 4612
4610 // Suggestions should always be displayed. 4613 // Suggestions should always be displayed.
4611 for (const FormFieldData& field : mixed_form.fields) { 4614 for (const FormFieldData& field : mixed_form.fields) {
4612 GetAutofillSuggestions(mixed_form, field); 4615 GetAutofillSuggestions(mixed_form, field);
4613 EXPECT_TRUE(external_delegate_->on_suggestions_returned_seen()); 4616 EXPECT_TRUE(external_delegate_->on_suggestions_returned_seen());
4614 } 4617 }
4615 } 4618 }
4616 4619
4617 } // namespace autofill 4620 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698