Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2031)

Unified Diff: chrome/test/base/testing_profile.cc

Issue 11147026: Initial refactor to get profiles to propagate storage partition details. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed macro and InMemory. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/base/testing_profile.cc
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 63eab1b5640d4241d6d69afacbdde8714495f23d..2f655ab8dece3348626b256fbfa29bf3da464215 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -40,6 +40,7 @@
#include "chrome/browser/prefs/testing_pref_store.h"
#include "chrome/browser/prerender/prerender_manager.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"
+#include "chrome/browser/profiles/storage_partition_descriptor.h"
#include "chrome/browser/protector/protector_service_factory.h"
#include "chrome/browser/search_engines/template_url_fetcher_factory.h"
#include "chrome/browser/speech/chrome_speech_recognition_preferences.h"
@@ -55,6 +56,7 @@
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/storage_partition.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/test/mock_resource_context.h"
#include "content/public/test/test_utils.h"
@@ -620,28 +622,19 @@ net::URLRequestContextGetter* TestingProfile::GetRequestContext() {
net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess(
int renderer_child_id) {
- ExtensionService* extension_service =
- extensions::ExtensionSystem::Get(this)->extension_service();
- if (extension_service) {
- const extensions::Extension* extension =
- extension_service->GetIsolatedAppForRenderer(renderer_child_id);
- if (extension)
- return GetRequestContextForStoragePartition(extension->id());
- }
-
content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
renderer_child_id);
- if (rph && rph->IsGuest()) {
- // For guest processes (used by the browser tag), we need to isolate the
- // storage.
- // TODO(nasko): Until we have proper storage partitions, create a
- // non-persistent context using the RPH's id.
- std::string id("guest-");
- id.append(base::IntToString(renderer_child_id));
- return GetRequestContextForStoragePartition(id);
+ CHECK(rph);
awong 2012/10/19 23:26:50 remove CHECK()
nasko 2012/10/19 23:55:16 Done.
+ content::StoragePartition* storage_partition = rph->GetStoragePartition();
+
+ // TODO(nasko): Remove this conditional, once browser tag creates a proper
+ // storage partition.
+ if (rph->IsGuest()) {
+ return GetRequestContextForStoragePartition(
+ storage_partition->GetPath(), true);
}
- return GetRequestContext();
+ return storage_partition->GetURLRequestContext();
}
void TestingProfile::CreateRequestContext() {
@@ -671,7 +664,8 @@ TestingProfile::GetMediaRequestContextForRenderProcess(
net::URLRequestContextGetter*
TestingProfile::GetMediaRequestContextForStoragePartition(
- const std::string& partition_id) {
+ const FilePath& partition_path,
+ bool in_memory) {
return NULL;
}
@@ -687,7 +681,8 @@ net::SSLConfigService* TestingProfile::GetSSLConfigService() {
net::URLRequestContextGetter*
TestingProfile::GetRequestContextForStoragePartition(
- const std::string& partition_id) {
+ const FilePath& partition_path,
+ bool in_memory) {
// We don't test storage partitions here yet, so returning the same dummy
// context is sufficient for now.
return GetRequestContext();

Powered by Google App Engine
This is Rietveld 408576698