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"))); |