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

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

Issue 207643002: Create new Autofill tables as part of DB migration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 9 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') | components/webdata/common/web_database_table.h » ('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 d4e51f6e83340fa45ec546190720585d3e8f1de2..0d0c487407001b75497d0fad519ccf548b417cbd 100644
--- a/components/webdata/common/web_database_migration_unittest.cc
+++ b/components/webdata/common/web_database_migration_unittest.cc
@@ -292,6 +292,40 @@ TEST_F(WebDatabaseMigrationTest, MigrateEmptyToCurrent) {
}
}
+// Tests that absent Autofill tables do not create any problems when migrating
+// from a DB written by the earliest publicly released version of Chrome.
+TEST_F(WebDatabaseMigrationTest, MigrateVersion20ToCurrent) {
+ ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_20.sql")));
+
+ // Verify pre-conditions.
+ {
+ sql::Connection connection;
+ ASSERT_TRUE(connection.Open(GetDatabasePath()));
+
+ EXPECT_FALSE(connection.DoesTableExist("autofill"));
+ EXPECT_FALSE(connection.DoesTableExist("autofill_profiles"));
+ EXPECT_FALSE(connection.DoesTableExist("credit_cards"));
+ }
+
+ DoMigration();
+
+ // Verify post-conditions. These are expectations for current version of the
+ // database.
+ {
+ sql::Connection connection;
+ ASSERT_TRUE(connection.Open(GetDatabasePath()));
+
+ // Check version.
+ EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
+
+ // Mostly this test just verifies that no SQL errors occur during migration;
+ // but might as well verify that the tables were created as well.
+ EXPECT_TRUE(connection.DoesTableExist("autofill"));
+ EXPECT_TRUE(connection.DoesTableExist("autofill_profiles"));
+ EXPECT_TRUE(connection.DoesTableExist("credit_cards"));
+ }
+}
+
// Tests that rows with empty values get removed from the autofill tables.
TEST_F(WebDatabaseMigrationTest, MigrateVersion21ToCurrent) {
ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_21.sql")));
« no previous file with comments | « components/webdata/common/web_database.cc ('k') | components/webdata/common/web_database_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698