| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/test/testing_profile.h" | 5 #include "chrome/test/testing_profile.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/history/history_backend.h" | 10 #include "chrome/browser/history/history_backend.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 path_ = path_.AppendASCII(IntToString(count)); | 97 path_ = path_.AppendASCII(IntToString(count)); |
| 98 file_util::Delete(path_, true); | 98 file_util::Delete(path_, true); |
| 99 file_util::CreateDirectory(path_); | 99 file_util::CreateDirectory(path_); |
| 100 } | 100 } |
| 101 | 101 |
| 102 TestingProfile::~TestingProfile() { | 102 TestingProfile::~TestingProfile() { |
| 103 DestroyHistoryService(); | 103 DestroyHistoryService(); |
| 104 file_util::Delete(path_, true); | 104 file_util::Delete(path_, true); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void TestingProfile::CreateHistoryService(bool delete_file) { | 107 void TestingProfile::CreateHistoryService(bool delete_file, bool no_db) { |
| 108 if (history_service_.get()) | 108 if (history_service_.get()) |
| 109 history_service_->Cleanup(); | 109 history_service_->Cleanup(); |
| 110 | 110 |
| 111 history_service_ = NULL; | 111 history_service_ = NULL; |
| 112 | 112 |
| 113 if (delete_file) { | 113 if (delete_file) { |
| 114 FilePath path = GetPath(); | 114 FilePath path = GetPath(); |
| 115 path = path.Append(chrome::kHistoryFilename); | 115 path = path.Append(chrome::kHistoryFilename); |
| 116 file_util::Delete(path, false); | 116 file_util::Delete(path, false); |
| 117 } | 117 } |
| 118 history_service_ = new HistoryService(this); | 118 history_service_ = new HistoryService(this); |
| 119 history_service_->Init(GetPath(), bookmark_bar_model_.get()); | 119 history_service_->Init(GetPath(), bookmark_bar_model_.get(), no_db); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void TestingProfile::DestroyHistoryService() { | 122 void TestingProfile::DestroyHistoryService() { |
| 123 if (!history_service_.get()) | 123 if (!history_service_.get()) |
| 124 return; | 124 return; |
| 125 | 125 |
| 126 history_service_->NotifyRenderProcessHostDestruction(0); | 126 history_service_->NotifyRenderProcessHostDestruction(0); |
| 127 history_service_->SetOnBackendDestroyTask(new MessageLoop::QuitTask); | 127 history_service_->SetOnBackendDestroyTask(new MessageLoop::QuitTask); |
| 128 history_service_->Cleanup(); | 128 history_service_->Cleanup(); |
| 129 history_service_ = NULL; | 129 history_service_ = NULL; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 void TestingProfile::CreateProfileSyncService() { | 204 void TestingProfile::CreateProfileSyncService() { |
| 205 if (!profile_sync_service_.get()) { | 205 if (!profile_sync_service_.get()) { |
| 206 profile_sync_service_.reset(new ProfileSyncService(this)); | 206 profile_sync_service_.reset(new ProfileSyncService(this)); |
| 207 profile_sync_service_->Initialize(); | 207 profile_sync_service_->Initialize(); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 ProfileSyncService* TestingProfile::GetProfileSyncService() { | 211 ProfileSyncService* TestingProfile::GetProfileSyncService() { |
| 212 return profile_sync_service_.get(); | 212 return profile_sync_service_.get(); |
| 213 } | 213 } |
| OLD | NEW |