Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Unified Diff: components/webdata/common/web_database_migration_unittest.cc

Issue 2711543002: Experiment to add bank name in autofill ui. (Closed)
Patch Set: address comment Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..ac54bd8479d68ed7389ff3b2dbeba6a5d4d817c5 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,42 @@ 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 default bank name value is empty.
+ sql::Statement s_masked_cards(connection.GetUniqueStatement(
+ "SELECT bank_name FROM masked_credit_cards"));
+ ASSERT_TRUE(s_masked_cards.Step());
+ EXPECT_EQ("", s_masked_cards.ColumnString(0));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698