diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 20:19:16 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 20:19:16 +0000 |
commit | 869f2efe7f02e3eca489b1ced00f371543bb1e0a (patch) | |
tree | fc821949211a73dd0c763e7c081b6eca9afc2583 /chrome/test | |
parent | 0ec9203dac6b11c664adda8a39b77f3f00eb6072 (diff) | |
download | chromium_src-869f2efe7f02e3eca489b1ced00f371543bb1e0a.zip chromium_src-869f2efe7f02e3eca489b1ced00f371543bb1e0a.tar.gz chromium_src-869f2efe7f02e3eca489b1ced00f371543bb1e0a.tar.bz2 |
Reapply 42467 by reverting 42499 and added suppression.
"Clear cookies, local storage and databases when an extension gets uninstalled."
BUG=39177
BUG=38398
Review URL: http://codereview.chromium.org/1210004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/testing_profile.cc | 29 | ||||
-rw-r--r-- | chrome/test/testing_profile.h | 5 |
2 files changed, 31 insertions, 3 deletions
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc index 27708f2..f9d4924 100644 --- a/chrome/test/testing_profile.cc +++ b/chrome/test/testing_profile.cc @@ -7,6 +7,7 @@ #include "build/build_config.h" #include "base/command_line.h" #include "base/string_util.h" +#include "chrome/common/url_constants.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/dom_ui/ntp_resource_cache.h" #include "chrome/browser/history/history_backend.h" @@ -109,6 +110,28 @@ class TestURLRequestContextGetter : public URLRequestContextGetter { scoped_refptr<URLRequestContext> context_; }; +class TestExtensionURLRequestContext : public URLRequestContext { + public: + TestExtensionURLRequestContext() { + net::CookieMonster* cookie_monster = new net::CookieMonster(NULL); + const char* schemes[] = {chrome::kExtensionScheme}; + cookie_monster->SetCookieableSchemes(schemes, 1); + cookie_store_ = cookie_monster; + } +}; + +class TestExtensionURLRequestContextGetter : public URLRequestContextGetter { + public: + virtual URLRequestContext* GetURLRequestContext() { + if (!context_) + context_ = new TestExtensionURLRequestContext(); + return context_.get(); + } + + private: + scoped_refptr<URLRequestContext> context_; +}; + } // namespace TestingProfile::TestingProfile() @@ -277,6 +300,12 @@ void TestingProfile::CreateRequestContext() { request_context_ = new TestURLRequestContextGetter(); } +URLRequestContextGetter* TestingProfile::GetRequestContextForExtensions() { + if (!extensions_request_context_) + extensions_request_context_ = new TestExtensionURLRequestContextGetter(); + return extensions_request_context_.get(); +} + void TestingProfile::set_session_service(SessionService* session_service) { session_service_ = session_service; } diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h index 08e02b7..ce1603d 100644 --- a/chrome/test/testing_profile.h +++ b/chrome/test/testing_profile.h @@ -179,9 +179,7 @@ class TestingProfile : public Profile { void CreateRequestContext(); virtual URLRequestContextGetter* GetRequestContextForMedia() { return NULL; } - virtual URLRequestContextGetter* GetRequestContextForExtensions() { - return NULL; - } + virtual URLRequestContextGetter* GetRequestContextForExtensions(); virtual net::SSLConfigService* GetSSLConfigService() { return NULL; } virtual Blacklist* GetPrivacyBlacklist() { return NULL; } @@ -303,6 +301,7 @@ class TestingProfile : public Profile { // Internally, this is a TestURLRequestContextGetter that creates a dummy // request context. Currently, only the CookieMonster is hooked up. scoped_refptr<URLRequestContextGetter> request_context_; + scoped_refptr<URLRequestContextGetter> extensions_request_context_; // Do we have a history service? This defaults to the value of // history_service, but can be explicitly set. |