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

Side by Side Diff: chrome/browser/webdata/web_database_migration_unittest.cc

Issue 7892048: Autofill: Remove fax number completely. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix. Created 9 years, 3 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
« no previous file with comments | « chrome/browser/webdata/autofill_table_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 5 #include <string>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/scoped_temp_dir.h" 8 #include "base/scoped_temp_dir.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 profile->SetInfo(NAME_LAST, s.ColumnString16(4)); 44 profile->SetInfo(NAME_LAST, s.ColumnString16(4));
45 profile->SetInfo(EMAIL_ADDRESS, s.ColumnString16(5)); 45 profile->SetInfo(EMAIL_ADDRESS, s.ColumnString16(5));
46 profile->SetInfo(COMPANY_NAME, s.ColumnString16(6)); 46 profile->SetInfo(COMPANY_NAME, s.ColumnString16(6));
47 profile->SetInfo(ADDRESS_HOME_LINE1, s.ColumnString16(7)); 47 profile->SetInfo(ADDRESS_HOME_LINE1, s.ColumnString16(7));
48 profile->SetInfo(ADDRESS_HOME_LINE2, s.ColumnString16(8)); 48 profile->SetInfo(ADDRESS_HOME_LINE2, s.ColumnString16(8));
49 profile->SetInfo(ADDRESS_HOME_CITY, s.ColumnString16(9)); 49 profile->SetInfo(ADDRESS_HOME_CITY, s.ColumnString16(9));
50 profile->SetInfo(ADDRESS_HOME_STATE, s.ColumnString16(10)); 50 profile->SetInfo(ADDRESS_HOME_STATE, s.ColumnString16(10));
51 profile->SetInfo(ADDRESS_HOME_ZIP, s.ColumnString16(11)); 51 profile->SetInfo(ADDRESS_HOME_ZIP, s.ColumnString16(11));
52 profile->SetInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(12)); 52 profile->SetInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(12));
53 profile->SetInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(13)); 53 profile->SetInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(13));
54 profile->SetInfo(PHONE_FAX_WHOLE_NUMBER, s.ColumnString16(14));
55 *date_modified = s.ColumnInt64(15); 54 *date_modified = s.ColumnInt64(15);
56 profile->set_guid(s.ColumnString(16)); 55 profile->set_guid(s.ColumnString(16));
57 EXPECT_TRUE(guid::IsValidGUID(profile->guid())); 56 EXPECT_TRUE(guid::IsValidGUID(profile->guid()));
58 } 57 }
59 58
60 void AutofillProfile33FromStatement(const sql::Statement& s, 59 void AutofillProfile33FromStatement(const sql::Statement& s,
61 AutofillProfile* profile, 60 AutofillProfile* profile,
62 int64* date_modified) { 61 int64* date_modified) {
63 DCHECK(profile); 62 DCHECK(profile);
64 DCHECK(date_modified); 63 DCHECK(date_modified);
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 "SELECT guid, type, number " 1159 "SELECT guid, type, number "
1161 "FROM autofill_profile_phones")); 1160 "FROM autofill_profile_phones"));
1162 1161
1163 // John Doe phone. 1162 // John Doe phone.
1164 ASSERT_TRUE(s4.Step()); 1163 ASSERT_TRUE(s4.Step());
1165 EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s4.ColumnString(0)); 1164 EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s4.ColumnString(0));
1166 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. 1165 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone.
1167 EXPECT_EQ(ASCIIToUTF16("4151112222"), s4.ColumnString16(2)); 1166 EXPECT_EQ(ASCIIToUTF16("4151112222"), s4.ColumnString16(2));
1168 1167
1169 // John Doe fax. 1168 // John Doe fax.
1170 ASSERT_TRUE(s4.Step()); 1169 // Gets culled after fax type removed.
1171 EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s4.ColumnString(0));
1172 EXPECT_EQ(1, s4.ColumnInt(1)); // 1 means phone.
1173 EXPECT_EQ(ASCIIToUTF16("4153334444"), s4.ColumnString16(2));
1174 1170
1175 // John P. Doe phone. 1171 // John P. Doe phone.
1176 // Gets culled during migration from 35 to 37 due to merging of John Doe and 1172 // Gets culled during migration from 35 to 37 due to merging of John Doe and
1177 // John P. Doe addresses. 1173 // John P. Doe addresses.
1178 1174
1179 // John P. Doe fax. 1175 // John P. Doe fax.
1180 // Gets culled during migration from 35 to 37 due to merging of John Doe and 1176 // Gets culled during migration from 35 to 37 due to merging of John Doe and
1181 // John P. Doe addresses. 1177 // John P. Doe addresses.
1182 1178
1183 // 2 Main Street phone. 1179 // 2 Main Street phone.
1184 ASSERT_TRUE(s4.Step()); 1180 ASSERT_TRUE(s4.Step());
1185 EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s4.ColumnString(0)); 1181 EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s4.ColumnString(0));
1186 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. 1182 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone.
1187 EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2)); 1183 EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2));
1188 1184
1189 // 2 Main Street fax. 1185 // 2 Main Street fax.
1190 ASSERT_TRUE(s4.Step()); 1186 // Gets culled after fax type removed.
1191 EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s4.ColumnString(0));
1192 EXPECT_EQ(1, s4.ColumnInt(1)); // 1 means fax.
1193 EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2));
1194 1187
1195 // 2 Main St phone. 1188 // 2 Main St phone.
1196 ASSERT_TRUE(s4.Step()); 1189 ASSERT_TRUE(s4.Step());
1197 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s4.ColumnString(0)); 1190 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s4.ColumnString(0));
1198 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. 1191 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone.
1199 EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2)); 1192 EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2));
1200 1193
1201 // 2 Main St fax. 1194 // 2 Main St fax.
1202 ASSERT_TRUE(s4.Step()); 1195 // Gets culled after fax type removed.
1203 EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s4.ColumnString(0));
1204 EXPECT_EQ(1, s4.ColumnInt(1)); // 1 means fax.
1205 EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2));
1206 1196
1207 // Note no phone or fax for Alfred E Newman. 1197 // Note no phone or fax for Alfred E Newman.
1208 1198
1209 // 3 Main St phone. 1199 // 3 Main St phone.
1210 ASSERT_TRUE(s4.Step()); 1200 ASSERT_TRUE(s4.Step());
1211 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s4.ColumnString(0)); 1201 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s4.ColumnString(0));
1212 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. 1202 EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone.
1213 EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2)); 1203 EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2));
1214 1204
1215 // 2 Main St fax. 1205 // 2 Main St fax.
1216 ASSERT_TRUE(s4.Step()); 1206 // Gets culled after fax type removed.
1217 EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s4.ColumnString(0));
1218 EXPECT_EQ(1, s4.ColumnInt(1)); // 1 means fax.
1219 EXPECT_EQ(ASCIIToUTF16(""), s4.ColumnString16(2));
1220 1207
1221 // Should be all. 1208 // Should be all.
1222 EXPECT_FALSE(s4.Step()); 1209 EXPECT_FALSE(s4.Step());
1223 } 1210 }
1224 } 1211 }
1225 1212
1226 // Adds a column for the autofill profile's country code. 1213 // Adds a column for the autofill profile's country code.
1227 TEST_F(WebDatabaseMigrationTest, MigrateVersion33ToCurrent) { 1214 TEST_F(WebDatabaseMigrationTest, MigrateVersion33ToCurrent) {
1228 // Initialize the database. 1215 // Initialize the database.
1229 ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_33.sql"))); 1216 ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_33.sql")));
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 ASSERT_TRUE(connection.Open(GetDatabasePath())); 1484 ASSERT_TRUE(connection.Open(GetDatabasePath()));
1498 1485
1499 // Check version. 1486 // Check version.
1500 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); 1487 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
1501 1488
1502 // |keywords| |sync_guid| column should have been added. 1489 // |keywords| |sync_guid| column should have been added.
1503 EXPECT_TRUE(connection.DoesColumnExist("keywords", "id")); 1490 EXPECT_TRUE(connection.DoesColumnExist("keywords", "id"));
1504 EXPECT_TRUE(connection.DoesColumnExist("keywords", "sync_guid")); 1491 EXPECT_TRUE(connection.DoesColumnExist("keywords", "sync_guid"));
1505 } 1492 }
1506 } 1493 }
OLDNEW
« no previous file with comments | « chrome/browser/webdata/autofill_table_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698