| 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 420362346c98e01c9ea26949f432d6500aba68e3..36d68bb26b9b314a3f43f565baf7944fd56a91d2 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 = 66;
|
| +const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 67;
|
|
|
| void WebDatabaseMigrationTest::LoadDatabase(
|
| const base::FilePath::StringType& file) {
|
| @@ -1026,3 +1026,46 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion65ToCurrent) {
|
| EXPECT_TRUE(read_credit_cards.ColumnString(1).empty());
|
| }
|
| }
|
| +
|
| +// Tests addition of masked server credit card billing address.
|
| +TEST_F(WebDatabaseMigrationTest, MigrateVersion66ToCurrent) {
|
| + ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_66.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, 66, 66));
|
| +
|
| + EXPECT_FALSE(connection.DoesColumnExist("masked_credit_cards",
|
| + "billing_address_id"));
|
| +
|
| + EXPECT_TRUE(connection.Execute(
|
| + "INSERT INTO masked_credit_cards(id, name_on_card) "
|
| + "VALUES ('id', 'Alice')"));
|
| + }
|
| +
|
| + 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("masked_credit_cards",
|
| + "billing_address_id"));
|
| +
|
| + sql::Statement read_masked(connection.GetUniqueStatement(
|
| + "SELECT name_on_card, billing_address_id FROM masked_credit_cards"));
|
| + ASSERT_TRUE(read_masked.Step());
|
| + EXPECT_EQ("Alice", read_masked.ColumnString(0));
|
| + EXPECT_TRUE(read_masked.ColumnString(1).empty());
|
| + }
|
| +}
|
|
|