Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: chrome/test/testing_profile.cc

Issue 343067: Unittest for fix to allow navigation when there is no history DB.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/testing_profile.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/test/testing_profile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698