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 <algorithm> | 5 #include <algorithm> |
6 #include <set> | 6 #include <set> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 old_history_path = old_history_path.AppendASCII("History"); | 1272 old_history_path = old_history_path.AppendASCII("History"); |
1273 old_history_path = old_history_path.AppendASCII("HistoryNoSource"); | 1273 old_history_path = old_history_path.AppendASCII("HistoryNoSource"); |
1274 | 1274 |
1275 // Copy history database file to current directory so that it will be deleted | 1275 // Copy history database file to current directory so that it will be deleted |
1276 // in Teardown. | 1276 // in Teardown. |
1277 base::FilePath new_history_path(getTestDir()); | 1277 base::FilePath new_history_path(getTestDir()); |
1278 base::Delete(new_history_path, true); | 1278 base::Delete(new_history_path, true); |
1279 file_util::CreateDirectory(new_history_path); | 1279 file_util::CreateDirectory(new_history_path); |
1280 base::FilePath new_history_file = | 1280 base::FilePath new_history_file = |
1281 new_history_path.Append(chrome::kHistoryFilename); | 1281 new_history_path.Append(chrome::kHistoryFilename); |
1282 ASSERT_TRUE(file_util::CopyFile(old_history_path, new_history_file)); | 1282 ASSERT_TRUE(base::CopyFile(old_history_path, new_history_file)); |
1283 | 1283 |
1284 backend_ = new HistoryBackend(new_history_path, | 1284 backend_ = new HistoryBackend(new_history_path, |
1285 0, | 1285 0, |
1286 new HistoryBackendTestDelegate(this), | 1286 new HistoryBackendTestDelegate(this), |
1287 &bookmark_model_); | 1287 &bookmark_model_); |
1288 backend_->Init(std::string(), false); | 1288 backend_->Init(std::string(), false); |
1289 backend_->Closing(); | 1289 backend_->Closing(); |
1290 backend_ = NULL; | 1290 backend_ = NULL; |
1291 | 1291 |
1292 // Now the database should already be migrated. | 1292 // Now the database should already be migrated. |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2513 | 2513 |
2514 // Copy history database file to current directory so that it will be deleted | 2514 // Copy history database file to current directory so that it will be deleted |
2515 // in Teardown. | 2515 // in Teardown. |
2516 base::FilePath new_history_path(getTestDir()); | 2516 base::FilePath new_history_path(getTestDir()); |
2517 base::Delete(new_history_path, true); | 2517 base::Delete(new_history_path, true); |
2518 file_util::CreateDirectory(new_history_path); | 2518 file_util::CreateDirectory(new_history_path); |
2519 base::FilePath new_history_file = | 2519 base::FilePath new_history_file = |
2520 new_history_path.Append(chrome::kHistoryFilename); | 2520 new_history_path.Append(chrome::kHistoryFilename); |
2521 base::FilePath new_archived_file = | 2521 base::FilePath new_archived_file = |
2522 new_history_path.Append(chrome::kArchivedHistoryFilename); | 2522 new_history_path.Append(chrome::kArchivedHistoryFilename); |
2523 ASSERT_TRUE(file_util::CopyFile(old_history, new_history_file)); | 2523 ASSERT_TRUE(base::CopyFile(old_history, new_history_file)); |
2524 ASSERT_TRUE(file_util::CopyFile(old_archived, new_archived_file)); | 2524 ASSERT_TRUE(base::CopyFile(old_archived, new_archived_file)); |
2525 | 2525 |
2526 backend_ = new HistoryBackend(new_history_path, | 2526 backend_ = new HistoryBackend(new_history_path, |
2527 0, | 2527 0, |
2528 new HistoryBackendTestDelegate(this), | 2528 new HistoryBackendTestDelegate(this), |
2529 &bookmark_model_); | 2529 &bookmark_model_); |
2530 backend_->Init(std::string(), false); | 2530 backend_->Init(std::string(), false); |
2531 backend_->Closing(); | 2531 backend_->Closing(); |
2532 backend_ = NULL; | 2532 backend_ = NULL; |
2533 | 2533 |
2534 // Now both history and archived_history databases should already be migrated. | 2534 // Now both history and archived_history databases should already be migrated. |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2806 service->AddPage( | 2806 service->AddPage( |
2807 url, base::Time::Now(), NULL, 1, GURL(), RedirectList(), | 2807 url, base::Time::Now(), NULL, 1, GURL(), RedirectList(), |
2808 content::PAGE_TRANSITION_TYPED, SOURCE_BROWSED, false); | 2808 content::PAGE_TRANSITION_TYPED, SOURCE_BROWSED, false); |
2809 | 2809 |
2810 // This won't actually delete the URL, rather it'll empty out the visits. | 2810 // This won't actually delete the URL, rather it'll empty out the visits. |
2811 // This triggers blocking on the BookmarkModel. | 2811 // This triggers blocking on the BookmarkModel. |
2812 service->DeleteURL(url); | 2812 service->DeleteURL(url); |
2813 } | 2813 } |
2814 | 2814 |
2815 } // namespace history | 2815 } // namespace history |
OLD | NEW |