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 <list> | 5 #include <list> |
6 #include <map> | 6 #include <map> |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 EXPECT_LE(s_billing_updated_2.ColumnInt64(0), | 1528 EXPECT_LE(s_billing_updated_2.ColumnInt64(0), |
1529 post_modification_time_2.ToTimeT()); | 1529 post_modification_time_2.ToTimeT()); |
1530 EXPECT_FALSE(s_billing_updated_2.Step()); | 1530 EXPECT_FALSE(s_billing_updated_2.Step()); |
1531 delete db_profile; | 1531 delete db_profile; |
1532 | 1532 |
1533 // Remove the 'Billing' profile. | 1533 // Remove the 'Billing' profile. |
1534 EXPECT_TRUE(db.RemoveAutofillProfile(billing_profile.guid())); | 1534 EXPECT_TRUE(db.RemoveAutofillProfile(billing_profile.guid())); |
1535 EXPECT_FALSE(db.GetAutofillProfile(billing_profile.guid(), &db_profile)); | 1535 EXPECT_FALSE(db.GetAutofillProfile(billing_profile.guid(), &db_profile)); |
1536 } | 1536 } |
1537 | 1537 |
| 1538 TEST_F(WebDatabaseTest, AutofillProfileTrash) { |
| 1539 WebDatabase db; |
| 1540 |
| 1541 ASSERT_EQ(sql::INIT_OK, db.Init(file_)); |
| 1542 |
| 1543 std::vector<std::string> guids; |
| 1544 db.GetAutofillProfilesInTrash(&guids); |
| 1545 EXPECT_TRUE(guids.empty()); |
| 1546 |
| 1547 ASSERT_TRUE( |
| 1548 db.AddAutofillGUIDToTrash("00000000-0000-0000-0000-000000000000")); |
| 1549 ASSERT_TRUE( |
| 1550 db.AddAutofillGUIDToTrash("00000000-0000-0000-0000-000000000001")); |
| 1551 ASSERT_TRUE(db.GetAutofillProfilesInTrash(&guids)); |
| 1552 EXPECT_EQ(2UL, guids.size()); |
| 1553 EXPECT_EQ("00000000-0000-0000-0000-000000000000", guids[0]); |
| 1554 EXPECT_EQ("00000000-0000-0000-0000-000000000001", guids[1]); |
| 1555 |
| 1556 ASSERT_TRUE(db.EmptyAutofillProfilesTrash()); |
| 1557 ASSERT_TRUE(db.GetAutofillProfilesInTrash(&guids)); |
| 1558 EXPECT_TRUE(guids.empty()); |
| 1559 } |
| 1560 |
| 1561 TEST_F(WebDatabaseTest, AutofillProfileTrashInteraction) { |
| 1562 WebDatabase db; |
| 1563 |
| 1564 ASSERT_EQ(sql::INIT_OK, db.Init(file_)); |
| 1565 |
| 1566 std::vector<std::string> guids; |
| 1567 db.GetAutofillProfilesInTrash(&guids); |
| 1568 EXPECT_TRUE(guids.empty()); |
| 1569 |
| 1570 AutofillProfile profile; |
| 1571 profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("John")); |
| 1572 profile.SetInfo(AutofillType(NAME_MIDDLE), ASCIIToUTF16("Q.")); |
| 1573 profile.SetInfo(AutofillType(NAME_LAST), ASCIIToUTF16("Smith")); |
| 1574 profile.SetInfo(AutofillType(EMAIL_ADDRESS),ASCIIToUTF16("js@smith.xyz")); |
| 1575 profile.SetInfo(AutofillType(ADDRESS_HOME_LINE1), ASCIIToUTF16("1 Main St")); |
| 1576 profile.SetInfo(AutofillType(ADDRESS_HOME_CITY), ASCIIToUTF16("Los Angeles")); |
| 1577 profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), ASCIIToUTF16("CA")); |
| 1578 profile.SetInfo(AutofillType(ADDRESS_HOME_ZIP), ASCIIToUTF16("90025")); |
| 1579 profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("US")); |
| 1580 |
| 1581 // Mark this profile as in the trash. This stops |AddAutofillProfile| from |
| 1582 // adding it. |
| 1583 EXPECT_TRUE(db.AddAutofillGUIDToTrash(profile.guid())); |
| 1584 EXPECT_TRUE(db.AddAutofillProfile(profile)); |
| 1585 AutofillProfile* added_profile = NULL; |
| 1586 EXPECT_FALSE(db.GetAutofillProfile(profile.guid(), &added_profile)); |
| 1587 EXPECT_EQ(static_cast<AutofillProfile*>(NULL), added_profile); |
| 1588 |
| 1589 // Add the profile for real this time. |
| 1590 EXPECT_TRUE(db.EmptyAutofillProfilesTrash()); |
| 1591 EXPECT_TRUE(db.GetAutofillProfilesInTrash(&guids)); |
| 1592 EXPECT_TRUE(guids.empty()); |
| 1593 EXPECT_TRUE(db.AddAutofillProfile(profile)); |
| 1594 EXPECT_TRUE(db.GetAutofillProfile(profile.guid(), &added_profile)); |
| 1595 ASSERT_NE(static_cast<AutofillProfile*>(NULL), added_profile); |
| 1596 delete added_profile; |
| 1597 |
| 1598 // Mark this profile as in the trash. This stops |UpdateAutofillProfile| from |
| 1599 // updating it. In normal operation a profile should not be both in the trash |
| 1600 // and in the profiles table simultaneously. |
| 1601 EXPECT_TRUE(db.AddAutofillGUIDToTrash(profile.guid())); |
| 1602 profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Jane")); |
| 1603 EXPECT_TRUE(db.UpdateAutofillProfile(profile)); |
| 1604 AutofillProfile* updated_profile = NULL; |
| 1605 EXPECT_TRUE(db.GetAutofillProfile(profile.guid(), &updated_profile)); |
| 1606 ASSERT_NE(static_cast<AutofillProfile*>(NULL), added_profile); |
| 1607 EXPECT_EQ(ASCIIToUTF16("John"), |
| 1608 updated_profile->GetFieldText(AutofillType(NAME_FIRST))); |
| 1609 delete updated_profile; |
| 1610 |
| 1611 // Try to delete the trashed profile. This stops |RemoveAutofillProfile| from |
| 1612 // deleting it. In normal operation deletion is done by migration step, and |
| 1613 // removal from trash is done by |WebDataService|. |RemoveAutofillProfile| |
| 1614 // does remove the item from the trash if it is found however, so that if |
| 1615 // other clients remove it (via Sync say) then it is gone and doesn't need to |
| 1616 // be processed further by |WebDataService|. |
| 1617 EXPECT_TRUE(db.RemoveAutofillProfile(profile.guid())); |
| 1618 AutofillProfile* removed_profile = NULL; |
| 1619 EXPECT_TRUE(db.GetAutofillProfile(profile.guid(), &removed_profile)); |
| 1620 EXPECT_FALSE(db.IsAutofillGUIDInTrash(profile.guid())); |
| 1621 ASSERT_NE(static_cast<AutofillProfile*>(NULL), removed_profile); |
| 1622 delete removed_profile; |
| 1623 |
| 1624 // Check that emptying the trash now allows removal to occur. |
| 1625 EXPECT_TRUE(db.EmptyAutofillProfilesTrash()); |
| 1626 EXPECT_TRUE(db.RemoveAutofillProfile(profile.guid())); |
| 1627 removed_profile = NULL; |
| 1628 EXPECT_FALSE(db.GetAutofillProfile(profile.guid(), &removed_profile)); |
| 1629 EXPECT_EQ(static_cast<AutofillProfile*>(NULL), removed_profile); |
| 1630 } |
| 1631 |
1538 TEST_F(WebDatabaseTest, CreditCard) { | 1632 TEST_F(WebDatabaseTest, CreditCard) { |
1539 WebDatabase db; | 1633 WebDatabase db; |
1540 | 1634 |
1541 ASSERT_EQ(sql::INIT_OK, db.Init(file_)); | 1635 ASSERT_EQ(sql::INIT_OK, db.Init(file_)); |
1542 | 1636 |
1543 // Add a 'Work' credit card. | 1637 // Add a 'Work' credit card. |
1544 CreditCard work_creditcard; | 1638 CreditCard work_creditcard; |
1545 work_creditcard.SetInfo(AutofillType(CREDIT_CARD_NAME), | 1639 work_creditcard.SetInfo(AutofillType(CREDIT_CARD_NAME), |
1546 ASCIIToUTF16("Jack Torrance")); | 1640 ASCIIToUTF16("Jack Torrance")); |
1547 work_creditcard.SetInfo(AutofillType(CREDIT_CARD_NUMBER), | 1641 work_creditcard.SetInfo(AutofillType(CREDIT_CARD_NUMBER), |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 | 2191 |
2098 // Assertion testing for migrating from version 27 and 28. | 2192 // Assertion testing for migrating from version 27 and 28. |
2099 void MigrateVersion28Assertions(); | 2193 void MigrateVersion28Assertions(); |
2100 | 2194 |
2101 private: | 2195 private: |
2102 ScopedTempDir temp_dir_; | 2196 ScopedTempDir temp_dir_; |
2103 | 2197 |
2104 DISALLOW_COPY_AND_ASSIGN(WebDatabaseMigrationTest); | 2198 DISALLOW_COPY_AND_ASSIGN(WebDatabaseMigrationTest); |
2105 }; | 2199 }; |
2106 | 2200 |
2107 const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 35; | 2201 const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 36; |
2108 | 2202 |
2109 void WebDatabaseMigrationTest::LoadDatabase(const FilePath::StringType& file) { | 2203 void WebDatabaseMigrationTest::LoadDatabase(const FilePath::StringType& file) { |
2110 std::string contents; | 2204 std::string contents; |
2111 ASSERT_TRUE(GetWebDatabaseData(FilePath(file), &contents)); | 2205 ASSERT_TRUE(GetWebDatabaseData(FilePath(file), &contents)); |
2112 | 2206 |
2113 sql::Connection connection; | 2207 sql::Connection connection; |
2114 ASSERT_TRUE(connection.Open(GetDatabasePath())); | 2208 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
2115 ASSERT_TRUE(connection.Execute(contents.data())); | 2209 ASSERT_TRUE(connection.Execute(contents.data())); |
2116 } | 2210 } |
2117 | 2211 |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2976 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(1)); | 3070 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(1)); |
2977 EXPECT_EQ(ASCIIToUTF16("2 Main St"), s1.ColumnString16(2)); | 3071 EXPECT_EQ(ASCIIToUTF16("2 Main St"), s1.ColumnString16(2)); |
2978 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(3)); | 3072 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(3)); |
2979 EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); | 3073 EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); |
2980 EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); | 3074 EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); |
2981 EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); | 3075 EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); |
2982 EXPECT_EQ(ASCIIToUTF16("United States"), s1.ColumnString16(7)); | 3076 EXPECT_EQ(ASCIIToUTF16("United States"), s1.ColumnString16(7)); |
2983 EXPECT_EQ(1297882100L, s1.ColumnInt64(8)); | 3077 EXPECT_EQ(1297882100L, s1.ColumnInt64(8)); |
2984 | 3078 |
2985 // Alfred E Newman. | 3079 // Alfred E Newman. |
2986 ASSERT_TRUE(s1.Step()); | 3080 // Gets culled during migration from 35 to 36 due to incomplete address. |
2987 EXPECT_EQ("584282AC-5D21-8D73-A2DB-4F892EF61F3F", s1.ColumnString(0)); | |
2988 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(1)); | |
2989 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(2)); | |
2990 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(3)); | |
2991 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(4)); | |
2992 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(5)); | |
2993 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(6)); | |
2994 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(7)); | |
2995 EXPECT_EQ(1297882100L, s1.ColumnInt64(8)); | |
2996 | 3081 |
2997 // 3 Main St. | 3082 // 3 Main St. |
2998 ASSERT_TRUE(s1.Step()); | 3083 ASSERT_TRUE(s1.Step()); |
2999 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s1.ColumnString(0)); | 3084 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s1.ColumnString(0)); |
3000 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(1)); | 3085 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(1)); |
3001 EXPECT_EQ(ASCIIToUTF16("3 Main St"), s1.ColumnString16(2)); | 3086 EXPECT_EQ(ASCIIToUTF16("3 Main St"), s1.ColumnString16(2)); |
3002 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(3)); | 3087 EXPECT_EQ(ASCIIToUTF16(""), s1.ColumnString16(3)); |
3003 EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); | 3088 EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); |
3004 EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); | 3089 EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); |
3005 EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); | 3090 EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); |
(...skipping 30 matching lines...) Expand all Loading... |
3036 EXPECT_EQ(ASCIIToUTF16("Smith"), s2.ColumnString16(3)); | 3121 EXPECT_EQ(ASCIIToUTF16("Smith"), s2.ColumnString16(3)); |
3037 | 3122 |
3038 // Dave Smith (Part 2). | 3123 // Dave Smith (Part 2). |
3039 ASSERT_TRUE(s2.Step()); | 3124 ASSERT_TRUE(s2.Step()); |
3040 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s2.ColumnString(0)); | 3125 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s2.ColumnString(0)); |
3041 EXPECT_EQ(ASCIIToUTF16("Dave"), s2.ColumnString16(1)); | 3126 EXPECT_EQ(ASCIIToUTF16("Dave"), s2.ColumnString16(1)); |
3042 EXPECT_EQ(ASCIIToUTF16(""), s2.ColumnString16(2)); | 3127 EXPECT_EQ(ASCIIToUTF16(""), s2.ColumnString16(2)); |
3043 EXPECT_EQ(ASCIIToUTF16("Smith"), s2.ColumnString16(3)); | 3128 EXPECT_EQ(ASCIIToUTF16("Smith"), s2.ColumnString16(3)); |
3044 | 3129 |
3045 // Alfred E Newman. | 3130 // Alfred E Newman. |
3046 ASSERT_TRUE(s2.Step()); | 3131 // Gets culled during migration from 35 to 36 due to incomplete address. |
3047 EXPECT_EQ("584282AC-5D21-8D73-A2DB-4F892EF61F3F", s2.ColumnString(0)); | |
3048 EXPECT_EQ(ASCIIToUTF16("Alfred"), s2.ColumnString16(1)); | |
3049 EXPECT_EQ(ASCIIToUTF16("E"), s2.ColumnString16(2)); | |
3050 EXPECT_EQ(ASCIIToUTF16("Newman"), s2.ColumnString16(3)); | |
3051 | 3132 |
3052 // Note no name for 3 Main St. | 3133 // Note no name for 3 Main St. |
3053 | 3134 |
3054 // Should be all. | 3135 // Should be all. |
3055 EXPECT_FALSE(s2.Step()); | 3136 EXPECT_FALSE(s2.Step()); |
3056 | 3137 |
3057 sql::Statement s3( | 3138 sql::Statement s3( |
3058 connection.GetUniqueStatement( | 3139 connection.GetUniqueStatement( |
3059 "SELECT guid, email " | 3140 "SELECT guid, email " |
3060 "FROM autofill_profile_emails")); | 3141 "FROM autofill_profile_emails")); |
3061 | 3142 |
3062 // John Doe. | 3143 // John Doe. |
3063 ASSERT_TRUE(s3.Step()); | 3144 ASSERT_TRUE(s3.Step()); |
3064 EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s3.ColumnString(0)); | 3145 EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s3.ColumnString(0)); |
3065 EXPECT_EQ(ASCIIToUTF16("john@doe.com"), s3.ColumnString16(1)); | 3146 EXPECT_EQ(ASCIIToUTF16("john@doe.com"), s3.ColumnString16(1)); |
3066 | 3147 |
3067 // John P. Doe. | 3148 // John P. Doe. |
3068 ASSERT_TRUE(s3.Step()); | 3149 ASSERT_TRUE(s3.Step()); |
3069 EXPECT_EQ("589636FD-9037-3053-200C-80ABC97D7344", s3.ColumnString(0)); | 3150 EXPECT_EQ("589636FD-9037-3053-200C-80ABC97D7344", s3.ColumnString(0)); |
3070 EXPECT_EQ(ASCIIToUTF16("john@doe.com"), s3.ColumnString16(1)); | 3151 EXPECT_EQ(ASCIIToUTF16("john@doe.com"), s3.ColumnString16(1)); |
3071 | 3152 |
3072 // Note no email for 2 Main Street. | 3153 // Note no email for 2 Main Street. |
3073 // Note no email for 2 Main St. | 3154 // Note no email for 2 Main St. |
3074 | 3155 |
3075 // Alfred E Newman. | 3156 // Alfred E Newman. |
3076 ASSERT_TRUE(s3.Step()); | 3157 // Gets culled during migration from 35 to 36 due to incomplete address. |
3077 EXPECT_EQ("584282AC-5D21-8D73-A2DB-4F892EF61F3F", s3.ColumnString(0)); | |
3078 EXPECT_EQ(ASCIIToUTF16("a@e.com"), s3.ColumnString16(1)); | |
3079 | 3158 |
3080 // Note no email for 3 Main St. | 3159 // Note no email for 3 Main St. |
3081 | 3160 |
3082 // Should be all. | 3161 // Should be all. |
3083 EXPECT_FALSE(s3.Step()); | 3162 EXPECT_FALSE(s3.Step()); |
3084 | 3163 |
3085 sql::Statement s4( | 3164 sql::Statement s4( |
3086 connection.GetUniqueStatement( | 3165 connection.GetUniqueStatement( |
3087 "SELECT guid, type, number " | 3166 "SELECT guid, type, number " |
3088 "FROM autofill_profile_phones")); | 3167 "FROM autofill_profile_phones")); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3224 "SELECT country_code FROM autofill_profiles")); | 3303 "SELECT country_code FROM autofill_profiles")); |
3225 | 3304 |
3226 ASSERT_TRUE(s.Step()); | 3305 ASSERT_TRUE(s.Step()); |
3227 std::string country_code = s.ColumnString(0); | 3306 std::string country_code = s.ColumnString(0); |
3228 EXPECT_EQ("GB", country_code); | 3307 EXPECT_EQ("GB", country_code); |
3229 | 3308 |
3230 // Should have only one. | 3309 // Should have only one. |
3231 ASSERT_FALSE(s.Step()); | 3310 ASSERT_FALSE(s.Step()); |
3232 } | 3311 } |
3233 } | 3312 } |
| 3313 |
| 3314 // Cleans up invalid profiles based on more agressive merging. Filters out |
| 3315 // profiles that are subsets of other profiles, and profiles with invalid email, |
| 3316 // state, and incomplete address. |
| 3317 TEST_F(WebDatabaseMigrationTest, MigrateVersion35ToCurrent) { |
| 3318 // Initialize the database. |
| 3319 ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_35.sql"))); |
| 3320 |
| 3321 // Verify pre-conditions. These are expectations for version 34 of the |
| 3322 // database. |
| 3323 { |
| 3324 sql::Connection connection; |
| 3325 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
| 3326 |
| 3327 EXPECT_FALSE(connection.DoesTableExist("autofill_profiles_trash")); |
| 3328 ASSERT_TRUE(connection.DoesColumnExist("autofill_profiles", "guid")); |
| 3329 |
| 3330 // Check that there are 6 profiles prior to merge. |
| 3331 sql::Statement s( |
| 3332 connection.GetUniqueStatement("SELECT guid FROM autofill_profiles")); |
| 3333 int i = 0; |
| 3334 while (s.Step()) |
| 3335 ++i; |
| 3336 EXPECT_EQ(6, i); |
| 3337 } |
| 3338 |
| 3339 // Load the database via the WebDatabase class and migrate the database to |
| 3340 // the current version. |
| 3341 { |
| 3342 WebDatabase db; |
| 3343 ASSERT_EQ(sql::INIT_OK, db.Init(GetDatabasePath())); |
| 3344 } |
| 3345 |
| 3346 // Verify post-conditions. These are expectations for current version of the |
| 3347 // database. |
| 3348 { |
| 3349 sql::Connection connection; |
| 3350 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
| 3351 |
| 3352 // Check version. |
| 3353 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); |
| 3354 |
| 3355 ASSERT_TRUE(connection.DoesTableExist("autofill_profiles_trash")); |
| 3356 ASSERT_TRUE(connection.DoesColumnExist("autofill_profiles_trash", "guid")); |
| 3357 ASSERT_TRUE(connection.DoesColumnExist("autofill_profiles", "guid")); |
| 3358 |
| 3359 // Verify data in the database after the migration. |
| 3360 sql::Statement s1( |
| 3361 connection.GetUniqueStatement( |
| 3362 "SELECT guid, company_name, address_line_1, address_line_2, " |
| 3363 "city, state, zipcode, country, date_modified " |
| 3364 "FROM autofill_profiles")); |
| 3365 |
| 3366 // John Doe. |
| 3367 ASSERT_TRUE(s1.Step()); |
| 3368 EXPECT_EQ("00000000-0000-0000-0000-000000000001", s1.ColumnString(0)); |
| 3369 EXPECT_EQ(ASCIIToUTF16("Acme Inc."), s1.ColumnString16(1)); |
| 3370 EXPECT_EQ(ASCIIToUTF16("1 Main Street"), s1.ColumnString16(2)); |
| 3371 EXPECT_EQ(ASCIIToUTF16("Apt 2"), s1.ColumnString16(3)); |
| 3372 EXPECT_EQ(ASCIIToUTF16("San Francisco"), s1.ColumnString16(4)); |
| 3373 EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); |
| 3374 EXPECT_EQ(ASCIIToUTF16("94102"), s1.ColumnString16(6)); |
| 3375 EXPECT_EQ(ASCIIToUTF16("United States"), s1.ColumnString16(7)); |
| 3376 EXPECT_EQ(1300131704, s1.ColumnInt64(8)); |
| 3377 |
| 3378 // That should be it. |
| 3379 ASSERT_FALSE(s1.Step()); |
| 3380 |
| 3381 // Check that there 5 trashed profile after the merge. |
| 3382 sql::Statement s2( |
| 3383 connection.GetUniqueStatement("SELECT guid " |
| 3384 "FROM autofill_profiles_trash")); |
| 3385 ASSERT_TRUE(s2.Step()); |
| 3386 EXPECT_EQ("00000000-0000-0000-0000-000000000002", s2.ColumnString(0)); |
| 3387 |
| 3388 ASSERT_TRUE(s2.Step()); |
| 3389 EXPECT_EQ("00000000-0000-0000-0000-000000000003", s2.ColumnString(0)); |
| 3390 |
| 3391 ASSERT_TRUE(s2.Step()); |
| 3392 EXPECT_EQ("00000000-0000-0000-0000-000000000004", s2.ColumnString(0)); |
| 3393 |
| 3394 ASSERT_TRUE(s2.Step()); |
| 3395 EXPECT_EQ("00000000-0000-0000-0000-000000000005", s2.ColumnString(0)); |
| 3396 |
| 3397 ASSERT_TRUE(s2.Step()); |
| 3398 EXPECT_EQ("00000000-0000-0000-0000-000000000006", s2.ColumnString(0)); |
| 3399 |
| 3400 // That should be it. |
| 3401 ASSERT_FALSE(s2.Step()); |
| 3402 } |
| 3403 } |
OLD | NEW |