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

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: Changing bool param to pass by reference. 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..6bb971350df148a5d2012868ece9bd753a6d5b78 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -43,6 +43,7 @@
#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"
+#include "chrome/browser/storage_partition_details.h"
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/browser/webdata/web_data_service_factory.h"
#include "chrome/common/chrome_constants.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,25 +622,29 @@ net::URLRequestContextGetter* TestingProfile::GetRequestContext() {
net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess(
int renderer_child_id) {
+ content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
+ renderer_child_id);
+ CHECK(rph);
+ content::StoragePartition* storage_partition = rph->GetStoragePartition();
+
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());
+ return GetRequestContextForStoragePartition(
+ storage_partition->GetPath(),
+ storage_partition->IsInMemoryOnly());
}
- content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
- renderer_child_id);
- if (rph && rph->IsGuest()) {
+ if (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);
+ // TODO(nasko): Pass the proper value for in_memory when the browser tag
+ // is wired properly with storage partition.
+ return GetRequestContextForStoragePartition(
+ storage_partition->GetPath(), true);
}
return GetRequestContext();
@@ -671,7 +677,8 @@ TestingProfile::GetMediaRequestContextForRenderProcess(
net::URLRequestContextGetter*
TestingProfile::GetMediaRequestContextForStoragePartition(
- const std::string& partition_id) {
+ const FilePath& partition_path,
+ const bool& in_memory) {
return NULL;
}
@@ -687,7 +694,8 @@ net::SSLConfigService* TestingProfile::GetSSLConfigService() {
net::URLRequestContextGetter*
TestingProfile::GetRequestContextForStoragePartition(
- const std::string& partition_id) {
+ const FilePath& partition_path,
+ const 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