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

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

Issue 310463005: Fill in more name fields with requestAutocomplete (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dumb test is dumb Created 6 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
« 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 aa3d0dd65a40023b66b282801a99afcdab169ea8..6f5dad1c8b4d2f7fc59c86492a93cd922f094e53 100644
--- a/components/webdata/common/web_database_migration_unittest.cc
+++ b/components/webdata/common/web_database_migration_unittest.cc
@@ -256,7 +256,7 @@ class WebDatabaseMigrationTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(WebDatabaseMigrationTest);
};
-const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 56;
+const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 57;
void WebDatabaseMigrationTest::LoadDatabase(
const base::FilePath::StringType& file) {
@@ -2670,3 +2670,66 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion55ToCurrent) {
ASSERT_FALSE(s_profiles.Step());
}
}
+
+// Tests that migrating from version 56 to version 57 adds the full_name
+// column to autofill_profile_names table.
+TEST_F(WebDatabaseMigrationTest, MigrateVersion56ToCurrent) {
+ ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_56.sql")));
+
+ // Verify pre-conditions. These are expectations for version 56 of the
+ // database.
+ {
+ sql::Connection connection;
+ ASSERT_TRUE(connection.Open(GetDatabasePath()));
+ ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
+
+ EXPECT_FALSE(
+ connection.DoesColumnExist("autofill_profile_names", "full_name"));
+
+ // Verify the starting data.
+ sql::Statement s_names(
+ connection.GetUniqueStatement(
+ "SELECT guid, first_name, middle_name, last_name "
+ "FROM autofill_profile_names"));
+ ASSERT_TRUE(s_names.Step());
+ EXPECT_EQ("B41FE6E0-B13E-2A2A-BF0B-29FCE2C3ADBD", s_names.ColumnString(0));
+ EXPECT_EQ(ASCIIToUTF16("Jon"), s_names.ColumnString16(1));
+ EXPECT_EQ(base::string16(), s_names.ColumnString16(2));
+ EXPECT_EQ(ASCIIToUTF16("Smith"), s_names.ColumnString16(3));
+ }
+
+ DoMigration();
+
+ // Verify post-conditions. These are expectations for current version of the
+ // database.
+ {
+ sql::Connection connection;
+ ASSERT_TRUE(connection.Open(GetDatabasePath()));
+ ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
+
+ // Check version.
+ EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
+
+ // The full_name column should have been added to autofill_profile_names
+ // table.
+ EXPECT_TRUE(
+ connection.DoesColumnExist("autofill_profile_names", "full_name"));
+
+ // Data should have been preserved. Full name should have been set to the
+ // empty string.
+ sql::Statement s_names(
+ connection.GetUniqueStatement(
+ "SELECT guid, first_name, middle_name, last_name, full_name "
+ "FROM autofill_profile_names"));
+
+ ASSERT_TRUE(s_names.Step());
+ EXPECT_EQ("B41FE6E0-B13E-2A2A-BF0B-29FCE2C3ADBD", s_names.ColumnString(0));
+ EXPECT_EQ(ASCIIToUTF16("Jon"), s_names.ColumnString16(1));
+ EXPECT_EQ(base::string16(), s_names.ColumnString16(2));
+ EXPECT_EQ(ASCIIToUTF16("Smith"), s_names.ColumnString16(3));
+ EXPECT_EQ(base::string16(), s_names.ColumnString16(4));
+
+ // No more entries expected.
+ ASSERT_FALSE(s_names.Step());
+ }
+}
« 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