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

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

Issue 2626843004: [Payments] Add billing_address_id and has_converted to autofill_table (Closed)
Patch Set: Created 3 years, 11 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 82aa0c619fb9bbe1e8c7b2c2b0ce9d1da1a787e5..fee814af9aa2a0d6eb6057140dafc365070dcc9a 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 = 70;
+const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 71;
void WebDatabaseMigrationTest::LoadDatabase(
const base::FilePath::StringType& file) {
@@ -1166,3 +1166,41 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion69ToCurrent) {
EXPECT_TRUE(connection.DoesTableExist("autofill_model_type_state"));
}
}
+
+// Tests addition of billing_address_id to server_card_metadata and
+// has_converted to server_profile_metadata.
+TEST_F(WebDatabaseMigrationTest, MigrateVersion70ToCurrent) {
+ ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_70.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, 70, 70));
+
+ EXPECT_FALSE(connection.DoesColumnExist("server_card_metadata",
+ "billing_address_id"));
+ EXPECT_FALSE(
+ connection.DoesColumnExist("server_address_metadata", "has_converted"));
+ }
+
+ 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("server_card_metadata",
+ "billing_address_id"));
+ EXPECT_TRUE(
+ connection.DoesColumnExist("server_address_metadata", "has_converted"));
please use gerrit instead 2017/01/11 19:23:03 Check values as well, please.
sebsg 2017/01/12 15:36:31 Done.
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698