Index: chrome/browser/history/shortcuts_database_unittest.cc |
diff --git a/chrome/browser/history/shortcuts_database_unittest.cc b/chrome/browser/history/shortcuts_database_unittest.cc |
index 45c4eae0fe62ce5b649c23734237974b0329fb67..42a28f01e941cfec01ed63758783b141ccb214b4 100644 |
--- a/chrome/browser/history/shortcuts_database_unittest.cc |
+++ b/chrome/browser/history/shortcuts_database_unittest.cc |
@@ -220,14 +220,15 @@ TEST_F(ShortcutsDatabaseTest, DeleteAllShortcuts) { |
EXPECT_EQ(0U, shortcuts.size()); |
} |
-TEST(ShortcutsDatabaseMigrationTest, MigrateV1ToV2) { |
- // Open the v1 test file and use it to create a test database in a temp dir. |
+TEST(ShortcutsDatabaseMigrationTest, MigrateTableAddFillIntoEdit) { |
+ // Open the v0 test file and use it to create a test database in a temp dir. |
Peter Kasting
2014/03/27 20:59:25
Nit: v0 -> pre-v0
Anuj
2014/03/27 21:46:10
Done.
|
base::FilePath sql_path; |
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &sql_path)); |
- sql_path = sql_path.AppendASCII("History").AppendASCII("Shortcuts.v1.sql"); |
+ sql_path = sql_path.AppendASCII("History").AppendASCII( |
+ "Shortcuts.no_fill_into_edit.sql"); |
base::ScopedTempDir temp_dir; |
ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
- base::FilePath db_path(temp_dir.path().AppendASCII("TestShortcuts.db")); |
+ base::FilePath db_path(temp_dir.path().AppendASCII("TestShortcuts1.db")); |
Anuj
2014/03/27 01:56:40
The conflict in the db files created by two tests
Peter Kasting
2014/03/27 20:59:25
How is that possible? They're both running Create
Anuj
2014/03/27 21:46:10
I am not sure. But in my dev setup, the test faile
Peter Kasting
2014/03/27 21:55:28
:/ OK, I guess... I'd like to understand it now, b
Anuj
2014/03/27 22:19:05
So are you okay with this? Or do you want to block
|
ASSERT_TRUE(sql::test::CreateDatabaseFromSQL(db_path, sql_path)); |
CheckV2ColumnExistence(db_path, false); |
@@ -262,4 +263,32 @@ TEST(ShortcutsDatabaseMigrationTest, MigrateV1ToV2) { |
EXPECT_TRUE(statement.Succeeded()); |
} |
+TEST(ShortcutsDatabaseMigrationTest, MigrateV0ToV1) { |
+ // Open the v1 test file and use it to create a test database in a temp dir. |
Peter Kasting
2014/03/27 20:59:25
Nit: v1 -> v0
Anuj
2014/03/27 21:46:10
Done.
|
+ base::FilePath sql_path; |
+ ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &sql_path)); |
+ sql_path = sql_path.AppendASCII("History").AppendASCII("Shortcuts.v0.sql"); |
+ base::ScopedTempDir temp_dir; |
+ ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
+ base::FilePath db_path(temp_dir.path().AppendASCII("TestShortcuts2.db")); |
+ ASSERT_TRUE(sql::test::CreateDatabaseFromSQL(db_path, sql_path)); |
+ |
+ // Create a ShortcutsDatabase from the test database, which will migrate the |
+ // test database to the current version. |
+ { |
+ scoped_refptr<ShortcutsDatabase> db(new ShortcutsDatabase(db_path)); |
+ db->Init(); |
+ } |
+ |
+ // Check that all the old type values got converted to new values. |
+ sql::Connection connection; |
+ ASSERT_TRUE(connection.Open(db_path)); |
+ sql::Statement statement(connection.GetUniqueStatement( |
+ "SELECT count(1) FROM omni_box_shortcuts WHERE type in (9, 10, 11, 12)")); |
+ ASSERT_TRUE(statement.is_valid()); |
+ while (statement.Step()) |
+ EXPECT_EQ(0, statement.ColumnInt(0)); |
+ EXPECT_TRUE(statement.Succeeded()); |
+} |
+ |
} // namespace history |