| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 bool loaded_; | 384 bool loaded_; |
| 385 | 385 |
| 386 private: | 386 private: |
| 387 friend class HistoryBackendTestDelegate; | 387 friend class HistoryBackendTestDelegate; |
| 388 | 388 |
| 389 virtual void TearDown() { | 389 virtual void TearDown() { |
| 390 if (backend_.get()) | 390 if (backend_.get()) |
| 391 backend_->Closing(); | 391 backend_->Closing(); |
| 392 backend_ = NULL; | 392 backend_ = NULL; |
| 393 mem_backend_.reset(); | 393 mem_backend_.reset(); |
| 394 base::Delete(test_dir_, true); | 394 base::DeleteFile(test_dir_, true); |
| 395 base::RunLoop().RunUntilIdle(); | 395 base::RunLoop().RunUntilIdle(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void SetInMemoryBackend(int backend_id, InMemoryHistoryBackend* backend) { | 398 void SetInMemoryBackend(int backend_id, InMemoryHistoryBackend* backend) { |
| 399 mem_backend_.reset(backend); | 399 mem_backend_.reset(backend); |
| 400 } | 400 } |
| 401 | 401 |
| 402 void BroadcastNotifications(int type, | 402 void BroadcastNotifications(int type, |
| 403 HistoryDetails* details) { | 403 HistoryDetails* details) { |
| 404 ++num_broadcasted_notifications_; | 404 ++num_broadcasted_notifications_; |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 backend_ = NULL; | 1268 backend_ = NULL; |
| 1269 | 1269 |
| 1270 base::FilePath old_history_path; | 1270 base::FilePath old_history_path; |
| 1271 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path)); | 1271 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path)); |
| 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::DeleteFile(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(base::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); |
| (...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2507 | 2507 |
| 2508 base::FilePath old_history_path, old_history, old_archived; | 2508 base::FilePath old_history_path, old_history, old_archived; |
| 2509 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path)); | 2509 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path)); |
| 2510 old_history_path = old_history_path.AppendASCII("History"); | 2510 old_history_path = old_history_path.AppendASCII("History"); |
| 2511 old_history = old_history_path.AppendASCII("HistoryNoDuration"); | 2511 old_history = old_history_path.AppendASCII("HistoryNoDuration"); |
| 2512 old_archived = old_history_path.AppendASCII("ArchivedNoDuration"); | 2512 old_archived = old_history_path.AppendASCII("ArchivedNoDuration"); |
| 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::DeleteFile(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(base::CopyFile(old_history, new_history_file)); | 2523 ASSERT_TRUE(base::CopyFile(old_history, new_history_file)); |
| 2524 ASSERT_TRUE(base::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, |
| (...skipping 278 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 |