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

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: Fixing Android's BrowserContext. 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 d522b92d8f1621c5497c7f5f1fcb6f35620f41e3..cf63a244967c1334b6e31f05468d230b5bf40c2c 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -41,6 +41,7 @@
#include "chrome/browser/prefs/browser_prefs.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"
@@ -56,6 +57,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"
@@ -609,28 +611,18 @@ 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);
+ content::StoragePartition* storage_partition = rph->GetStoragePartition();
+
+ // TODO(nasko): Remove this conditional, once browser tag creates a proper
Charlie Reis 2012/10/30 17:47:48 nit: webview tag
nasko 2012/10/30 19:55:25 Done.
+ // storage partition.
+ if (rph->IsGuest()) {
+ return GetRequestContextForStoragePartition(
+ storage_partition->GetPath(), true);
}
- return GetRequestContext();
+ return storage_partition->GetURLRequestContext();
}
void TestingProfile::CreateRequestContext() {
@@ -660,7 +652,8 @@ TestingProfile::GetMediaRequestContextForRenderProcess(
net::URLRequestContextGetter*
TestingProfile::GetMediaRequestContextForStoragePartition(
- const std::string& partition_id) {
+ const FilePath& partition_path,
+ bool in_memory) {
return NULL;
}
@@ -676,7 +669,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