| Index: chrome/browser/webdata/web_database_migration_unittest.cc
|
| ===================================================================
|
| --- chrome/browser/webdata/web_database_migration_unittest.cc (revision 90021)
|
| +++ chrome/browser/webdata/web_database_migration_unittest.cc (working copy)
|
| @@ -186,7 +186,7 @@
|
| DISALLOW_COPY_AND_ASSIGN(WebDatabaseMigrationTest);
|
| };
|
|
|
| -const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 37;
|
| +const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 38;
|
|
|
| void WebDatabaseMigrationTest::LoadDatabase(const FilePath::StringType& file) {
|
| std::string contents;
|
| @@ -454,7 +454,7 @@
|
| // Check version.
|
| EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
|
|
|
| - // |keywords| |logo_id| column should have been added.
|
| + // |keywords| |created_by_policy| column should have been added.
|
| EXPECT_TRUE(connection.DoesColumnExist("keywords", "id"));
|
| EXPECT_TRUE(connection.DoesColumnExist("keywords", "created_by_policy"));
|
| }
|
| @@ -587,7 +587,7 @@
|
| // Check version.
|
| EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
|
|
|
| - // |keywords| |logo_id| column should have been added.
|
| + // |keywords| |created_by_policy| column should have been added.
|
| EXPECT_TRUE(connection.DoesColumnExist("keywords", "id"));
|
| EXPECT_TRUE(connection.DoesColumnExist("keywords", "created_by_policy"));
|
| EXPECT_FALSE(connection.DoesColumnExist("credit_cards", "billing_address"));
|
| @@ -601,7 +601,7 @@
|
| EXPECT_EQ("Jack", s.ColumnString(1));
|
| EXPECT_EQ(2, s.ColumnInt(2));
|
| EXPECT_EQ(2012, s.ColumnInt(3));
|
| - // Column 5 is encrypted credit card number blob.
|
| + // Column 5 is encrypted credit card number blo b.
|
| // Column 6 is date_modified.
|
| }
|
| }
|
| @@ -1424,3 +1424,43 @@
|
| ASSERT_FALSE(s2.Step());
|
| }
|
| }
|
| +
|
| +// Tests that the |keywords| |last_modified| column gets added to the schema for
|
| +// a version 37 database.
|
| +TEST_F(WebDatabaseMigrationTest, MigrateVersion37ToCurrent) {
|
| + // This schema is taken from a build prior to the addition of the |keywords|
|
| + // |last_modified| column.
|
| + ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_37.sql")));
|
| +
|
| + // Verify pre-conditions. These are expectations for version 37 of the
|
| + // database.
|
| + {
|
| + sql::Connection connection;
|
| + ASSERT_TRUE(connection.Open(GetDatabasePath()));
|
| +
|
| + // Columns existing and not existing before current version.
|
| + ASSERT_TRUE(connection.DoesColumnExist("keywords", "id"));
|
| + ASSERT_FALSE(connection.DoesColumnExist("keywords", "last_modified"));
|
| + }
|
| +
|
| + // Load the database via the WebDatabase class and migrate the database to
|
| + // the current version.
|
| + {
|
| + WebDatabase db;
|
| + ASSERT_EQ(sql::INIT_OK, db.Init(GetDatabasePath()));
|
| + }
|
| +
|
| + // Verify post-conditions. These are expectations for current version of the
|
| + // database.
|
| + {
|
| + sql::Connection connection;
|
| + ASSERT_TRUE(connection.Open(GetDatabasePath()));
|
| +
|
| + // Check version.
|
| + EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
|
| +
|
| + // |keywords| |last_modified| column should have been added.
|
| + EXPECT_TRUE(connection.DoesColumnExist("keywords", "id"));
|
| + EXPECT_TRUE(connection.DoesColumnExist("keywords", "last_modified"));
|
| + }
|
| +}
|
|
|