diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 23:17:34 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 23:17:34 +0000 |
commit | 027dd44a72b43d91eb6185a9be73cc9ae616b485 (patch) | |
tree | dbc63b73f7d2c2dbdba12afff0e82590654a88e6 /chrome/browser/autofill/autofill_profile_unittest.cc | |
parent | 0e34852ad6c4d5bc35f7000392467837211c9a87 (diff) | |
download | chromium_src-027dd44a72b43d91eb6185a9be73cc9ae616b485.zip chromium_src-027dd44a72b43d91eb6185a9be73cc9ae616b485.tar.gz chromium_src-027dd44a72b43d91eb6185a9be73cc9ae616b485.tar.bz2 |
Autofill cleanup of labels
This removes remaining vestiges of profile and credit card labels as a means for identification. Labels do remain in the profile and credit card classes but are private, not persisted to the database, and created upon demand. This also cleans up the web_data_service and web_database methods that used labels as identifiers.
BUG=72929
TEST=WebDataServiceAutofillTest.*:WebDatabaseTest.* and miscellaneous others.
Review URL: http://codereview.chromium.org/6480073
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75028 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/autofill_profile_unittest.cc')
-rw-r--r-- | chrome/browser/autofill/autofill_profile_unittest.cc | 76 |
1 files changed, 34 insertions, 42 deletions
diff --git a/chrome/browser/autofill/autofill_profile_unittest.cc b/chrome/browser/autofill/autofill_profile_unittest.cc index 93e9602..d207bc4 100644 --- a/chrome/browser/autofill/autofill_profile_unittest.cc +++ b/chrome/browser/autofill/autofill_profile_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -35,7 +35,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 0a/empty name and address, so the first two fields of the rest of the // data is used: "Hollywood, CA" AutoFillProfile profile00; - autofill_test::SetProfileInfo(&profile00, "Billing", "", "Mitchell", "", + autofill_test::SetProfileInfo(&profile00, "", "Mitchell", "", "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); EXPECT_TRUE(UpdateProfileLabel(&profile00)); @@ -44,7 +44,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 1: "<address>" AutoFillProfile profile1; - autofill_test::SetProfileInfo(&profile1, "Billing", "", "Mitchell", "", + autofill_test::SetProfileInfo(&profile1, "", "Mitchell", "", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); EXPECT_TRUE(UpdateProfileLabel(&profile1)); @@ -53,7 +53,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 2: "<lastname>" AutoFillProfile profile2; - autofill_test::SetProfileInfo(&profile2, "Billing", "", "Mitchell", + autofill_test::SetProfileInfo(&profile2, "", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); EXPECT_TRUE(UpdateProfileLabel(&profile2)); @@ -63,7 +63,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 3: "<lastname>, <address>" AutoFillProfile profile3; - autofill_test::SetProfileInfo(&profile3, "Billing", "", "Mitchell", + autofill_test::SetProfileInfo(&profile3, "", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); EXPECT_TRUE(UpdateProfileLabel(&profile3)); @@ -72,7 +72,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 4: "<firstname>" AutoFillProfile profile4; - autofill_test::SetProfileInfo(&profile4, "Billing", "Marion", "Mitchell", "", + autofill_test::SetProfileInfo(&profile4, "Marion", "Mitchell", "", "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); EXPECT_TRUE(UpdateProfileLabel(&profile4)); @@ -81,7 +81,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 5: "<firstname>, <address>" AutoFillProfile profile5; - autofill_test::SetProfileInfo(&profile5, "Billing", "Marion", "Mitchell", "", + autofill_test::SetProfileInfo(&profile5, "Marion", "Mitchell", "", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); EXPECT_TRUE(UpdateProfileLabel(&profile5)); @@ -90,7 +90,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 6: "<firstname> <lastname>" AutoFillProfile profile6; - autofill_test::SetProfileInfo(&profile6, "Billing", "Marion", "Mitchell", + autofill_test::SetProfileInfo(&profile6, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); EXPECT_TRUE(UpdateProfileLabel(&profile6)); @@ -100,7 +100,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 7: "<firstname> <lastname>, <address>" AutoFillProfile profile7; - autofill_test::SetProfileInfo(&profile7, "Billing", "Marion", "Mitchell", + autofill_test::SetProfileInfo(&profile7, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); EXPECT_TRUE(UpdateProfileLabel(&profile7)); @@ -111,7 +111,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 7a: "<firstname> <lastname>, <address>" - same as #7, except for // e-mail. AutoFillProfile profile7a; - autofill_test::SetProfileInfo(&profile7a, "Billing", "Marion", "Mitchell", + autofill_test::SetProfileInfo(&profile7a, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); std::vector<AutoFillProfile*> profiles; @@ -131,7 +131,6 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo( profiles[0], - "", "John", "", "Doe", @@ -147,7 +146,6 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo( profiles[1], - "", "Jane", "", "Doe", @@ -172,7 +170,6 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo( profiles[2], - "", "John", "", "Doe", @@ -201,7 +198,6 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo( profiles[2], - "", "John", "", "Doe", @@ -228,7 +224,6 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo( profiles[3], - "", "John", "", "Doe", @@ -260,7 +255,6 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo( profiles[4], - "", "John", "", "Doe", @@ -302,7 +296,6 @@ TEST(AutoFillProfileTest, CreateInferredLabels) { std::vector<AutoFillProfile*> profiles; profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo(profiles[0], - "", "John", "", "Doe", @@ -317,7 +310,6 @@ TEST(AutoFillProfileTest, CreateInferredLabels) { "22222222222"); profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo(profiles[1], - "", "Jane", "", "Doe", @@ -406,11 +398,11 @@ TEST(AutoFillProfileTest, CreateInferredLabelsFallsBackToFullName) { ScopedVector<AutoFillProfile> profiles; profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo(profiles[0], - "", "John", "", "Doe", "doe@example.com", "", + "John", "", "Doe", "doe@example.com", "", "88 Nowhere Ave.", "", "", "", "", "", "", ""); profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo(profiles[1], - "", "Johnny", "K", "Doe", "doe@example.com", "", + "Johnny", "K", "Doe", "doe@example.com", "", "88 Nowhere Ave.", "", "", "", "", "", "", ""); // If the only name field in the suggested fields is the excluded field, we @@ -440,11 +432,11 @@ TEST(AutoFillProfileTest, CreateInferredLabelsNoDuplicatedFields) { ScopedVector<AutoFillProfile> profiles; profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo(profiles[0], - "", "John", "", "Doe", "doe@example.com", "", + "John", "", "Doe", "doe@example.com", "", "88 Nowhere Ave.", "", "", "", "", "", "", ""); profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo(profiles[1], - "", "John", "", "Doe", "dojo@example.com", "", + "John", "", "Doe", "dojo@example.com", "", "88 Nowhere Ave.", "", "", "", "", "", "", ""); // If the only name field in the suggested fields is the excluded field, we @@ -466,15 +458,15 @@ TEST(AutoFillProfileTest, CreateInferredLabelsSkipsEmptyFields) { ScopedVector<AutoFillProfile> profiles; profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo(profiles[0], - "", "John", "", "Doe", "doe@example.com", + "John", "", "Doe", "doe@example.com", "Gogole", "", "", "", "", "", "", "", ""); profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo(profiles[1], - "", "John", "", "Doe", "doe@example.com", + "John", "", "Doe", "doe@example.com", "Ggoole", "", "", "", "", "", "", "", ""); profiles.push_back(new AutoFillProfile); autofill_test::SetProfileInfo(profiles[2], - "", "John", "", "Doe", "john.doe@example.com", + "John", "", "Doe", "john.doe@example.com", "Goolge", "", "", "", "", "", "", "", ""); std::vector<string16> labels; @@ -504,10 +496,10 @@ TEST(AutoFillProfileTest, IsSubsetOf) { // |a| is a subset of |b|. a.reset(new AutoFillProfile); b.reset(new AutoFillProfile); - autofill_test::SetProfileInfo(a.get(), "label1", "Thomas", NULL, "Jefferson", + autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - autofill_test::SetProfileInfo(b.get(), "label2", "Thomas", NULL, "Jefferson", + autofill_test::SetProfileInfo(b.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", "United States Government", "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); EXPECT_TRUE(a->IsSubsetOf(*b)); @@ -521,10 +513,10 @@ TEST(AutoFillProfileTest, IsSubsetOf) { // One field in |b| is different. a.reset(new AutoFillProfile); b.reset(new AutoFillProfile); - autofill_test::SetProfileInfo(a.get(), "label1", "Thomas", NULL, "Jefferson", + autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - autofill_test::SetProfileInfo(a.get(), "label2", "Thomas", NULL, "Adams", + autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Adams", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); EXPECT_FALSE(a->IsSubsetOf(*b)); @@ -538,10 +530,10 @@ TEST(AutoFillProfileTest, IntersectionOfTypesHasEqualValues) { // profiles. a.reset(new AutoFillProfile); b.reset(new AutoFillProfile); - autofill_test::SetProfileInfo(a.get(), "label1", "Thomas", NULL, "Jefferson", + autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "12134759123", "19384284720"); - autofill_test::SetProfileInfo(b.get(), "label2", "Thomas", NULL, "Jefferson", + autofill_test::SetProfileInfo(b.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", "United States Government", "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); EXPECT_TRUE(a->IntersectionOfTypesHasEqualValues(*b)); @@ -550,10 +542,10 @@ TEST(AutoFillProfileTest, IntersectionOfTypesHasEqualValues) { // EMAIL_ADDRESS. The value of EMAIL_ADDRESS differs between the two profiles. a.reset(new AutoFillProfile); b.reset(new AutoFillProfile); - autofill_test::SetProfileInfo(a.get(), "label1", "Thomas", NULL, "Jefferson", + autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "poser@yahoo.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "12134759123", "19384284720"); - autofill_test::SetProfileInfo(b.get(), "label2", "Thomas", NULL, "Jefferson",\ + autofill_test::SetProfileInfo(b.get(), "Thomas", NULL, "Jefferson",\ "declaration_guy@gmail.com", "United States Government", "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); EXPECT_FALSE(a->IntersectionOfTypesHasEqualValues(*b)); @@ -561,10 +553,10 @@ TEST(AutoFillProfileTest, IntersectionOfTypesHasEqualValues) { // Intersection of types is empty. a.reset(new AutoFillProfile); b.reset(new AutoFillProfile); - autofill_test::SetProfileInfo(a.get(), "label1", "Thomas", NULL, "Jefferson", + autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "poser@yahoo.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "12134759123", "19384284720"); - autofill_test::SetProfileInfo(b.get(), "label2", NULL, NULL, NULL, NULL, + autofill_test::SetProfileInfo(b.get(), NULL, NULL, NULL, NULL, "United States Government", "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); EXPECT_FALSE(a->IntersectionOfTypesHasEqualValues(*b)); @@ -576,16 +568,16 @@ TEST(AutoFillProfileTest, MergeWith) { // Merge |b| into |a|. a.reset(new AutoFillProfile); b.reset(new AutoFillProfile); - autofill_test::SetProfileInfo(a.get(), "label1", "Jimmy", NULL, NULL, NULL, + autofill_test::SetProfileInfo(a.get(), "Jimmy", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "12134759123", "19384284720"); - autofill_test::SetProfileInfo(b.get(), "label2", "James", NULL, "Madison", + autofill_test::SetProfileInfo(b.get(), "James", NULL, "Madison", "constitutionalist@gmail.com", "United States Government", "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); AutoFillProfile expected_b(*b); a->MergeWith(*b); AutoFillProfile expected_a; - autofill_test::SetProfileInfo(&expected_a, "label1", "Jimmy", NULL, "Madison", + autofill_test::SetProfileInfo(&expected_a, "Jimmy", NULL, "Madison", "constitutionalist@gmail.com", "United States Government", "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, "12134759123", "19384284720"); @@ -597,7 +589,7 @@ TEST(AutoFillProfileTest, AssignmentOperator){ AutoFillProfile a, b; // Result of assignment should be logically equal to the original profile. - autofill_test::SetProfileInfo(&a, "Billing", "Marion", "Mitchell", "Morrison", + autofill_test::SetProfileInfo(&a, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -613,7 +605,7 @@ TEST(AutoFillProfileTest, Clone) { AutoFillProfile a; // Clone should be logically equal to the original. - autofill_test::SetProfileInfo(&a, "Billing", "Marion", "Mitchell", "Morrison", + autofill_test::SetProfileInfo(&a, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -633,9 +625,9 @@ TEST(AutoFillProfileTest, Compare) { EXPECT_EQ(0, a.Compare(b)); // Different values produce non-zero results. - autofill_test::SetProfileInfo(&a, "label1", "Jimmy", NULL, NULL, NULL, + autofill_test::SetProfileInfo(&a, "Jimmy", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - autofill_test::SetProfileInfo(&b, "label1", "Ringo", NULL, NULL, NULL, + autofill_test::SetProfileInfo(&b, "Ringo", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); EXPECT_GT(0, a.Compare(b)); EXPECT_LT(0, b.Compare(a)); |