| 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 4417725203be97f39265cf98dabf8c60bd0887b0..6d32c68de4bda077d9ac6da1d451cb92e041f443 100644
|
| --- a/components/webdata/common/web_database_migration_unittest.cc
|
| +++ b/components/webdata/common/web_database_migration_unittest.cc
|
| @@ -130,7 +130,7 @@ class WebDatabaseMigrationTest : public testing::Test {
|
| DISALLOW_COPY_AND_ASSIGN(WebDatabaseMigrationTest);
|
| };
|
|
|
| -const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 72;
|
| +const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 73;
|
|
|
| void WebDatabaseMigrationTest::LoadDatabase(
|
| const base::FilePath::StringType& file) {
|
| @@ -1287,3 +1287,58 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion71ToCurrent) {
|
| EXPECT_EQ("VISA", s_cards_metadata.ColumnString(1));
|
| }
|
| }
|
| +
|
| +// Tests addition of bank_name to masked_credit_cards
|
| +TEST_F(WebDatabaseMigrationTest, MigrateVersion72ToCurrent) {
|
| + ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_72.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, 72, 72));
|
| +
|
| + EXPECT_FALSE(
|
| + connection.DoesColumnExist("masked_credit_cards", "bank_name"));
|
| + }
|
| +
|
| + 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));
|
| +
|
| + // The bank_name column should exist.
|
| + EXPECT_TRUE(connection.DoesColumnExist("masked_credit_cards", "bank_name"));
|
| +
|
| + // Make sure that the values in masked_credit_cards are as expected. The
|
| + // values are added to the table in version_72.sql.
|
| + sql::Statement s_masked_cards(
|
| + connection.GetUniqueStatement("SELECT id, " // 0
|
| + "status, " // 1
|
| + "name_on_card, " // 2
|
| + "network, " // 3
|
| + "last_four, " // 4
|
| + "exp_month, " // 5
|
| + "exp_year, " // 6
|
| + "bank_name " // 7
|
| + "FROM masked_credit_cards"));
|
| + ASSERT_TRUE(s_masked_cards.Step());
|
| + EXPECT_EQ("card_1", s_masked_cards.ColumnString(0));
|
| + EXPECT_EQ("status", s_masked_cards.ColumnString(1));
|
| + EXPECT_EQ("bob", s_masked_cards.ColumnString(2));
|
| + EXPECT_EQ("VISA", s_masked_cards.ColumnString(3));
|
| + EXPECT_EQ("1234", s_masked_cards.ColumnString(4));
|
| + EXPECT_EQ(12, s_masked_cards.ColumnInt(5));
|
| + EXPECT_EQ(2050, s_masked_cards.ColumnInt(6));
|
| + EXPECT_EQ("", s_masked_cards.ColumnString(7));
|
| + }
|
| +}
|
|
|