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

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

Issue 1042353003: Create syncable metadata table for Wallet credit cards and addresses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment about migration code Created 5 years, 8 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
« no previous file with comments | « components/webdata/common/web_database.cc ('k') | sync/protocol/autofill_specifics.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1f36aadc1297a594fc1f9121460778f538a013bd..9919098f3d9c62fd56df56319a9b94af3c73ce6b 100644
--- a/components/webdata/common/web_database_migration_unittest.cc
+++ b/components/webdata/common/web_database_migration_unittest.cc
@@ -132,7 +132,7 @@ class WebDatabaseMigrationTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(WebDatabaseMigrationTest);
};
-const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 64;
+const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 65;
void WebDatabaseMigrationTest::LoadDatabase(
const base::FilePath::StringType& file) {
@@ -934,3 +934,50 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion61ToCurrent) {
"use_date"));
}
}
+
+// Tests addition of server metadata tables.
+TEST_F(WebDatabaseMigrationTest, MigrateVersion64ToCurrent) {
+ ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_64.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, 64, 64));
+
+ EXPECT_FALSE(connection.DoesTableExist("server_card_metadata"));
+ EXPECT_FALSE(connection.DoesTableExist("server_address_metadata"));
+
+ // Add a server address --- make sure it gets an ID.
+ sql::Statement insert_profiles(
+ connection.GetUniqueStatement(
+ "INSERT INTO server_addresses(id, postal_code) "
+ "VALUES ('', 90210)"));
+ insert_profiles.Run();
+ }
+
+ 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.DoesTableExist("server_card_metadata"));
+ EXPECT_TRUE(connection.DoesTableExist("server_address_metadata"));
+
+ sql::Statement read_profiles(
+ connection.GetUniqueStatement(
+ "SELECT id, postal_code FROM server_addresses"));
+ ASSERT_TRUE(read_profiles.Step());
+ EXPECT_FALSE(read_profiles.ColumnString(0).empty());
+ EXPECT_EQ("90210", read_profiles.ColumnString(1));
+ }
+}
« no previous file with comments | « components/webdata/common/web_database.cc ('k') | sync/protocol/autofill_specifics.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698