| OLD | NEW |
| 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" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 // This class forwards the incoming messages to the ResourceDispatcherHostTest. | 156 // This class forwards the incoming messages to the ResourceDispatcherHostTest. |
| 157 // This is used to emulate different sub-processes, since this filter will | 157 // 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 | 158 // 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. | 159 // messages to go to the same place, which is why this forwards. |
| 160 class ForwardingFilter : public ResourceMessageFilter { | 160 class ForwardingFilter : public ResourceMessageFilter { |
| 161 public: | 161 public: |
| 162 explicit ForwardingFilter(IPC::Message::Sender* dest) | 162 explicit ForwardingFilter(IPC::Message::Sender* dest) |
| 163 : ResourceMessageFilter( | 163 : ResourceMessageFilter( |
| 164 ChildProcessInfo::GenerateChildProcessUniqueId(), | 164 ChildProcessInfo::GenerateChildProcessUniqueId(), |
| 165 ChildProcessInfo::RENDER_PROCESS, | 165 content::PROCESS_TYPE_RENDERER, |
| 166 content::MockResourceContext::GetInstance(), | 166 content::MockResourceContext::GetInstance(), |
| 167 new MockURLRequestContextSelector( | 167 new MockURLRequestContextSelector( |
| 168 content::MockResourceContext::GetInstance()->request_context()), | 168 content::MockResourceContext::GetInstance()->request_context()), |
| 169 NULL), | 169 NULL), |
| 170 dest_(dest) { | 170 dest_(dest) { |
| 171 OnChannelConnected(base::GetCurrentProcId()); | 171 OnChannelConnected(base::GetCurrentProcId()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 // ResourceMessageFilter override | 174 // ResourceMessageFilter override |
| 175 virtual bool Send(IPC::Message* msg) { | 175 virtual bool Send(IPC::Message* msg) { |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 EXPECT_EQ(1, host_.pending_requests()); | 1225 EXPECT_EQ(1, host_.pending_requests()); |
| 1226 | 1226 |
| 1227 // Cancelling by other methods shouldn't work either. | 1227 // Cancelling by other methods shouldn't work either. |
| 1228 host_.CancelRequestsForProcess(render_view_id); | 1228 host_.CancelRequestsForProcess(render_view_id); |
| 1229 EXPECT_EQ(1, host_.pending_requests()); | 1229 EXPECT_EQ(1, host_.pending_requests()); |
| 1230 | 1230 |
| 1231 // Cancelling by context should work. | 1231 // Cancelling by context should work. |
| 1232 host_.CancelRequestsForContext(&filter_->resource_context()); | 1232 host_.CancelRequestsForContext(&filter_->resource_context()); |
| 1233 EXPECT_EQ(0, host_.pending_requests()); | 1233 EXPECT_EQ(0, host_.pending_requests()); |
| 1234 } | 1234 } |
| OLD | NEW |