summaryrefslogtreecommitdiffstats
path: root/chrome/test/testing_profile.cc
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-25 14:38:32 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-25 14:38:32 +0000
commitc10da4b052a8ba91fc76455d3cc2e50e3bc2b08d (patch)
tree25fdd97cc5c3366ff50093088f7531f403f6c9b9 /chrome/test/testing_profile.cc
parent11abcfcb82657d248355fa2f5215a29b3e41a9ae (diff)
downloadchromium_src-c10da4b052a8ba91fc76455d3cc2e50e3bc2b08d.zip
chromium_src-c10da4b052a8ba91fc76455d3cc2e50e3bc2b08d.tar.gz
chromium_src-c10da4b052a8ba91fc76455d3cc2e50e3bc2b08d.tar.bz2
Reland r42467. Clear cookies, local storage and databases when an extension gets uninstalled.
BUG=27938,39177 TEST=Unittest in extension_service_unitttest.cc Review URL: http://codereview.chromium.org/1257005 Patch from Mattias Nissler. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42611 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/testing_profile.cc')
-rw-r--r--chrome/test/testing_profile.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index 8fb3a5b..b0be809 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, 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;
}