| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/omnibox/browser/shortcuts_database.h" | 5 #include "components/omnibox/browser/shortcuts_database.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 "SELECT count(1) FROM omni_box_shortcuts WHERE type in (9, 10, 11, 12)")); | 295 "SELECT count(1) FROM omni_box_shortcuts WHERE type in (9, 10, 11, 12)")); |
| 296 ASSERT_TRUE(statement.is_valid()); | 296 ASSERT_TRUE(statement.is_valid()); |
| 297 while (statement.Step()) | 297 while (statement.Step()) |
| 298 EXPECT_EQ(0, statement.ColumnInt(0)); | 298 EXPECT_EQ(0, statement.ColumnInt(0)); |
| 299 EXPECT_TRUE(statement.Succeeded()); | 299 EXPECT_TRUE(statement.Succeeded()); |
| 300 #if !defined(OS_WIN) | 300 #if !defined(OS_WIN) |
| 301 EXPECT_TRUE(temp_dir.Delete()); | 301 EXPECT_TRUE(temp_dir.Delete()); |
| 302 #endif | 302 #endif |
| 303 } | 303 } |
| 304 | 304 |
| 305 TEST(ShortcutsDatabaseMigrationTest, Recovery1) { | 305 TEST(ShortcutsDatabaseMigrationTest, DISABLED_Recovery1) { |
| 306 #if defined(OS_ANDROID) | 306 #if defined(OS_ANDROID) |
| 307 char kBasename[] = "Shortcuts.v1.sql"; | 307 char kBasename[] = "Shortcuts.v1.sql"; |
| 308 #else | 308 #else |
| 309 char kBasename[] = "Shortcuts.no_fill_into_edit.sql"; | 309 char kBasename[] = "Shortcuts.no_fill_into_edit.sql"; |
| 310 #endif | 310 #endif |
| 311 // Use the pre-v0 test file to create a test database in a temp dir. | 311 // Use the pre-v0 test file to create a test database in a temp dir. |
| 312 base::FilePath sql_path = GetTestDataDir().AppendASCII(kBasename); | 312 base::FilePath sql_path = GetTestDataDir().AppendASCII(kBasename); |
| 313 base::ScopedTempDir temp_dir; | 313 base::ScopedTempDir temp_dir; |
| 314 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 314 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 315 base::FilePath db_path(temp_dir.path().AppendASCII("TestShortcuts.db")); | 315 base::FilePath db_path(temp_dir.path().AppendASCII("TestShortcuts.db")); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // recovered. | 363 // recovered. |
| 364 { | 364 { |
| 365 sql::Connection connection; | 365 sql::Connection connection; |
| 366 ASSERT_TRUE(connection.Open(db_path)); | 366 ASSERT_TRUE(connection.Open(db_path)); |
| 367 sql::Statement statement(connection.GetUniqueStatement(kCountSql)); | 367 sql::Statement statement(connection.GetUniqueStatement(kCountSql)); |
| 368 ASSERT_TRUE(statement.is_valid()); | 368 ASSERT_TRUE(statement.is_valid()); |
| 369 ASSERT_TRUE(statement.Step()); | 369 ASSERT_TRUE(statement.Step()); |
| 370 EXPECT_EQ(row_count, statement.ColumnInt(0)); | 370 EXPECT_EQ(row_count, statement.ColumnInt(0)); |
| 371 } | 371 } |
| 372 } | 372 } |
| OLD | NEW |