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

Unified Diff: components/webdata/common/web_database_migration_unittest.cc

Issue 212873003: Store the language code for the address in autofill profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixups Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/webdata/common/web_database.cc ('k') | sync/protocol/autofill_specifics.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webdata/common/web_database_migration_unittest.cc
diff --git a/components/webdata/common/web_database_migration_unittest.cc b/components/webdata/common/web_database_migration_unittest.cc
index 10bd12a8f0be88187a3e7094ee490cc8043f999f..b0925bc4d0074214756a3db3f60c58f028e608c6 100644
--- a/components/webdata/common/web_database_migration_unittest.cc
+++ b/components/webdata/common/web_database_migration_unittest.cc
@@ -257,7 +257,7 @@ class WebDatabaseMigrationTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(WebDatabaseMigrationTest);
};
-const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 55;
+const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 56;
void WebDatabaseMigrationTest::LoadDatabase(
const base::FilePath::StringType& file) {
@@ -2608,3 +2608,66 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion54ToCurrent) {
ASSERT_FALSE(s.Step());
}
}
+
+// Tests that migrating from version 55 to version 56 adds the language_code
+// column to autofill_profiles table.
+TEST_F(WebDatabaseMigrationTest, MigrateVersion55ToCurrent) {
+ ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_55.sql")));
+
+ // Verify pre-conditions. These are expectations for version 55 of the
+ // database.
+ {
+ sql::Connection connection;
+ ASSERT_TRUE(connection.Open(GetDatabasePath()));
+ ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
+
+ EXPECT_FALSE(
+ connection.DoesColumnExist("autofill_profiles", "language_code"));
+ }
+
+ DoMigration();
+
+ // Verify post-conditions. These are expectations for current version of the
+ // database.
+ {
+ sql::Connection connection;
+ ASSERT_TRUE(connection.Open(GetDatabasePath()));
+ ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
+
+ // Check version.
+ EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
+
+ // The language_code column should have been added to autofill_profiles
+ // table.
+ EXPECT_TRUE(
+ connection.DoesColumnExist("autofill_profiles", "language_code"));
+
+ // Data should have been preserved. Language code should have been set to
+ // empty string.
+ sql::Statement s_profiles(
+ connection.GetUniqueStatement(
+ "SELECT guid, company_name, street_address, dependent_locality,"
+ " city, state, zipcode, sorting_code, country_code, date_modified,"
+ " origin, language_code "
+ "FROM autofill_profiles"));
+
+ ASSERT_TRUE(s_profiles.Step());
+ EXPECT_EQ("00000000-0000-0000-0000-000000000001",
+ s_profiles.ColumnString(0));
+ EXPECT_EQ(ASCIIToUTF16("Google Inc"), s_profiles.ColumnString16(1));
+ EXPECT_EQ(ASCIIToUTF16("340 Main St"),
+ s_profiles.ColumnString16(2));
+ EXPECT_EQ(base::string16(), s_profiles.ColumnString16(3));
+ EXPECT_EQ(ASCIIToUTF16("Los Angeles"), s_profiles.ColumnString16(4));
+ EXPECT_EQ(ASCIIToUTF16("CA"), s_profiles.ColumnString16(5));
+ EXPECT_EQ(ASCIIToUTF16("90291"), s_profiles.ColumnString16(6));
+ EXPECT_EQ(base::string16(), s_profiles.ColumnString16(7));
+ EXPECT_EQ(ASCIIToUTF16("US"), s_profiles.ColumnString16(8));
+ EXPECT_EQ(1395948829, s_profiles.ColumnInt(9));
+ EXPECT_EQ(ASCIIToUTF16("Chrome settings"), s_profiles.ColumnString16(10));
+ EXPECT_EQ(std::string(), s_profiles.ColumnString(11));
+
+ // No more entries expected.
+ ASSERT_FALSE(s_profiles.Step());
+ }
+}
« no previous file with comments | « components/webdata/common/web_database.cc ('k') | sync/protocol/autofill_specifics.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698