Chromium Code Reviews| 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 814210bab3d7598e83fd41a29e0526f0e15b9ced..81b534eca15bcab5a93fa6f1a854f50989b69411 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 = 68; |
| +const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 69; |
| void WebDatabaseMigrationTest::LoadDatabase( |
| const base::FilePath::StringType& file) { |
| @@ -164,8 +164,10 @@ TEST_F(WebDatabaseMigrationTest, VersionXxSqlFilesAreGolden) { |
| ASSERT_NO_FATAL_FAILURE(LoadDatabase(file_name.value())) |
| << "Failed to load " << file_name.MaybeAsASCII(); |
| DoMigration(); |
| + |
| EXPECT_EQ(expected_schema, RemoveQuotes(connection.GetSchema())) |
| << "For version " << i; |
| + |
|
Peter Kasting
2016/11/21 03:35:08
Nit: Extra blank line
ltian
2016/11/28 22:08:02
Done.
|
| } |
| } |
| @@ -1101,3 +1103,35 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion67ToCurrent) { |
| connection.DoesColumnExist("keywords", "show_in_default_list")); |
| } |
| } |
| + |
| +// Tests add last_visited column in keywords table. |
|
Peter Kasting
2016/11/21 03:35:08
Nit: add -> addition of
ltian
2016/11/28 22:08:02
Done.
|
| +TEST_F(WebDatabaseMigrationTest, MigrateVersion68ToCurrent) { |
| + ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_68.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, 68, 68)); |
| + |
| + EXPECT_FALSE(connection.DoesColumnExist("keywords", "last_visited")); |
| + } |
| + |
| + 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("keywords", "last_visited")); |
| + } |
| +} |