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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "chrome/common/chrome_plugin_lib.h" | |
11 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
12 #include "chrome/common/render_messages_params.h" | 11 #include "chrome/common/render_messages_params.h" |
13 #include "content/browser/browser_thread.h" | 12 #include "content/browser/browser_thread.h" |
14 #include "content/browser/child_process_security_policy.h" | 13 #include "content/browser/child_process_security_policy.h" |
15 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 14 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
16 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 15 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
17 #include "content/browser/renderer_host/resource_handler.h" | 16 #include "content/browser/renderer_host/resource_handler.h" |
18 #include "content/browser/renderer_host/resource_message_filter.h" | 17 #include "content/browser/renderer_host/resource_message_filter.h" |
19 #include "content/common/resource_messages.h" | 18 #include "content/common/resource_messages.h" |
20 #include "content/common/resource_response.h" | 19 #include "content/common/resource_response.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 ResourceHostMsg_Request request; | 68 ResourceHostMsg_Request request; |
70 request.method = std::string(method); | 69 request.method = std::string(method); |
71 request.url = url; | 70 request.url = url; |
72 request.first_party_for_cookies = url; // bypass third-party cookie blocking | 71 request.first_party_for_cookies = url; // bypass third-party cookie blocking |
73 request.load_flags = 0; | 72 request.load_flags = 0; |
74 request.origin_pid = 0; | 73 request.origin_pid = 0; |
75 request.resource_type = type; | 74 request.resource_type = type; |
76 request.request_context = 0; | 75 request.request_context = 0; |
77 request.appcache_host_id = appcache::kNoHostId; | 76 request.appcache_host_id = appcache::kNoHostId; |
78 request.download_to_file = false; | 77 request.download_to_file = false; |
79 request.host_renderer_id = -1; | |
80 request.host_render_view_id = -1; | |
81 return request; | 78 return request; |
82 } | 79 } |
83 | 80 |
84 // Spin up the message loop to kick off the request. | 81 // Spin up the message loop to kick off the request. |
85 static void KickOffRequest() { | 82 static void KickOffRequest() { |
86 MessageLoop::current()->RunAllPending(); | 83 MessageLoop::current()->RunAllPending(); |
87 } | 84 } |
88 | 85 |
89 // We may want to move this to a shared space if it is useful for something else | 86 // We may want to move this to a shared space if it is useful for something else |
90 class ResourceIPCAccumulator { | 87 class ResourceIPCAccumulator { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 if (!scheme_.empty()) | 183 if (!scheme_.empty()) |
187 net::URLRequest::RegisterProtocolFactory(scheme_, old_factory_); | 184 net::URLRequest::RegisterProtocolFactory(scheme_, old_factory_); |
188 | 185 |
189 DCHECK(test_fixture_ == this); | 186 DCHECK(test_fixture_ == this); |
190 test_fixture_ = NULL; | 187 test_fixture_ = NULL; |
191 | 188 |
192 host_.Shutdown(); | 189 host_.Shutdown(); |
193 | 190 |
194 ChildProcessSecurityPolicy::GetInstance()->Remove(0); | 191 ChildProcessSecurityPolicy::GetInstance()->Remove(0); |
195 | 192 |
196 // The plugin lib is automatically loaded during these test | |
197 // and we want a clean environment for other tests. | |
198 ChromePluginLib::UnloadAllPlugins(); | |
199 | |
200 // Flush the message loop to make Purify happy. | 193 // Flush the message loop to make Purify happy. |
201 message_loop_.RunAllPending(); | 194 message_loop_.RunAllPending(); |
202 } | 195 } |
203 | 196 |
204 // Creates a request using the current test object as the filter. | 197 // Creates a request using the current test object as the filter. |
205 void MakeTestRequest(int render_view_id, | 198 void MakeTestRequest(int render_view_id, |
206 int request_id, | 199 int request_id, |
207 const GURL& url); | 200 const GURL& url); |
208 | 201 |
209 // Generates a request using the given filter. This will probably be a | 202 // Generates a request using the given filter. This will probably be a |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 const net::URLRequestStatus& status, | 966 const net::URLRequestStatus& status, |
974 const std::string& info) { | 967 const std::string& info) { |
975 return true; | 968 return true; |
976 } | 969 } |
977 | 970 |
978 void OnRequestClosed() {} | 971 void OnRequestClosed() {} |
979 | 972 |
980 private: | 973 private: |
981 DISALLOW_COPY_AND_ASSIGN(DummyResourceHandler); | 974 DISALLOW_COPY_AND_ASSIGN(DummyResourceHandler); |
982 }; | 975 }; |
OLD | NEW |