| 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);
|
| + }
|
| +}
|
|
|