| 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 a72140ca4ecaabc085865c43e3fc1143c1372f83..16f383f4c90ef2150faddd176cfb7d7897fd4bcf 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")));
|
|
|