summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-27 03:27:46 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-27 03:27:46 +0000
commit90ef1313cb672e7da91312c4f7d3cdee41c7a767 (patch)
treeb42df35c8c71ca921bf7900beb537a1773debacf /chrome/test
parent7459794d5e6251014e322a4042d68c4f3f19a5f3 (diff)
downloadchromium_src-90ef1313cb672e7da91312c4f7d3cdee41c7a767.zip
chromium_src-90ef1313cb672e7da91312c4f7d3cdee41c7a767.tar.gz
chromium_src-90ef1313cb672e7da91312c4f7d3cdee41c7a767.tar.bz2
Makes deleting history no longer delete starred urls. Thiseffectively reenables the code in ExpireHistoryBackend. I also madethe code consistent so that when we delete visits as the result ofhistory deletion we don't change the typed/visit count of theunderlying url.BUG=1214201 1256202TEST=none
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1423 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/testing_profile.cc26
-rw-r--r--chrome/test/testing_profile.h11
2 files changed, 24 insertions, 13 deletions
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index 7cc0455..c91c372 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -4,6 +4,7 @@
#include "chrome/test/testing_profile.h"
+#include "chrome/browser/history/history_backend.h"
#include "chrome/common/chrome_constants.h"
TestingProfile::TestingProfile()
@@ -30,9 +31,8 @@ void TestingProfile::CreateHistoryService(bool delete_file) {
file_util::AppendToPath(&path, chrome::kHistoryFilename);
file_util::Delete(path, false);
}
- file_util::CreateDirectory(history_dir_);
- history_service_ = new HistoryService();
- history_service_->Init(GetPath());
+ history_service_ = new HistoryService(this);
+ history_service_->Init(GetPath(), bookmark_bar_model_.get());
}
void TestingProfile::DestroyHistoryService() {
@@ -56,11 +56,23 @@ void TestingProfile::DestroyHistoryService() {
MessageLoop::current()->Run();
}
-void TestingProfile::CreateBookmarkBarModel() {
- std::wstring path = GetPath();
- file_util::AppendToPath(&path, chrome::kBookmarksFileName);
- file_util::Delete(path, false);
+void TestingProfile::CreateBookmarkBarModel(bool delete_file) {
+ // Nuke the model first, that way we're sure it's done writing to disk.
+ bookmark_bar_model_.reset(NULL);
+
+ if (delete_file) {
+ std::wstring path = GetPath();
+ file_util::AppendToPath(&path, chrome::kBookmarksFileName);
+ file_util::Delete(path, false);
+ }
bookmark_bar_model_.reset(new BookmarkBarModel(this));
+ if (history_service_.get()) {
+ history_service_->history_backend_->bookmark_service_ =
+ bookmark_bar_model_.get();
+ history_service_->history_backend_->expirer_.bookmark_service_ =
+ bookmark_bar_model_.get();
+ }
+ bookmark_bar_model_->Load();
}
void TestingProfile::CreateTemplateURLModel() {
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h
index d56e909..3d8e04c 100644
--- a/chrome/test/testing_profile.h
+++ b/chrome/test/testing_profile.h
@@ -27,8 +27,11 @@ class TestingProfile : public Profile {
void CreateHistoryService(bool delete_file);
// Creates the BookmkarBarModel. If not invoked the bookmark bar model is
- // NULL.
- void CreateBookmarkBarModel();
+ // NULL. If |delete_file| is true, the bookmarks file is deleted first, then
+ // the model is created. As TestingProfile deletes the directory containing
+ // the files used by HistoryService, the boolean only matters if you're
+ // recreating the BookmarkBarModel.
+ void CreateBookmarkBarModel(bool delete_file);
// Creates a TemplateURLModel. If not invoked the TemplateURLModel is NULL.
void CreateTemplateURLModel();
@@ -164,9 +167,6 @@ class TestingProfile : public Profile {
// from the destructor.
void DestroyHistoryService();
- // Directory for the history service.
- std::wstring history_dir_;
-
// The history service. Only created if CreateHistoryService is invoked.
scoped_refptr<HistoryService> history_service_;
@@ -182,4 +182,3 @@ class TestingProfile : public Profile {
};
#endif // CHROME_TEST_TESTING_PROFILE_H__
-