| 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 eb04c2ac3923b78946dd3eeae76ad435a617bb31..fbba5cd8d14a0d911f425c949497184fa850b789 100644
|
| --- a/components/webdata/common/web_database_migration_unittest.cc
|
| +++ b/components/webdata/common/web_database_migration_unittest.cc
|
| @@ -233,9 +233,9 @@ class WebDatabaseMigrationTest : public testing::Test {
|
| return s.ColumnInt(0);
|
| }
|
|
|
| - // The sql files located in "chrome/test/data/web_database" were generated by
|
| - // launching the Chromium application prior to schema change, then using the
|
| - // sqlite3 command-line application to dump the contents of the "Web Data"
|
| + // The sql files located in "components/test/data/web_database" were generated
|
| + // by launching the Chromium application prior to schema change, then using
|
| + // the sqlite3 command-line application to dump the contents of the "Web Data"
|
| // database.
|
| // Like this:
|
| // > .output version_nn.sql
|
| @@ -248,7 +248,7 @@ class WebDatabaseMigrationTest : public testing::Test {
|
| DISALLOW_COPY_AND_ASSIGN(WebDatabaseMigrationTest);
|
| };
|
|
|
| -const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 61;
|
| +const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 62;
|
|
|
| void WebDatabaseMigrationTest::LoadDatabase(
|
| const base::FilePath::StringType& file) {
|
| @@ -2810,3 +2810,78 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion59ToCurrent) {
|
| ASSERT_TRUE(connection.DoesTableExist("server_addresses"));
|
| }
|
| }
|
| +
|
| +// Tests addition of use_count and use_date fields to autofill profiles and
|
| +// credit cards.
|
| +TEST_F(WebDatabaseMigrationTest, MigrateVersion60ToCurrent) {
|
| + ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_60.sql")));
|
| +
|
| + // Verify pre-conditions.
|
| + {
|
| + sql::Connection connection;
|
| + ASSERT_TRUE(connection.Open(GetDatabasePath()));
|
| + ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
|
| +
|
| + sql::MetaTable meta_table;
|
| + ASSERT_TRUE(meta_table.Init(&connection, 60, 60));
|
| +
|
| + EXPECT_FALSE(connection.DoesColumnExist("credit_cards", "use_count"));
|
| + EXPECT_FALSE(connection.DoesColumnExist("credit_cards", "use_date"));
|
| + EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles", "use_count"));
|
| + EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles", "use_date"));
|
| + }
|
| +
|
| + DoMigration();
|
| +
|
| + // Verify post-conditions.
|
| + {
|
| + sql::Connection connection;
|
| + ASSERT_TRUE(connection.Open(GetDatabasePath()));
|
| + ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
|
| +
|
| + // Check version.
|
| + EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
|
| +
|
| + EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "use_count"));
|
| + EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "use_date"));
|
| + EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "use_count"));
|
| + EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "use_date"));
|
| + }
|
| +}
|
| +
|
| +// Tests addition of use_count and use_date fields to unmasked server cards.
|
| +TEST_F(WebDatabaseMigrationTest, MigrateVersion61ToCurrent) {
|
| + ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_61.sql")));
|
| +
|
| + // Verify pre-conditions.
|
| + {
|
| + sql::Connection connection;
|
| + ASSERT_TRUE(connection.Open(GetDatabasePath()));
|
| + ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
|
| +
|
| + sql::MetaTable meta_table;
|
| + ASSERT_TRUE(meta_table.Init(&connection, 61, 61));
|
| +
|
| + EXPECT_FALSE(connection.DoesColumnExist("unmasked_credit_cards",
|
| + "use_count"));
|
| + EXPECT_FALSE(connection.DoesColumnExist("unmasked_credit_cards",
|
| + "use_date"));
|
| + }
|
| +
|
| + DoMigration();
|
| +
|
| + // Verify post-conditions.
|
| + {
|
| + sql::Connection connection;
|
| + ASSERT_TRUE(connection.Open(GetDatabasePath()));
|
| + ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
|
| +
|
| + // Check version.
|
| + EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
|
| +
|
| + EXPECT_TRUE(connection.DoesColumnExist("unmasked_credit_cards",
|
| + "use_count"));
|
| + EXPECT_TRUE(connection.DoesColumnExist("unmasked_credit_cards",
|
| + "use_date"));
|
| + }
|
| +}
|
|
|