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

Side by Side Diff: content/browser/renderer_host/resource_dispatcher_host_unittest.cc

Issue 8770027: Get rid of the ChildProcessInfo class. It was carrying unnecessary data, and the fact that some p... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/resource_dispatcher_host.h" 5 #include "content/browser/renderer_host/resource_dispatcher_host.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/process_util.h" 12 #include "base/process_util.h"
13 #include "content/browser/browser_thread_impl.h" 13 #include "content/browser/browser_thread_impl.h"
14 #include "content/browser/child_process_security_policy.h" 14 #include "content/browser/child_process_security_policy.h"
15 #include "content/browser/download/download_id.h" 15 #include "content/browser/download/download_id.h"
16 #include "content/browser/download/download_id_factory.h" 16 #include "content/browser/download/download_id_factory.h"
17 #include "content/browser/mock_resource_context.h" 17 #include "content/browser/mock_resource_context.h"
18 #include "content/browser/renderer_host/dummy_resource_handler.h" 18 #include "content/browser/renderer_host/dummy_resource_handler.h"
19 #include "content/browser/renderer_host/global_request_id.h" 19 #include "content/browser/renderer_host/global_request_id.h"
20 #include "content/browser/renderer_host/resource_dispatcher_host.h" 20 #include "content/browser/renderer_host/resource_dispatcher_host.h"
21 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" 21 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
22 #include "content/browser/renderer_host/resource_handler.h" 22 #include "content/browser/renderer_host/resource_handler.h"
23 #include "content/browser/renderer_host/resource_message_filter.h" 23 #include "content/browser/renderer_host/resource_message_filter.h"
24 #include "content/common/child_process_host.h"
24 #include "content/common/resource_messages.h" 25 #include "content/common/resource_messages.h"
25 #include "content/common/view_messages.h" 26 #include "content/common/view_messages.h"
26 #include "content/public/common/resource_response.h" 27 #include "content/public/common/resource_response.h"
27 #include "net/base/net_errors.h" 28 #include "net/base/net_errors.h"
28 #include "net/base/upload_data.h" 29 #include "net/base/upload_data.h"
29 #include "net/http/http_util.h" 30 #include "net/http/http_util.h"
30 #include "net/url_request/url_request.h" 31 #include "net/url_request/url_request.h"
31 #include "net/url_request/url_request_job.h" 32 #include "net/url_request/url_request_job.h"
32 #include "net/url_request/url_request_test_job.h" 33 #include "net/url_request/url_request_test_job.h"
33 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 }; 155 };
155 156
156 // This class forwards the incoming messages to the ResourceDispatcherHostTest. 157 // This class forwards the incoming messages to the ResourceDispatcherHostTest.
157 // This is used to emulate different sub-processes, since this filter will 158 // This is used to emulate different sub-processes, since this filter will
158 // have a different ID than the original. For the test, we want all the incoming 159 // have a different ID than the original. For the test, we want all the incoming
159 // messages to go to the same place, which is why this forwards. 160 // messages to go to the same place, which is why this forwards.
160 class ForwardingFilter : public ResourceMessageFilter { 161 class ForwardingFilter : public ResourceMessageFilter {
161 public: 162 public:
162 explicit ForwardingFilter(IPC::Message::Sender* dest) 163 explicit ForwardingFilter(IPC::Message::Sender* dest)
163 : ResourceMessageFilter( 164 : ResourceMessageFilter(
164 ChildProcessInfo::GenerateChildProcessUniqueId(), 165 ChildProcessHost::GenerateChildProcessUniqueId(),
165 content::PROCESS_TYPE_RENDERER, 166 content::PROCESS_TYPE_RENDERER,
166 content::MockResourceContext::GetInstance(), 167 content::MockResourceContext::GetInstance(),
167 new MockURLRequestContextSelector( 168 new MockURLRequestContextSelector(
168 content::MockResourceContext::GetInstance()->request_context()), 169 content::MockResourceContext::GetInstance()->request_context()),
169 NULL), 170 NULL),
170 dest_(dest) { 171 dest_(dest) {
171 OnChannelConnected(base::GetCurrentProcId()); 172 OnChannelConnected(base::GetCurrentProcId());
172 } 173 }
173 174
174 // ResourceMessageFilter override 175 // ResourceMessageFilter override
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 EXPECT_EQ(1, host_.pending_requests()); 1226 EXPECT_EQ(1, host_.pending_requests());
1226 1227
1227 // Cancelling by other methods shouldn't work either. 1228 // Cancelling by other methods shouldn't work either.
1228 host_.CancelRequestsForProcess(render_view_id); 1229 host_.CancelRequestsForProcess(render_view_id);
1229 EXPECT_EQ(1, host_.pending_requests()); 1230 EXPECT_EQ(1, host_.pending_requests());
1230 1231
1231 // Cancelling by context should work. 1232 // Cancelling by context should work.
1232 host_.CancelRequestsForContext(&filter_->resource_context()); 1233 host_.CancelRequestsForContext(&filter_->resource_context());
1233 EXPECT_EQ(0, host_.pending_requests()); 1234 EXPECT_EQ(0, host_.pending_requests());
1234 } 1235 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host.h ('k') | content/common/child_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698