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

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

Issue 684493002: Don't persist and sync omnibox extension keywords. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years, 1 month 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 3174fc6706f72ed7c052c23ec6a78b3e90bd0038..6169c480fc329be9199cce7368af39b82ce9ccc1 100644
--- a/components/webdata/common/web_database_migration_unittest.cc
+++ b/components/webdata/common/web_database_migration_unittest.cc
@@ -248,7 +248,7 @@ class WebDatabaseMigrationTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(WebDatabaseMigrationTest);
};
-const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 58;
+const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 59;
void WebDatabaseMigrationTest::LoadDatabase(
const base::FilePath::StringType& file) {
@@ -2719,3 +2719,59 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion57ToCurrent) {
EXPECT_FALSE(connection.DoesTableExist("web_intents_defaults"));
}
}
+
+// Tests that migrating from version 58 to version 59 drops the omnibox
+// extension keywords.
+TEST_F(WebDatabaseMigrationTest, MigrateVersion58ToCurrent) {
+ ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_58.sql")));
+
+ const char query_extensions[] = "SELECT * FROM keywords "
+ "WHERE url='chrome-extension://iphchnegaodmijmkdlbhbanjhfphhikp/"
+ "?q={searchTerms}'";
+ // 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, 58, 58));
+
+ sql::Statement s(connection.GetUniqueStatement(query_extensions));
+ ASSERT_TRUE(s.is_valid());
+ int count = 0;
+ while (s.Step()) {
+ ++count;
+ }
+ EXPECT_EQ(1, count);
+ }
+
+ 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));
+
+ sql::Statement s(connection.GetUniqueStatement(query_extensions));
+ ASSERT_TRUE(s.is_valid());
+ int count = 0;
+ while (s.Step()) {
+ ++count;
+ }
+ EXPECT_EQ(0, count);
+
+ s.Assign(connection.GetUniqueStatement("SELECT * FROM keywords "
+ "WHERE short_name='Google'"));
+ ASSERT_TRUE(s.is_valid());
+ count = 0;
+ while (s.Step()) {
+ ++count;
+ }
+ EXPECT_EQ(1, count);
+ }
+}
« 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