summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-24 08:32:55 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-24 08:32:55 +0000
commit2609bc107a31083c6c88e207d13eaa029d594235 (patch)
tree8331e468eb82a2a9611f388349da4f3565ee3201 /chrome/test
parent51552aae65a96d19e1adcbf6fe760f102b53a8bf (diff)
downloadchromium_src-2609bc107a31083c6c88e207d13eaa029d594235.zip
chromium_src-2609bc107a31083c6c88e207d13eaa029d594235.tar.gz
chromium_src-2609bc107a31083c6c88e207d13eaa029d594235.tar.bz2
Add the ability to save and remove AutoFill profiles from the AutoFillDialog.
BUG=18201 TEST=PersonalDataManagerTest.SetProfiles Review URL: http://codereview.chromium.org/545175 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36978 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/testing_profile.cc23
-rw-r--r--chrome/test/testing_profile.h19
2 files changed, 40 insertions, 2 deletions
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index e5d6740..c6238c0 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -134,6 +134,7 @@ TestingProfile::TestingProfile(int count)
TestingProfile::~TestingProfile() {
DestroyHistoryService();
+ DestroyWebDataService();
file_util::Delete(path_, true);
}
@@ -192,6 +193,21 @@ void TestingProfile::CreateBookmarkModel(bool delete_file) {
bookmark_bar_model_->Load();
}
+void TestingProfile::CreateWebDataService(bool delete_file) {
+ if (web_data_service_.get())
+ web_data_service_->Shutdown();
+
+ if (delete_file) {
+ FilePath path = GetPath();
+ path = path.Append(chrome::kWebDataFilename);
+ file_util::Delete(path, false);
+ }
+
+ web_data_service_ = new WebDataService;
+ if (web_data_service_.get())
+ web_data_service_->Init(GetPath());
+}
+
void TestingProfile::BlockUntilBookmarkModelLoaded() {
DCHECK(bookmark_bar_model_.get());
if (bookmark_bar_model_->IsLoaded())
@@ -265,3 +281,10 @@ void TestingProfile::CreateProfileSyncService() {
ProfileSyncService* TestingProfile::GetProfileSyncService() {
return profile_sync_service_.get();
}
+
+void TestingProfile::DestroyWebDataService() {
+ if (!web_data_service_.get())
+ return;
+
+ web_data_service_->Shutdown();
+}
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h
index e5e1b49..c88e574 100644
--- a/chrome/test/testing_profile.h
+++ b/chrome/test/testing_profile.h
@@ -50,6 +50,14 @@ class TestingProfile : public Profile {
// BlockUntilBookmarkModelLoaded.
void CreateBookmarkModel(bool delete_file);
+ // Creates the webdata service. If |delete_file| is true, the webdata file is
+ // deleted first, then the WebDataService is created. As TestingProfile
+ // deletes the directory containing the files used by WebDataService, this
+ // only matters if you're recreating the WebDataService.
+ void CreateWebDataService(bool delete_file);
+
+ // Destroys
+
// Blocks until the BookmarkModel finishes loaded. This is NOT invoked from
// CreateBookmarkModel.
void BlockUntilBookmarkModelLoaded();
@@ -115,10 +123,10 @@ class TestingProfile : public Profile {
return NULL;
}
virtual WebDataService* GetWebDataService(ServiceAccessType access) {
- return NULL;
+ return web_data_service_.get();
}
virtual WebDataService* GetWebDataServiceWithoutCreating() {
- return NULL;
+ return web_data_service_.get();
}
virtual PasswordStore* GetPasswordStore(ServiceAccessType access) {
return NULL;
@@ -236,6 +244,10 @@ class TestingProfile : public Profile {
// from the destructor.
void DestroyHistoryService();
+ // If the webdata service has been created, it is destroyed. This is invoked
+ // from the destructor.
+ void DestroyWebDataService();
+
// The history service. Only created if CreateHistoryService is invoked.
scoped_refptr<HistoryService> history_service_;
@@ -245,6 +257,9 @@ class TestingProfile : public Profile {
// The ProfileSyncService. Created by CreateProfileSyncService.
scoped_ptr<ProfileSyncService> profile_sync_service_;
+ // The WebDataService. Only created if CreateWebDataService is invoked.
+ scoped_refptr<WebDataService> web_data_service_;
+
// The TemplateURLFetcher. Only created if CreateTemplateURLModel is invoked.
scoped_ptr<TemplateURLModel> template_url_model_;