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

Unified Diff: chrome/test/base/testing_profile.cc

Issue 19616004: Add asserts to TestingProfile::CreateHistoryService to ensure files are deleted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix release unit tests Created 7 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/base/testing_profile.h ('k') | chrome/test/perf/generate_profile.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/testing_profile.cc
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 3a3c0190f18ae2aa4d18b4479fd6bfd9ee8c3d57..7611a931c5fcf579b49d6c3b18cdfd324f742357 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -366,12 +366,13 @@ static BrowserContextKeyedService* BuildHistoryService(
return new HistoryService(static_cast<Profile*>(profile));
}
-void TestingProfile::CreateHistoryService(bool delete_file, bool no_db) {
+bool TestingProfile::CreateHistoryService(bool delete_file, bool no_db) {
DestroyHistoryService();
if (delete_file) {
base::FilePath path = GetPath();
path = path.Append(chrome::kHistoryFilename);
- base::DeleteFile(path, false);
+ if (!base::DeleteFile(path, false) || base::PathExists(path))
+ return false;
}
// This will create and init the history service.
HistoryService* history_service = static_cast<HistoryService*>(
@@ -384,6 +385,7 @@ void TestingProfile::CreateHistoryService(bool delete_file, bool no_db) {
}
// Disable WebHistoryService by default, since it makes network requests.
WebHistoryServiceFactory::GetInstance()->SetTestingFactory(this, NULL);
+ return true;
}
void TestingProfile::DestroyHistoryService() {
« no previous file with comments | « chrome/test/base/testing_profile.h ('k') | chrome/test/perf/generate_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698