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

Unified Diff: content/browser/loader/resource_dispatcher_host_unittest.cc

Issue 23851010: Modify ResourceMessageFilter so that it can support attaching to PluginProcessHost. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years, 3 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: content/browser/loader/resource_dispatcher_host_unittest.cc
===================================================================
--- content/browser/loader/resource_dispatcher_host_unittest.cc (revision 222038)
+++ content/browser/loader/resource_dispatcher_host_unittest.cc (working copy)
@@ -159,22 +159,6 @@
}
}
-class MockURLRequestContextSelector
- : public ResourceMessageFilter::URLRequestContextSelector {
- public:
- explicit MockURLRequestContextSelector(
- net::URLRequestContext* request_context)
- : request_context_(request_context) {}
-
- virtual net::URLRequestContext* GetRequestContext(
- ResourceType::Type request_type) OVERRIDE {
- return request_context_;
- }
-
- private:
- net::URLRequestContext* const request_context_;
-};
-
// This class forwards the incoming messages to the ResourceDispatcherHostTest.
// This is used to emulate different sub-processes, since this filter will
// have a different ID than the original. For the test, we want all the incoming
@@ -185,11 +169,11 @@
ResourceContext* resource_context)
: ResourceMessageFilter(
ChildProcessHostImpl::GenerateChildProcessUniqueId(),
- PROCESS_TYPE_RENDERER,
- resource_context, NULL, NULL, NULL,
- new MockURLRequestContextSelector(
- resource_context->GetRequestContext())),
- dest_(dest) {
+ PROCESS_TYPE_RENDERER, NULL, NULL, NULL,
+ base::Bind(&ForwardingFilter::GetContexts,
+ base::Unretained(this))),
+ dest_(dest),
+ resource_context_(resource_context) {
OnChannelConnected(base::GetCurrentProcId());
}
@@ -200,11 +184,21 @@
return dest_->Send(msg);
}
+ ResourceContext* resource_context() { return resource_context_; }
+
protected:
virtual ~ForwardingFilter() {}
private:
+ void GetContexts(const ResourceHostMsg_Request& request,
+ ResourceContext** resource_context,
+ net::URLRequestContext** request_context) {
+ *resource_context = resource_context_;
+ *request_context = resource_context_->GetRequestContext();
+ }
+
IPC::Sender* dest_;
+ ResourceContext* resource_context_;
DISALLOW_COPY_AND_ASSIGN(ForwardingFilter);
};
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | content/browser/loader/resource_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698