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

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

Issue 2498053002: Add field to monitor last visited time for each search engine (Closed)
Patch Set: Update Nit comment. Created 4 years 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') | no next file » | 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 814210bab3d7598e83fd41a29e0526f0e15b9ced..280890a2cdc0370398d9417b142166767d2fc8db 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,6 +164,7 @@ 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;
}
@@ -1070,7 +1071,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion66ToCurrent) {
}
}
-// Tests delete show_in_default_list column in keywords table.
+// Tests deletion of show_in_default_list column in keywords table.
TEST_F(WebDatabaseMigrationTest, MigrateVersion67ToCurrent) {
ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_67.sql")));
@@ -1101,3 +1102,35 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion67ToCurrent) {
connection.DoesColumnExist("keywords", "show_in_default_list"));
}
}
+
+// Tests addition of last_visited column in keywords table.
+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"));
+ }
+}
« no previous file with comments | « components/webdata/common/web_database.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698