| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "sql/statement.h" | 32 #include "sql/statement.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
| 34 | 34 |
| 35 using base::Time; | 35 using base::Time; |
| 36 using content::BrowserThread; | 36 using content::BrowserThread; |
| 37 | 37 |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| 40 void AutofillProfile31FromStatement(const sql::Statement& s, | 40 void AutofillProfile31FromStatement(const sql::Statement& s, |
| 41 AutofillProfile* profile, | 41 AutofillProfile* profile, |
| 42 string16* label, | 42 base::string16* label, |
| 43 int* unique_id, | 43 int* unique_id, |
| 44 int64* date_modified) { | 44 int64* date_modified) { |
| 45 DCHECK(profile); | 45 DCHECK(profile); |
| 46 DCHECK(label); | 46 DCHECK(label); |
| 47 DCHECK(unique_id); | 47 DCHECK(unique_id); |
| 48 DCHECK(date_modified); | 48 DCHECK(date_modified); |
| 49 *label = s.ColumnString16(0); | 49 *label = s.ColumnString16(0); |
| 50 *unique_id = s.ColumnInt(1); | 50 *unique_id = s.ColumnInt(1); |
| 51 profile->SetRawInfo(NAME_FIRST, s.ColumnString16(2)); | 51 profile->SetRawInfo(NAME_FIRST, s.ColumnString16(2)); |
| 52 profile->SetRawInfo(NAME_MIDDLE, s.ColumnString16(3)); | 52 profile->SetRawInfo(NAME_MIDDLE, s.ColumnString16(3)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 77 profile->SetRawInfo(ADDRESS_HOME_LINE2, s.ColumnString16(3)); | 77 profile->SetRawInfo(ADDRESS_HOME_LINE2, s.ColumnString16(3)); |
| 78 profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(4)); | 78 profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(4)); |
| 79 profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(5)); | 79 profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(5)); |
| 80 profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(6)); | 80 profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(6)); |
| 81 profile->SetInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(7), "en-US"); | 81 profile->SetInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(7), "en-US"); |
| 82 *date_modified = s.ColumnInt64(8); | 82 *date_modified = s.ColumnInt64(8); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void CreditCard31FromStatement(const sql::Statement& s, | 85 void CreditCard31FromStatement(const sql::Statement& s, |
| 86 CreditCard* credit_card, | 86 CreditCard* credit_card, |
| 87 string16* label, | 87 base::string16* label, |
| 88 int* unique_id, | 88 int* unique_id, |
| 89 std::string* encrypted_number, | 89 std::string* encrypted_number, |
| 90 int64* date_modified) { | 90 int64* date_modified) { |
| 91 DCHECK(credit_card); | 91 DCHECK(credit_card); |
| 92 DCHECK(label); | 92 DCHECK(label); |
| 93 DCHECK(unique_id); | 93 DCHECK(unique_id); |
| 94 DCHECK(encrypted_number); | 94 DCHECK(encrypted_number); |
| 95 DCHECK(date_modified); | 95 DCHECK(date_modified); |
| 96 *label = s.ColumnString16(0); | 96 *label = s.ColumnString16(0); |
| 97 *unique_id = s.ColumnInt(1); | 97 *unique_id = s.ColumnInt(1); |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 | 708 |
| 709 // Removes unique IDs and make GUIDs the primary key. Also removes unused | 709 // Removes unique IDs and make GUIDs the primary key. Also removes unused |
| 710 // columns. | 710 // columns. |
| 711 TEST_F(WebDatabaseMigrationTest, MigrateVersion31ToCurrent) { | 711 TEST_F(WebDatabaseMigrationTest, MigrateVersion31ToCurrent) { |
| 712 // Initialize the database. | 712 // Initialize the database. |
| 713 ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_31.sql"))); | 713 ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_31.sql"))); |
| 714 | 714 |
| 715 // Verify pre-conditions. These are expectations for version 30 of the | 715 // Verify pre-conditions. These are expectations for version 30 of the |
| 716 // database. | 716 // database. |
| 717 AutofillProfile profile; | 717 AutofillProfile profile; |
| 718 string16 profile_label; | 718 base::string16 profile_label; |
| 719 int profile_unique_id = 0; | 719 int profile_unique_id = 0; |
| 720 int64 profile_date_modified = 0; | 720 int64 profile_date_modified = 0; |
| 721 CreditCard credit_card; | 721 CreditCard credit_card; |
| 722 string16 cc_label; | 722 base::string16 cc_label; |
| 723 int cc_unique_id = 0; | 723 int cc_unique_id = 0; |
| 724 std::string cc_number_encrypted; | 724 std::string cc_number_encrypted; |
| 725 int64 cc_date_modified = 0; | 725 int64 cc_date_modified = 0; |
| 726 { | 726 { |
| 727 sql::Connection connection; | 727 sql::Connection connection; |
| 728 ASSERT_TRUE(connection.Open(GetDatabasePath())); | 728 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
| 729 | 729 |
| 730 // Verify existence of columns we'll be changing. | 730 // Verify existence of columns we'll be changing. |
| 731 EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "guid")); | 731 EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "guid")); |
| 732 EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "unique_id")); | 732 EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "unique_id")); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 EXPECT_EQ(profile_date_modified, profile_date_modified_a); | 828 EXPECT_EQ(profile_date_modified, profile_date_modified_a); |
| 829 | 829 |
| 830 sql::Statement s2( | 830 sql::Statement s2( |
| 831 connection.GetUniqueStatement( | 831 connection.GetUniqueStatement( |
| 832 "SELECT guid, name_on_card, expiration_month, " | 832 "SELECT guid, name_on_card, expiration_month, " |
| 833 "expiration_year, card_number_encrypted, date_modified " | 833 "expiration_year, card_number_encrypted, date_modified " |
| 834 "FROM credit_cards")); | 834 "FROM credit_cards")); |
| 835 ASSERT_TRUE(s2.Step()); | 835 ASSERT_TRUE(s2.Step()); |
| 836 | 836 |
| 837 CreditCard credit_card_a; | 837 CreditCard credit_card_a; |
| 838 string16 cc_label_a; | 838 base::string16 cc_label_a; |
| 839 std::string cc_number_encrypted_a; | 839 std::string cc_number_encrypted_a; |
| 840 int64 cc_date_modified_a = 0; | 840 int64 cc_date_modified_a = 0; |
| 841 EXPECT_NO_FATAL_FAILURE(CreditCard32FromStatement(s2, | 841 EXPECT_NO_FATAL_FAILURE(CreditCard32FromStatement(s2, |
| 842 &credit_card_a, | 842 &credit_card_a, |
| 843 &cc_number_encrypted_a, | 843 &cc_number_encrypted_a, |
| 844 &cc_date_modified_a)); | 844 &cc_date_modified_a)); |
| 845 EXPECT_EQ(credit_card, credit_card_a); | 845 EXPECT_EQ(credit_card, credit_card_a); |
| 846 EXPECT_EQ(cc_label, cc_label_a); | 846 EXPECT_EQ(cc_label, cc_label_a); |
| 847 EXPECT_EQ(cc_number_encrypted, cc_number_encrypted_a); | 847 EXPECT_EQ(cc_number_encrypted, cc_number_encrypted_a); |
| 848 EXPECT_EQ(cc_date_modified, cc_date_modified_a); | 848 EXPECT_EQ(cc_date_modified, cc_date_modified_a); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); | 963 EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); |
| 964 EXPECT_EQ(ASCIIToUTF16("United States"), s1.ColumnString16(7)); | 964 EXPECT_EQ(ASCIIToUTF16("United States"), s1.ColumnString16(7)); |
| 965 EXPECT_EQ(1297882100L, s1.ColumnInt64(8)); | 965 EXPECT_EQ(1297882100L, s1.ColumnInt64(8)); |
| 966 | 966 |
| 967 // John P. Doe. | 967 // John P. Doe. |
| 968 // Gets merged during migration from 35 to 37 due to multi-valued fields. | 968 // Gets merged during migration from 35 to 37 due to multi-valued fields. |
| 969 | 969 |
| 970 // Dave Smith. | 970 // Dave Smith. |
| 971 ASSERT_TRUE(s1.Step()); | 971 ASSERT_TRUE(s1.Step()); |
| 972 EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s1.ColumnString(0)); | 972 EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s1.ColumnString(0)); |
| 973 EXPECT_EQ(string16(), s1.ColumnString16(1)); | 973 EXPECT_EQ(base::string16(), s1.ColumnString16(1)); |
| 974 EXPECT_EQ(ASCIIToUTF16("2 Main Street"), s1.ColumnString16(2)); | 974 EXPECT_EQ(ASCIIToUTF16("2 Main Street"), s1.ColumnString16(2)); |
| 975 EXPECT_EQ(string16(), s1.ColumnString16(3)); | 975 EXPECT_EQ(base::string16(), s1.ColumnString16(3)); |
| 976 EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); | 976 EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); |
| 977 EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); | 977 EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); |
| 978 EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); | 978 EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); |
| 979 EXPECT_EQ(ASCIIToUTF16("United States"), s1.ColumnString16(7)); | 979 EXPECT_EQ(ASCIIToUTF16("United States"), s1.ColumnString16(7)); |
| 980 EXPECT_EQ(1297882100L, s1.ColumnInt64(8)); | 980 EXPECT_EQ(1297882100L, s1.ColumnInt64(8)); |
| 981 | 981 |
| 982 // Dave Smith (Part 2). | 982 // Dave Smith (Part 2). |
| 983 ASSERT_TRUE(s1.Step()); | 983 ASSERT_TRUE(s1.Step()); |
| 984 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s1.ColumnString(0)); | 984 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s1.ColumnString(0)); |
| 985 EXPECT_EQ(string16(), s1.ColumnString16(1)); | 985 EXPECT_EQ(base::string16(), s1.ColumnString16(1)); |
| 986 EXPECT_EQ(ASCIIToUTF16("2 Main St"), s1.ColumnString16(2)); | 986 EXPECT_EQ(ASCIIToUTF16("2 Main St"), s1.ColumnString16(2)); |
| 987 EXPECT_EQ(string16(), s1.ColumnString16(3)); | 987 EXPECT_EQ(base::string16(), s1.ColumnString16(3)); |
| 988 EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); | 988 EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); |
| 989 EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); | 989 EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); |
| 990 EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); | 990 EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); |
| 991 EXPECT_EQ(ASCIIToUTF16("United States"), s1.ColumnString16(7)); | 991 EXPECT_EQ(ASCIIToUTF16("United States"), s1.ColumnString16(7)); |
| 992 EXPECT_EQ(1297882100L, s1.ColumnInt64(8)); | 992 EXPECT_EQ(1297882100L, s1.ColumnInt64(8)); |
| 993 | 993 |
| 994 // Alfred E Newman. | 994 // Alfred E Newman. |
| 995 // Gets culled during migration from 35 to 36 due to incomplete address. | 995 // Gets culled during migration from 35 to 36 due to incomplete address. |
| 996 | 996 |
| 997 // 3 Main St. | 997 // 3 Main St. |
| 998 ASSERT_TRUE(s1.Step()); | 998 ASSERT_TRUE(s1.Step()); |
| 999 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s1.ColumnString(0)); | 999 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s1.ColumnString(0)); |
| 1000 EXPECT_EQ(string16(), s1.ColumnString16(1)); | 1000 EXPECT_EQ(base::string16(), s1.ColumnString16(1)); |
| 1001 EXPECT_EQ(ASCIIToUTF16("3 Main St"), s1.ColumnString16(2)); | 1001 EXPECT_EQ(ASCIIToUTF16("3 Main St"), s1.ColumnString16(2)); |
| 1002 EXPECT_EQ(string16(), s1.ColumnString16(3)); | 1002 EXPECT_EQ(base::string16(), s1.ColumnString16(3)); |
| 1003 EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); | 1003 EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); |
| 1004 EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); | 1004 EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); |
| 1005 EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); | 1005 EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); |
| 1006 EXPECT_EQ(ASCIIToUTF16("United States"), s1.ColumnString16(7)); | 1006 EXPECT_EQ(ASCIIToUTF16("United States"), s1.ColumnString16(7)); |
| 1007 EXPECT_EQ(1297882100L, s1.ColumnInt64(8)); | 1007 EXPECT_EQ(1297882100L, s1.ColumnInt64(8)); |
| 1008 | 1008 |
| 1009 // That should be all. | 1009 // That should be all. |
| 1010 EXPECT_FALSE(s1.Step()); | 1010 EXPECT_FALSE(s1.Step()); |
| 1011 | 1011 |
| 1012 sql::Statement s2( | 1012 sql::Statement s2( |
| 1013 connection.GetUniqueStatement( | 1013 connection.GetUniqueStatement( |
| 1014 "SELECT guid, first_name, middle_name, last_name " | 1014 "SELECT guid, first_name, middle_name, last_name " |
| 1015 "FROM autofill_profile_names")); | 1015 "FROM autofill_profile_names")); |
| 1016 | 1016 |
| 1017 // John Doe. | 1017 // John Doe. |
| 1018 ASSERT_TRUE(s2.Step()); | 1018 ASSERT_TRUE(s2.Step()); |
| 1019 EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s2.ColumnString(0)); | 1019 EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s2.ColumnString(0)); |
| 1020 EXPECT_EQ(ASCIIToUTF16("John"), s2.ColumnString16(1)); | 1020 EXPECT_EQ(ASCIIToUTF16("John"), s2.ColumnString16(1)); |
| 1021 EXPECT_EQ(string16(), s2.ColumnString16(2)); | 1021 EXPECT_EQ(base::string16(), s2.ColumnString16(2)); |
| 1022 EXPECT_EQ(ASCIIToUTF16("Doe"), s2.ColumnString16(3)); | 1022 EXPECT_EQ(ASCIIToUTF16("Doe"), s2.ColumnString16(3)); |
| 1023 | 1023 |
| 1024 // John P. Doe. Note same guid as above due to merging of multi-valued | 1024 // John P. Doe. Note same guid as above due to merging of multi-valued |
| 1025 // fields. | 1025 // fields. |
| 1026 ASSERT_TRUE(s2.Step()); | 1026 ASSERT_TRUE(s2.Step()); |
| 1027 EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s2.ColumnString(0)); | 1027 EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s2.ColumnString(0)); |
| 1028 EXPECT_EQ(ASCIIToUTF16("John"), s2.ColumnString16(1)); | 1028 EXPECT_EQ(ASCIIToUTF16("John"), s2.ColumnString16(1)); |
| 1029 EXPECT_EQ(ASCIIToUTF16("P."), s2.ColumnString16(2)); | 1029 EXPECT_EQ(ASCIIToUTF16("P."), s2.ColumnString16(2)); |
| 1030 EXPECT_EQ(ASCIIToUTF16("Doe"), s2.ColumnString16(3)); | 1030 EXPECT_EQ(ASCIIToUTF16("Doe"), s2.ColumnString16(3)); |
| 1031 | 1031 |
| 1032 // Dave Smith. | 1032 // Dave Smith. |
| 1033 ASSERT_TRUE(s2.Step()); | 1033 ASSERT_TRUE(s2.Step()); |
| 1034 EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s2.ColumnString(0)); | 1034 EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s2.ColumnString(0)); |
| 1035 EXPECT_EQ(ASCIIToUTF16("Dave"), s2.ColumnString16(1)); | 1035 EXPECT_EQ(ASCIIToUTF16("Dave"), s2.ColumnString16(1)); |
| 1036 EXPECT_EQ(string16(), s2.ColumnString16(2)); | 1036 EXPECT_EQ(base::string16(), s2.ColumnString16(2)); |
| 1037 EXPECT_EQ(ASCIIToUTF16("Smith"), s2.ColumnString16(3)); | 1037 EXPECT_EQ(ASCIIToUTF16("Smith"), s2.ColumnString16(3)); |
| 1038 | 1038 |
| 1039 // Dave Smith (Part 2). | 1039 // Dave Smith (Part 2). |
| 1040 ASSERT_TRUE(s2.Step()); | 1040 ASSERT_TRUE(s2.Step()); |
| 1041 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s2.ColumnString(0)); | 1041 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s2.ColumnString(0)); |
| 1042 EXPECT_EQ(ASCIIToUTF16("Dave"), s2.ColumnString16(1)); | 1042 EXPECT_EQ(ASCIIToUTF16("Dave"), s2.ColumnString16(1)); |
| 1043 EXPECT_EQ(string16(), s2.ColumnString16(2)); | 1043 EXPECT_EQ(base::string16(), s2.ColumnString16(2)); |
| 1044 EXPECT_EQ(ASCIIToUTF16("Smith"), s2.ColumnString16(3)); | 1044 EXPECT_EQ(ASCIIToUTF16("Smith"), s2.ColumnString16(3)); |
| 1045 | 1045 |
| 1046 // Alfred E Newman. | 1046 // Alfred E Newman. |
| 1047 // Gets culled during migration from 35 to 36 due to incomplete address. | 1047 // Gets culled during migration from 35 to 36 due to incomplete address. |
| 1048 | 1048 |
| 1049 // 3 Main St. | 1049 // 3 Main St. |
| 1050 ASSERT_TRUE(s2.Step()); | 1050 ASSERT_TRUE(s2.Step()); |
| 1051 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s2.ColumnString(0)); | 1051 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s2.ColumnString(0)); |
| 1052 EXPECT_EQ(string16(), s2.ColumnString16(1)); | 1052 EXPECT_EQ(base::string16(), s2.ColumnString16(1)); |
| 1053 EXPECT_EQ(string16(), s2.ColumnString16(2)); | 1053 EXPECT_EQ(base::string16(), s2.ColumnString16(2)); |
| 1054 EXPECT_EQ(string16(), s2.ColumnString16(3)); | 1054 EXPECT_EQ(base::string16(), s2.ColumnString16(3)); |
| 1055 | 1055 |
| 1056 // Should be all. | 1056 // Should be all. |
| 1057 EXPECT_FALSE(s2.Step()); | 1057 EXPECT_FALSE(s2.Step()); |
| 1058 | 1058 |
| 1059 sql::Statement s3( | 1059 sql::Statement s3( |
| 1060 connection.GetUniqueStatement( | 1060 connection.GetUniqueStatement( |
| 1061 "SELECT guid, email " | 1061 "SELECT guid, email " |
| 1062 "FROM autofill_profile_emails")); | 1062 "FROM autofill_profile_emails")); |
| 1063 | 1063 |
| 1064 // John Doe. | 1064 // John Doe. |
| 1065 ASSERT_TRUE(s3.Step()); | 1065 ASSERT_TRUE(s3.Step()); |
| 1066 EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s3.ColumnString(0)); | 1066 EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s3.ColumnString(0)); |
| 1067 EXPECT_EQ(ASCIIToUTF16("john@doe.com"), s3.ColumnString16(1)); | 1067 EXPECT_EQ(ASCIIToUTF16("john@doe.com"), s3.ColumnString16(1)); |
| 1068 | 1068 |
| 1069 // John P. Doe. | 1069 // John P. Doe. |
| 1070 // Gets culled during migration from 35 to 37 due to merging of John Doe and | 1070 // Gets culled during migration from 35 to 37 due to merging of John Doe and |
| 1071 // John P. Doe addresses. | 1071 // John P. Doe addresses. |
| 1072 | 1072 |
| 1073 // 2 Main Street. | 1073 // 2 Main Street. |
| 1074 ASSERT_TRUE(s3.Step()); | 1074 ASSERT_TRUE(s3.Step()); |
| 1075 EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s3.ColumnString(0)); | 1075 EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s3.ColumnString(0)); |
| 1076 EXPECT_EQ(string16(), s3.ColumnString16(1)); | 1076 EXPECT_EQ(base::string16(), s3.ColumnString16(1)); |
| 1077 | 1077 |
| 1078 // 2 Main St. | 1078 // 2 Main St. |
| 1079 ASSERT_TRUE(s3.Step()); | 1079 ASSERT_TRUE(s3.Step()); |
| 1080 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s3.ColumnString(0)); | 1080 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s3.ColumnString(0)); |
| 1081 EXPECT_EQ(string16(), s3.ColumnString16(1)); | 1081 EXPECT_EQ(base::string16(), s3.ColumnString16(1)); |
| 1082 | 1082 |
| 1083 // Alfred E Newman. | 1083 // Alfred E Newman. |
| 1084 // Gets culled during migration from 35 to 36 due to incomplete address. | 1084 // Gets culled during migration from 35 to 36 due to incomplete address. |
| 1085 | 1085 |
| 1086 // 3 Main St. | 1086 // 3 Main St. |
| 1087 ASSERT_TRUE(s3.Step()); | 1087 ASSERT_TRUE(s3.Step()); |
| 1088 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s3.ColumnString(0)); | 1088 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s3.ColumnString(0)); |
| 1089 EXPECT_EQ(string16(), s3.ColumnString16(1)); | 1089 EXPECT_EQ(base::string16(), s3.ColumnString16(1)); |
| 1090 | 1090 |
| 1091 // Should be all. | 1091 // Should be all. |
| 1092 EXPECT_FALSE(s3.Step()); | 1092 EXPECT_FALSE(s3.Step()); |
| 1093 | 1093 |
| 1094 sql::Statement s4( | 1094 sql::Statement s4( |
| 1095 connection.GetUniqueStatement( | 1095 connection.GetUniqueStatement( |
| 1096 "SELECT guid, type, number " | 1096 "SELECT guid, type, number " |
| 1097 "FROM autofill_profile_phones")); | 1097 "FROM autofill_profile_phones")); |
| 1098 | 1098 |
| 1099 // John Doe phone. | 1099 // John Doe phone. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1110 // John P. Doe addresses. | 1110 // John P. Doe addresses. |
| 1111 | 1111 |
| 1112 // John P. Doe fax. | 1112 // John P. Doe fax. |
| 1113 // Gets culled during migration from 35 to 37 due to merging of John Doe and | 1113 // Gets culled during migration from 35 to 37 due to merging of John Doe and |
| 1114 // John P. Doe addresses. | 1114 // John P. Doe addresses. |
| 1115 | 1115 |
| 1116 // 2 Main Street phone. | 1116 // 2 Main Street phone. |
| 1117 ASSERT_TRUE(s4.Step()); | 1117 ASSERT_TRUE(s4.Step()); |
| 1118 EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s4.ColumnString(0)); | 1118 EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s4.ColumnString(0)); |
| 1119 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. | 1119 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. |
| 1120 EXPECT_EQ(string16(), s4.ColumnString16(2)); | 1120 EXPECT_EQ(base::string16(), s4.ColumnString16(2)); |
| 1121 | 1121 |
| 1122 // 2 Main Street fax. | 1122 // 2 Main Street fax. |
| 1123 // Gets culled after fax type removed. | 1123 // Gets culled after fax type removed. |
| 1124 | 1124 |
| 1125 // 2 Main St phone. | 1125 // 2 Main St phone. |
| 1126 ASSERT_TRUE(s4.Step()); | 1126 ASSERT_TRUE(s4.Step()); |
| 1127 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s4.ColumnString(0)); | 1127 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s4.ColumnString(0)); |
| 1128 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. | 1128 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. |
| 1129 EXPECT_EQ(string16(), s4.ColumnString16(2)); | 1129 EXPECT_EQ(base::string16(), s4.ColumnString16(2)); |
| 1130 | 1130 |
| 1131 // 2 Main St fax. | 1131 // 2 Main St fax. |
| 1132 // Gets culled after fax type removed. | 1132 // Gets culled after fax type removed. |
| 1133 | 1133 |
| 1134 // Note no phone or fax for Alfred E Newman. | 1134 // Note no phone or fax for Alfred E Newman. |
| 1135 | 1135 |
| 1136 // 3 Main St phone. | 1136 // 3 Main St phone. |
| 1137 ASSERT_TRUE(s4.Step()); | 1137 ASSERT_TRUE(s4.Step()); |
| 1138 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s4.ColumnString(0)); | 1138 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s4.ColumnString(0)); |
| 1139 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. | 1139 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. |
| 1140 EXPECT_EQ(string16(), s4.ColumnString16(2)); | 1140 EXPECT_EQ(base::string16(), s4.ColumnString16(2)); |
| 1141 | 1141 |
| 1142 // 2 Main St fax. | 1142 // 2 Main St fax. |
| 1143 // Gets culled after fax type removed. | 1143 // Gets culled after fax type removed. |
| 1144 | 1144 |
| 1145 // Should be all. | 1145 // Should be all. |
| 1146 EXPECT_FALSE(s4.Step()); | 1146 EXPECT_FALSE(s4.Step()); |
| 1147 } | 1147 } |
| 1148 } | 1148 } |
| 1149 | 1149 |
| 1150 // Adds a column for the autofill profile's country code. | 1150 // Adds a column for the autofill profile's country code. |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1983 ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection)); | 1983 ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection)); |
| 1984 | 1984 |
| 1985 // Check version. | 1985 // Check version. |
| 1986 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); | 1986 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); |
| 1987 | 1987 |
| 1988 // A new column should have been created. | 1988 // A new column should have been created. |
| 1989 EXPECT_TRUE(connection.DoesColumnExist("keywords", | 1989 EXPECT_TRUE(connection.DoesColumnExist("keywords", |
| 1990 "search_terms_replacement_key")); | 1990 "search_terms_replacement_key")); |
| 1991 } | 1991 } |
| 1992 } | 1992 } |
| OLD | NEW |