Add asserts to TestingProfile::CreateHistoryService to ensure files are deleted
BUG=
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=213148
Review URL: https://chromiumcodereview.appspot.com/19616004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213413 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 3a3c019..7611a931 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -366,12 +366,13 @@
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 @@
}
// Disable WebHistoryService by default, since it makes network requests.
WebHistoryServiceFactory::GetInstance()->SetTestingFactory(this, NULL);
+ return true;
}
void TestingProfile::DestroyHistoryService() {