diff options
author | nkostylev@google.com <nkostylev@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-08 16:02:56 +0000 |
---|---|---|
committer | nkostylev@google.com <nkostylev@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-08 16:02:56 +0000 |
commit | d2879af4320bd17bd9082bf724f5222f6060f3d0 (patch) | |
tree | a3a9a853909b4bb332d22ab4db0e01ff5a6e28c0 /chrome/test | |
parent | 1e6e3c99f8ca2ef9d8e86ddddec20dadc0fbf467 (diff) | |
download | chromium_src-d2879af4320bd17bd9082bf724f5222f6060f3d0.zip chromium_src-d2879af4320bd17bd9082bf724f5222f6060f3d0.tar.gz chromium_src-d2879af4320bd17bd9082bf724f5222f6060f3d0.tar.bz2 |
Export bookmark favicon (base64 encoded png).
Code for importing icons from bookmarks HTML file is already in place.
BUG=11362
TEST=Export bookmarks to HTML file, delete all existing bookmarks, import file.
Review URL: http://codereview.chromium.org/543202
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/testing_profile.cc | 18 | ||||
-rw-r--r-- | chrome/test/testing_profile.h | 11 |
2 files changed, 28 insertions, 1 deletions
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc index c6238c0..f412d90 100644 --- a/chrome/test/testing_profile.cc +++ b/chrome/test/testing_profile.cc @@ -12,6 +12,7 @@ #include "chrome/browser/net/url_request_context_getter.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/notification_service.h" #include "net/url_request/url_request_context.h" #include "webkit/database/database_tracker.h" @@ -133,11 +134,22 @@ TestingProfile::TestingProfile(int count) } TestingProfile::~TestingProfile() { + NotificationService::current()->Notify( + NotificationType::PROFILE_DESTROYED, + Source<Profile>(this), + NotificationService::NoDetails()); DestroyHistoryService(); + // FaviconService depends on HistoryServce so destroying it later. + DestroyFaviconService(); DestroyWebDataService(); file_util::Delete(path_, true); } +void TestingProfile::CreateFaviconService() { + favicon_service_ = NULL; + favicon_service_ = new FaviconService(this); +} + void TestingProfile::CreateHistoryService(bool delete_file, bool no_db) { if (history_service_.get()) history_service_->Cleanup(); @@ -153,6 +165,12 @@ void TestingProfile::CreateHistoryService(bool delete_file, bool no_db) { history_service_->Init(GetPath(), bookmark_bar_model_.get(), no_db); } +void TestingProfile::DestroyFaviconService() { + if (!favicon_service_.get()) + return; + favicon_service_ = NULL; +} + void TestingProfile::DestroyHistoryService() { if (!history_service_.get()) return; diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h index 59049b4..05db3a9 100644 --- a/chrome/test/testing_profile.h +++ b/chrome/test/testing_profile.h @@ -33,6 +33,9 @@ class TestingProfile : public Profile { virtual ~TestingProfile(); + // Creates the favicon service. Consequent calls would recreate the service. + void CreateFaviconService(); + // Creates the history service. If |delete_file| is true, the history file is // deleted first, then the HistoryService is created. As TestingProfile // deletes the directory containing the files used by HistoryService, this @@ -101,7 +104,7 @@ class TestingProfile : public Profile { return NULL; } virtual FaviconService* GetFaviconService(ServiceAccessType access) { - return NULL; + return favicon_service_.get(); } virtual HistoryService* GetHistoryService(ServiceAccessType access) { return history_service_.get(); @@ -246,6 +249,9 @@ class TestingProfile : public Profile { scoped_ptr<PrefService> prefs_; private: + // Destroys favicon service if it has been created. + void DestroyFaviconService(); + // If the history service has been created, it is destroyed. This is invoked // from the destructor. void DestroyHistoryService(); @@ -254,6 +260,9 @@ class TestingProfile : public Profile { // from the destructor. void DestroyWebDataService(); + // The favicon service. Only created if CreateFaviconService is invoked. + scoped_refptr<FaviconService> favicon_service_; + // The history service. Only created if CreateHistoryService is invoked. scoped_refptr<HistoryService> history_service_; |